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/models/group.rb')
-rw-r--r--app/models/group.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/group.rb b/app/models/group.rb
index 8b21206fccf..042201ffa14 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -473,6 +473,12 @@ class Group < Namespace
errors.add(:visibility_level, "#{visibility} is not allowed since there are sub-groups with higher visibility.")
end
+
+ def self.groups_including_descendants_by(group_ids)
+ Gitlab::ObjectHierarchy
+ .new(Group.where(id: group_ids))
+ .base_and_descendants
+ end
end
Group.prepend_if_ee('EE::Group')