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:
authorToon Claes <toon@gitlab.com>2017-06-13 10:11:33 +0300
committerToon Claes <toon@gitlab.com>2017-06-15 09:46:34 +0300
commitef1811f4bc211929997a5b8cc1ecd511b52ca6f4 (patch)
tree01ca753274ade58376c6f081b83e53c456d1069f /app/finders
parent42aaae9916b7b76da968579fcc722067947df018 (diff)
Subgroups page should show groups authorized through inheritance
When a user is authorized to a group, they are also authorized to see all the ancestor groups and descendant groups. When a user is authorized to a project, they are authorized to see all the ancestor groups too. Closes #32135 See merge request !11764
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/groups_finder.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/finders/groups_finder.rb b/app/finders/groups_finder.rb
index f68610e197c..cb4ab6eacc1 100644
--- a/app/finders/groups_finder.rb
+++ b/app/finders/groups_finder.rb
@@ -16,7 +16,11 @@ class GroupsFinder < UnionFinder
def all_groups
groups = []
- groups << current_user.authorized_groups if current_user
+ if current_user
+ groups_for_ancestors = find_union([current_user.authorized_groups, authorized_project_groups], Group)
+ groups_for_descendants = current_user.authorized_groups
+ groups << Gitlab::GroupHierarchy.new(groups_for_ancestors, groups_for_descendants).all_groups
+ end
groups << Group.unscoped.public_to_user(current_user)
groups