summaryrefslogtreecommitdiff
path: root/app/models/user_highest_role.rb
blob: dd5c85a5a87683718d0f83d20e94dff08d95c965 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

class UserHighestRole < ApplicationRecord
  belongs_to :user, optional: false

  validates :highest_access_level, allow_nil: true, inclusion: { in: ->(_) { self.allowed_values } }

  scope :with_highest_access_level, -> (highest_access_level) { where(highest_access_level: highest_access_level) }

  def self.allowed_values
    Gitlab::Access.all_values
  end
end

UserHighestRole.prepend_mod