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/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-27 13:32:59 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-27 13:32:59 +0300
commitab5ec2e047ff0942db3aab555926bdd07c051087 (patch)
tree199d1135301a0e5ee03804fbddf87132fe753ef7 /app
parent431f1b7aa248c4e4d5f251e6ebf5f9157f9c1243 (diff)
Add latest changes from gitlab-org/security/gitlab@14-3-stable-ee
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 74ffeef797e..0ba97138a25 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -2726,8 +2726,23 @@ class Project < ApplicationRecord
self.errors.add(:base, _("Could not change HEAD: branch '%{branch}' does not exist") % { branch: branch })
end
+ def visible_group_links(for_user:)
+ user = for_user
+ links = project_group_links_with_preload
+ user.max_member_access_for_group_ids(links.map(&:group_id)) if user && links.any?
+
+ DeclarativePolicy.user_scope do
+ links.select { Ability.allowed?(user, :read_group, _1.group) }
+ end
+ end
+
private
+ # overridden in EE
+ def project_group_links_with_preload
+ project_group_links
+ end
+
def save_topics
return if @topic_list.nil?