diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-09 21:09:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-09 21:09:48 +0300 |
commit | 9b09561f47159655d05171b4bee980c669859864 (patch) | |
tree | 06a273b8ee38d644ab6a45c2c78856cb38c756e8 /lib/gitlab/checks/push_check.rb | |
parent | e91cb68359c900aa51ffdb1863502168742e94f0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/checks/push_check.rb')
-rw-r--r-- | lib/gitlab/checks/push_check.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/gitlab/checks/push_check.rb b/lib/gitlab/checks/push_check.rb index 4ee53eea25a..0f0d8bb82ec 100644 --- a/lib/gitlab/checks/push_check.rb +++ b/lib/gitlab/checks/push_check.rb @@ -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 |