summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-12-25 13:16:33 +0100
committerDouwe Maan <douwe@gitlab.com>2015-12-25 13:16:33 +0100
commit7dedd997b910f65ee3c494d906fbc2392962c114 (patch)
tree4ff6c88677c75cd366d58c9bd1f2d11f0739bfd5 /lib/api/users.rb
parentef8b1dbf21a90f719c2e8b8c052e16f6107193c6 (diff)
parented777c7bcc990e5e3ff9f8e0d28a1e23af44d8f1 (diff)
downloadgitlab-ce-7dedd997b910f65ee3c494d906fbc2392962c114.tar.gz
Merge branch 'master' into milestone-ref
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r--lib/api/users.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index a98d668e02d..3400f0713ef 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -8,11 +8,17 @@ module API
#
# Example Request:
# GET /users
+ # GET /users?search=Admin
+ # GET /users?username=root
get do
- @users = User.all
- @users = @users.active if params[:active].present?
- @users = @users.search(params[:search]) if params[:search].present?
- @users = paginate @users
+ if params[:username].present?
+ @users = User.where(username: params[:username])
+ else
+ @users = User.all
+ @users = @users.active if params[:active].present?
+ @users = @users.search(params[:search]) if params[:search].present?
+ @users = paginate @users
+ end
if current_user.is_admin?
present @users, with: Entities::UserFull