summaryrefslogtreecommitdiff
path: root/lib/api/entities.rb
diff options
context:
space:
mode:
authorEric <eric.yu@twosigma.com>2017-08-02 10:16:17 +0000
committerRémy Coutable <remy@rymai.me>2017-08-02 10:16:17 +0000
commitfb5b2d8d0eb544630f97233731466a18380301c7 (patch)
tree692486a690ae1b8b5153fc72ccd4e0e860281159 /lib/api/entities.rb
parent30413fd2fffb42424d83c68814a2e8e70bf94671 (diff)
downloadgitlab-ce-fb5b2d8d0eb544630f97233731466a18380301c7.tar.gz
Extending API for protected branches
Diffstat (limited to 'lib/api/entities.rb')
-rw-r--r--lib/api/entities.rb15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index ce25be34ec4..f31fe704e0c 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -240,7 +240,7 @@ module API
end
expose :protected do |repo_branch, options|
- ProtectedBranch.protected?(options[:project], repo_branch.name)
+ ::ProtectedBranch.protected?(options[:project], repo_branch.name)
end
expose :developers_can_push do |repo_branch, options|
@@ -299,6 +299,19 @@ module API
expose :deleted_file?, as: :deleted_file
end
+ class ProtectedRefAccess < Grape::Entity
+ expose :access_level
+ expose :access_level_description do |protected_ref_access|
+ protected_ref_access.humanize
+ end
+ end
+
+ class ProtectedBranch < Grape::Entity
+ expose :name
+ expose :push_access_levels, using: Entities::ProtectedRefAccess
+ expose :merge_access_levels, using: Entities::ProtectedRefAccess
+ end
+
class Milestone < Grape::Entity
expose :id, :iid
expose :project_id, if: -> (entity, options) { entity&.project_id }