summaryrefslogtreecommitdiff
path: root/lib/api/groups.rb
diff options
context:
space:
mode:
authorRoger Rüttimann <roger.ruettimann@gmail.com>2018-05-01 09:24:21 +0000
committerDouwe Maan <douwe@gitlab.com>2018-05-01 09:24:21 +0000
commitbc7877e8c15d9fb07824e00eeac20bb9c0f12997 (patch)
tree882e18f550a512911e045fa1ebd37738b7555481 /lib/api/groups.rb
parent36043ab9f1ebe4f32e0d3192b74c902aec4f266a (diff)
downloadgitlab-ce-bc7877e8c15d9fb07824e00eeac20bb9c0f12997.tar.gz
show only groups an admin is a member of in dashboards/grops
Diffstat (limited to 'lib/api/groups.rb')
-rw-r--r--lib/api/groups.rb16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index 4a4df1b8b9e..92e3d5cc10a 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -37,13 +37,11 @@ module API
use :pagination
end
- def find_groups(params)
- find_params = {
- all_available: params[:all_available],
- custom_attributes: params[:custom_attributes],
- owned: params[:owned]
- }
- find_params[:parent] = find_group!(params[:id]) if params[:id]
+ def find_groups(params, parent_id = nil)
+ find_params = params.slice(:all_available, :custom_attributes, :owned)
+ find_params[:parent] = find_group!(parent_id) if parent_id
+ find_params[:all_available] =
+ find_params.fetch(:all_available, current_user&.full_private_access?)
groups = GroupsFinder.new(current_user, find_params).execute
groups = groups.search(params[:search]) if params[:search].present?
@@ -85,7 +83,7 @@ module API
use :with_custom_attributes
end
get do
- groups = find_groups(params)
+ groups = find_groups(declared_params(include_missing: false), params[:id])
present_groups params, groups
end
@@ -213,7 +211,7 @@ module API
use :with_custom_attributes
end
get ":id/subgroups" do
- groups = find_groups(params)
+ groups = find_groups(declared_params(include_missing: false), params[:id])
present_groups params, groups
end