Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-31 21:09:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-31 21:09:19 +0300
commit676109e1b32682bdbdd94a9ffbd8743784f35521 (patch)
tree71f0394c68455c1736a14c215992de6aa5fe358c /lib/gitlab/user_access.rb
parent5facc34f44ce8736078127a5df174a7b52d922b4 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/user_access.rb')
-rw-r--r--lib/gitlab/user_access.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/gitlab/user_access.rb b/lib/gitlab/user_access.rb
index 0af7ad6ec17..a4a1cccf9d5 100644
--- a/lib/gitlab/user_access.rb
+++ b/lib/gitlab/user_access.rb
@@ -11,10 +11,11 @@ module Gitlab
attr_reader :user, :push_ability
attr_accessor :container
- def initialize(user, container: nil, push_ability: :push_code)
+ def initialize(user, container: nil, push_ability: :push_code, skip_collaboration_check: false)
@user = user
@container = container
@push_ability = push_ability
+ @skip_collaboration_check = skip_collaboration_check
end
def can_do_action?(action)
@@ -87,6 +88,8 @@ module Gitlab
private
+ attr_reader :skip_collaboration_check
+
def can_push?
user.can?(push_ability, container)
end
@@ -98,6 +101,8 @@ module Gitlab
end
def branch_allows_collaboration_for?(ref)
+ return false if skip_collaboration_check
+
# Checking for an internal project or group to prevent an infinite loop:
# https://gitlab.com/gitlab-org/gitlab/issues/36805
(!project.internal? && project.branch_allows_collaboration?(user, ref))