Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric <eric.yu@twosigma.com>2017-08-02 13:16:17 +0300
committerRémy Coutable <remy@rymai.me>2017-08-02 13:16:17 +0300
commitfb5b2d8d0eb544630f97233731466a18380301c7 (patch)
tree692486a690ae1b8b5153fc72ccd4e0e860281159 /app/models/concerns/protected_branch_access.rb
parent30413fd2fffb42424d83c68814a2e8e70bf94671 (diff)
Extending API for protected branches
Diffstat (limited to 'app/models/concerns/protected_branch_access.rb')
-rw-r--r--app/models/concerns/protected_branch_access.rb12
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