summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPatrick Bajao <ebajao@gitlab.com>2019-03-21 19:11:06 +0800
committerPatrick Bajao <ebajao@gitlab.com>2019-03-21 19:53:04 +0800
commit438485ef88c762b59ee9fb6089d8b7256554fe24 (patch)
treebe68b7349d3b758c18826f77bd72528b6d2bc4ad /lib
parent6811f1aca57b0216a16195804d9b453fe1796baa (diff)
downloadgitlab-ce-438485ef88c762b59ee9fb6089d8b7256554fe24.tar.gz
Allow users to create protected branches via CLI
This is for fixing a regression introduced by: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24969 This fix will allow users who are allowed to push to protected branches to create protected branches via CLI as well, just like before. The checks for protected branch creation won't need to run.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/checks/branch_check.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/gitlab/checks/branch_check.rb b/lib/gitlab/checks/branch_check.rb
index ad926739752..1dbd564fb6f 100644
--- a/lib/gitlab/checks/branch_check.rb
+++ b/lib/gitlab/checks/branch_check.rb
@@ -59,6 +59,8 @@ module Gitlab
def protected_branch_creation_checks
logger.log_timed(LOG_MESSAGES[:protected_branch_creation_checks]) do
+ break if user_access.can_push_to_branch?(branch_name)
+
unless user_access.can_merge_to_branch?(branch_name)
raise GitAccess::UnauthorizedError, ERROR_MESSAGES[:create_protected_branch]
end