diff options
author | Toon Claes <toon@gitlab.com> | 2017-06-13 09:11:33 +0200 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2017-06-15 08:46:34 +0200 |
commit | ef1811f4bc211929997a5b8cc1ecd511b52ca6f4 (patch) | |
tree | 01ca753274ade58376c6f081b83e53c456d1069f /app/finders | |
parent | 42aaae9916b7b76da968579fcc722067947df018 (diff) | |
download | gitlab-ce-ef1811f4bc211929997a5b8cc1ecd511b52ca6f4.tar.gz |
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.rb | 6 |
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 |