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:
Diffstat (limited to 'app/finders/groups_finder.rb')
-rw-r--r--app/finders/groups_finder.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/finders/groups_finder.rb b/app/finders/groups_finder.rb
index 0eeba1d2428..436abb332ff 100644
--- a/app/finders/groups_finder.rb
+++ b/app/finders/groups_finder.rb
@@ -38,6 +38,7 @@ class GroupsFinder < UnionFinder
attr_reader :current_user, :params
+ # rubocop: disable CodeReuse/ActiveRecord
def all_groups
return [owned_groups] if params[:owned]
return [groups_with_min_access_level] if min_access_level?
@@ -49,6 +50,7 @@ class GroupsFinder < UnionFinder
groups << Group.none if groups.empty?
groups
end
+ # rubocop: enable CodeReuse/ActiveRecord
def groups_for_ancestors
current_user.authorized_groups
@@ -58,6 +60,7 @@ class GroupsFinder < UnionFinder
current_user.groups
end
+ # rubocop: disable CodeReuse/ActiveRecord
def groups_with_min_access_level
groups = current_user
.groups
@@ -67,16 +70,21 @@ class GroupsFinder < UnionFinder
.new(groups)
.base_and_descendants
end
+ # rubocop: enable CodeReuse/ActiveRecord
+ # rubocop: disable CodeReuse/ActiveRecord
def by_parent(groups)
return groups unless params[:parent]
groups.where(parent: params[:parent])
end
+ # rubocop: enable CodeReuse/ActiveRecord
+ # rubocop: disable CodeReuse/ActiveRecord
def owned_groups
current_user&.owned_groups || Group.none
end
+ # rubocop: enable CodeReuse/ActiveRecord
def include_public_groups?
current_user.nil? || all_available?