BigW Consortium Gitlab

push_access_level.rb 685 Bytes
Newer Older
1
class ProtectedBranch::PushAccessLevel < ActiveRecord::Base
2 3
  include ProtectedBranchAccess

4 5 6
  validates :access_level, presence: true, inclusion: { in: [Gitlab::Access::MASTER,
                                                             Gitlab::Access::DEVELOPER,
                                                             Gitlab::Access::NO_ACCESS] }
7

8 9
  def self.human_access_levels
    {
10 11 12
      Gitlab::Access::MASTER => "Masters",
      Gitlab::Access::DEVELOPER => "Developers + Masters",
      Gitlab::Access::NO_ACCESS => "No one"
13 14 15
    }.with_indifferent_access
  end

16
  def check_access(user)
17
    return false if access_level == Gitlab::Access::NO_ACCESS
18

19
    super
20
  end
21
end