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
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-31 01:40:10 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-31 01:40:10 +0300
commitb8cacd68a6297f2c6cdd454a3d82a487367f2e70 (patch)
tree093014d689cb2c662f8f3f112791d952263a3b1a /lib
parentb2ce3643e27db4cc0ad30cc09d651c00ec799887 (diff)
Add latest changes from gitlab-org/security/gitlab@13-10-stable-ee
Diffstat (limited to 'lib')
-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))