diff options
| author | Douwe Maan <douwe@gitlab.com> | 2017-01-23 20:36:28 +0000 |
|---|---|---|
| committer | Douwe Maan <douwe@gitlab.com> | 2017-01-23 20:36:28 +0000 |
| commit | 0d77b99cddbf891c872c4a2b788fa2eebb3d49e5 (patch) | |
| tree | 8e2f6db0b3c13e5d98be8574143db3de975140c7 /lib | |
| parent | bf04a3a9b25d325ea4cb0c00338c18326b11b5dc (diff) | |
| parent | eb9b96405498e37b25aa32876b0e101d1880f4e9 (diff) | |
| download | gitlab-ce-0d77b99cddbf891c872c4a2b788fa2eebb3d49e5.tar.gz | |
Merge branch '22638-creating-a-branch-matching-a-wildcard-fails' into 'master'
Allow creating protected branches when user can merge to such branch
Closes #22638
See merge request !8458
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gitlab/user_access.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb index 6c7e673fb9f..6ce9b229294 100644 --- a/lib/gitlab/user_access.rb +++ b/lib/gitlab/user_access.rb @@ -35,7 +35,9 @@ module Gitlab return true if project.empty_repo? && project.user_can_push_to_empty_repo?(user) access_levels = project.protected_branches.matching(ref).map(&:push_access_levels).flatten - access_levels.any? { |access_level| access_level.check_access(user) } + has_access = access_levels.any? { |access_level| access_level.check_access(user) } + + has_access || !project.repository.branch_exists?(ref) && can_merge_to_branch?(ref) else user.can?(:push_code, project) end |
