diff options
author | Eric <eric.yu@twosigma.com> | 2017-08-02 10:16:17 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-08-02 10:16:17 +0000 |
commit | fb5b2d8d0eb544630f97233731466a18380301c7 (patch) | |
tree | 692486a690ae1b8b5153fc72ccd4e0e860281159 /app | |
parent | 30413fd2fffb42424d83c68814a2e8e70bf94671 (diff) | |
download | gitlab-ce-fb5b2d8d0eb544630f97233731466a18380301c7.tar.gz |
Extending API for protected branches
Diffstat (limited to 'app')
-rw-r--r-- | app/models/concerns/protected_branch_access.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/models/concerns/protected_branch_access.rb b/app/models/concerns/protected_branch_access.rb index a40148a4394..fde1cc44afa 100644 --- a/app/models/concerns/protected_branch_access.rb +++ b/app/models/concerns/protected_branch_access.rb @@ -1,6 +1,12 @@ module ProtectedBranchAccess extend ActiveSupport::Concern + ALLOWED_ACCESS_LEVELS ||= [ + Gitlab::Access::MASTER, + Gitlab::Access::DEVELOPER, + Gitlab::Access::NO_ACCESS + ].freeze + included do include ProtectedRefAccess @@ -9,11 +15,7 @@ module ProtectedBranchAccess delegate :project, to: :protected_branch validates :access_level, presence: true, inclusion: { - in: [ - Gitlab::Access::MASTER, - Gitlab::Access::DEVELOPER, - Gitlab::Access::NO_ACCESS - ] + in: ALLOWED_ACCESS_LEVELS } def self.human_access_levels |