summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axilleas@axilleas.me>2015-12-25 14:21:14 +0200
committerAchilleas Pipinellis <axilleas@axilleas.me>2015-12-25 14:21:14 +0200
commit05f8c585f71256bf07c83efba2beb516efd72c4c (patch)
tree5f5ea48835898657c4fd6defd8527ad78ad4547c /lib/api/users.rb
parenta3de46654b2fe0f02995913a771e6423bb584d64 (diff)
parented777c7bcc990e5e3ff9f8e0d28a1e23af44d8f1 (diff)
downloadgitlab-ce-05f8c585f71256bf07c83efba2beb516efd72c4c.tar.gz
Merge branch 'master' into adding_crime_security
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