diff options
author | Sean McGivern <sean@gitlab.com> | 2018-08-28 19:30:38 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-09-17 14:36:53 +0300 |
commit | b3cd850c3f47ab2527b13d5038abb99893a6bff9 (patch) | |
tree | 5cd4744dec0998738833b7d3b49b7353e22c8477 /app | |
parent | 9357585ecacacfa0618b4f4172d5ea7dd0b1c5ae (diff) |
Remove EE-specific code from ProtectedRefAccess
Diffstat (limited to 'app')
-rw-r--r-- | app/models/concerns/protected_ref_access.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/app/models/concerns/protected_ref_access.rb b/app/models/concerns/protected_ref_access.rb index efa666fb3f2..583751ea6ac 100644 --- a/app/models/concerns/protected_ref_access.rb +++ b/app/models/concerns/protected_ref_access.rb @@ -3,18 +3,22 @@ module ProtectedRefAccess extend ActiveSupport::Concern - ALLOWED_ACCESS_LEVELS = [ - Gitlab::Access::MAINTAINER, - Gitlab::Access::DEVELOPER, - Gitlab::Access::NO_ACCESS - ].freeze - HUMAN_ACCESS_LEVELS = { Gitlab::Access::MAINTAINER => "Maintainers".freeze, Gitlab::Access::DEVELOPER => "Developers + Maintainers".freeze, Gitlab::Access::NO_ACCESS => "No one".freeze }.freeze + class_methods do + def allowed_access_levels + [ + Gitlab::Access::MAINTAINER, + Gitlab::Access::DEVELOPER, + Gitlab::Access::NO_ACCESS + ] + end + end + included do scope :master, -> { maintainer } # @deprecated scope :maintainer, -> { where(access_level: Gitlab::Access::MAINTAINER) } @@ -26,7 +30,7 @@ module ProtectedRefAccess scope :for_group, -> { where.not(group_id: nil) } validates :access_level, presence: true, if: :role?, inclusion: { - in: ALLOWED_ACCESS_LEVELS + in: self.allowed_access_levels } end |