From 438485ef88c762b59ee9fb6089d8b7256554fe24 Mon Sep 17 00:00:00 2001 From: Patrick Bajao Date: Thu, 21 Mar 2019 19:11:06 +0800 Subject: 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. --- lib/gitlab/checks/branch_check.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/gitlab/checks') 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 -- cgit v1.2.3