Commit c5995a35 authored by Stan Hu's avatar Stan Hu

Merge branch '292450-branch-protection-broken' into 'master'

Put new call behind feature flag

See merge request gitlab-org/gitlab!49585
parents 693ce550 096ad222
......@@ -14,9 +14,17 @@ module Gitlab
private
def can_push?
user_access.can_push_to_branch?(ref) ||
user_access_can_push? ||
project.branch_allows_collaboration?(user_access.user, branch_name)
end
def user_access_can_push?
if Feature.enabled?(:deploy_keys_on_protected_branches, project)
user_access.can_push_to_branch?(ref)
else
user_access.can_do_action?(:push_code)
end
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment