summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
authorGeorge Andrinopoulos <geoandri@gmail.com>2017-05-15 13:53:12 +0000
committerRémy Coutable <remy@rymai.me>2017-05-15 13:53:12 +0000
commit872e7b7efe923192d4ef90b01672038518ba66fc (patch)
treef4dfdf553d480d0d7539f9dbd2e5bb630860a844 /lib/api/users.rb
parentf5e5afc7901b646ab26130893bcbccbe5452db18 (diff)
downloadgitlab-ce-872e7b7efe923192d4ef90b01672038518ba66fc.tar.gz
Create a Users Finder
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r--lib/api/users.rb11
1 files changed, 1 insertions, 10 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index 40acaebf670..3d83720b7b9 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -56,16 +56,7 @@ module API
authenticated_as_admin! if params[:external].present? || (params[:extern_uid].present? && params[:provider].present?)
- users = User.all
- users = User.where(username: params[:username]) if params[:username]
- users = users.active if params[:active]
- users = users.search(params[:search]) if params[:search].present?
- users = users.blocked if params[:blocked]
-
- if current_user.admin?
- users = users.joins(:identities).merge(Identity.with_extern_uid(params[:provider], params[:extern_uid])) if params[:extern_uid] && params[:provider]
- users = users.external if params[:external]
- end
+ users = UsersFinder.new(current_user, params).execute
entity = current_user.admin? ? Entities::UserPublic : Entities::UserBasic
present paginate(users), with: entity