summaryrefslogtreecommitdiff
path: root/lib/gitlab/user_access.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/user_access.rb')
-rw-r--r--lib/gitlab/user_access.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb
index 1c6ddc2e70f..eec89e1ab72 100644
--- a/lib/gitlab/user_access.rb
+++ b/lib/gitlab/user_access.rb
@@ -90,9 +90,13 @@ module Gitlab
def can_collaborate?(ref)
assert_project!
+ can_push? || branch_allows_collaboration_for?(ref)
+ end
+
+ def branch_allows_collaboration_for?(ref)
# Checking for an internal project or group to prevent an infinite loop:
# https://gitlab.com/gitlab-org/gitlab/issues/36805
- can_push? || (!project.internal? && project.branch_allows_collaboration?(user, ref))
+ (!project.internal? && project.branch_allows_collaboration?(user, ref))
end
def permission_cache