2020-04-08 14:13:33 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class UserHighestRole < ApplicationRecord
|
|
|
|
belongs_to :user, optional: false
|
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
validates :highest_access_level, allow_nil: true, inclusion: { in: ->(_) { self.allowed_values } }
|
2020-04-22 19:07:51 +05:30
|
|
|
|
|
|
|
scope :with_highest_access_level, -> (highest_access_level) { where(highest_access_level: highest_access_level) }
|
2021-11-18 22:05:49 +05:30
|
|
|
|
|
|
|
def self.allowed_values
|
|
|
|
Gitlab::Access.all_values
|
|
|
|
end
|
2020-04-08 14:13:33 +05:30
|
|
|
end
|
2021-11-18 22:05:49 +05:30
|
|
|
|
|
|
|
UserHighestRole.prepend_mod
|