From 07e95b0cd48192804324a3c47729b5641df54fe6 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 18 Jun 2018 12:02:56 +0200 Subject: Expose whether current user can push into a branch on branches API --- lib/api/entities.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/api/entities.rb') 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 -- cgit v1.2.1