diff options
author | Douwe Maan <douwe@selenight.nl> | 2018-06-18 12:02:56 +0200 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2018-06-18 12:04:51 +0200 |
commit | 07e95b0cd48192804324a3c47729b5641df54fe6 (patch) | |
tree | 9a8c01fae471f0c457b0934883d401c0297ab8e6 /lib/api | |
parent | 99fdbe4c230205510e1d7061e68bb1a003913d4b (diff) | |
download | gitlab-ce-07e95b0cd48192804324a3c47729b5641df54fe6.tar.gz |
Expose whether current user can push into a branch on branches APIdm-branch-api-can-push
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/entities.rb | 4 |
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 |