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:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-02-27 16:18:32 +0300
committerBob Van Landuyt <bob@vanlanduyt.co>2018-03-07 17:12:31 +0300
commitc9557ad711c6cdf4465fb8c3c9b0dbaffcafa0e8 (patch)
tree0b54dcec837e4101588813df8c10e1232e13bc32 /lib/gitlab/user_access.rb
parentb2ef83856de8c175d384688d09023d16dcfef0c6 (diff)
Allow maintainers to push to a single branch
Diffstat (limited to 'lib/gitlab/user_access.rb')
-rw-r--r--lib/gitlab/user_access.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb
index 91b8bb2a83f..fa32776d9f8 100644
--- a/lib/gitlab/user_access.rb
+++ b/lib/gitlab/user_access.rb
@@ -68,8 +68,12 @@ module Gitlab
return true if project.user_can_push_to_empty_repo?(user)
protected_branch_accessible_to?(ref, action: :push)
+ elsif user.can?(:push_code, project)
+ true
+ elsif user.can?(:push_single_branch, project)
+ project.branches_allowing_maintainer_access_to_user(user).include?(ref)
else
- user.can?(:push_code, project)
+ false
end
end