summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-08-26 10:55:20 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-08-26 10:55:20 +0200
commit15ace6a910ecb889c58fd4838a4f9a9b710178c7 (patch)
tree647da348e903d9acb86f6063e49d958f207ba874 /lib
parente984a8a3543fa9a26308cea35a42046392f4a488 (diff)
parent2be34630623711fc20ef8c101b5cef688f207cc1 (diff)
downloadgitlab-ce-15ace6a910ecb889c58fd4838a4f9a9b710178c7.tar.gz
Merge commit '2be34630623711fc20ef8c101b5cef688f207cc1' into backstage/gb/rename-ci-cd-processing-sidekiq-queuesbackstage/gb/rename-ci-cd-processing-sidekiq-queues
* commit '2be34630623711fc20ef8c101b5cef688f207cc1': Common Docker Documentation Location in `gitlab-ce` fix deprecation warning present during webpack compiles Enable 5 lines of Sidekiq backtrace lines to aid in debugging Add support for copying permalink to notes via more actions dropdown Handle creating a nested group on MySQL correctly Decrease statuses batch size even more in a migration Fix repo editor scrollbar Replace 'source/search_code.feature' spinach test with an rspec analog Authorizations regarding OAuth - style confirmation Update README.md Refactor complicated API group finding rules into GroupsFinder Fix group and project search for anonymous users Document version Group Milestones API introduced Allow v4 API GET requests for groups to be unauthenticated Adjust a range and a size in stages statuses migration Update README.md Point to /developers on docs/administration/authentiq.md Indexes GFM markdown guide use inline links instead of referenced Add index on ci_runners.contacted_at
Diffstat (limited to 'lib')
-rw-r--r--lib/api/groups.rb14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/api/groups.rb b/lib/api/groups.rb
index 49c3b2278c7..e56427304a6 100644
--- a/lib/api/groups.rb
+++ b/lib/api/groups.rb
@@ -2,7 +2,7 @@ module API
class Groups < Grape::API
include PaginationParams
- before { authenticate! }
+ before { authenticate_non_get! }
helpers do
params :optional_params_ce do
@@ -47,16 +47,8 @@ module API
use :pagination
end
get do
- groups = if params[:owned]
- current_user.owned_groups
- elsif current_user.admin
- Group.all
- elsif params[:all_available]
- GroupsFinder.new(current_user).execute
- else
- current_user.groups
- end
-
+ find_params = { all_available: params[:all_available], owned: params[:owned] }
+ groups = GroupsFinder.new(current_user, find_params).execute
groups = groups.search(params[:search]) if params[:search].present?
groups = groups.where.not(id: params[:skip_groups]) if params[:skip_groups].present?
groups = groups.reorder(params[:order_by] => params[:sort])