summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2018-06-19 15:42:07 +0000
committerRobert Speicher <robert@gitlab.com>2018-06-19 15:42:07 +0000
commite7549b9882560cf8cc3e61f67acbf69cf3c4c7d4 (patch)
tree3ea48dd4f8ab7f1d4aadf131429b65b542e26eec /lib/api
parent80044bdad09cfa09f89e4e45b49fc0abb19a6c84 (diff)
parent07e95b0cd48192804324a3c47729b5641df54fe6 (diff)
downloadgitlab-ce-e7549b9882560cf8cc3e61f67acbf69cf3c4c7d4.tar.gz
Merge branch 'dm-branch-api-can-push' into 'master'
Expose whether current user can push into a branch on branches API See merge request gitlab-org/gitlab-ce!19958
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/entities.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 1cc8fcb8408..bb48a86fe9e 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -349,6 +349,10 @@ module API
expose :developers_can_merge do |repo_branch, options|
options[:project].protected_branches.developers_can?(:merge, repo_branch.name)
end
+
+ expose :can_push do |repo_branch, options|
+ Gitlab::UserAccess.new(options[:current_user], project: options[:project]).can_push_to_branch?(repo_branch.name)
+ end
end
class TreeObject < Grape::Entity