Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYatish Mehta <yatish.mehta@coupa.com>2016-10-26 00:08:53 +0300
committerYatish Mehta <yatish.mehta@coupa.com>2016-11-08 23:04:05 +0300
commita0aaf93fe591215a7fc29a52ff6cbd38604c8dcb (patch)
tree8742a213a18bdae2f7de15b4851c60ed2c898394 /lib
parentc6d010986724faf10b46453d66eaca38a948fabf (diff)
Add query param to filter users on 'external' & 'blocked' type on API
Diffstat (limited to 'lib')
-rw-r--r--lib/api/users.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index c28e07a76b7..298c401a816 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -10,6 +10,9 @@ module API
# GET /users
# GET /users?search=Admin
# GET /users?username=root
+ # GET /users?active=true
+ # GET /users?external=true
+ # GET /users?blocked=true
get do
unless can?(current_user, :read_users_list, nil)
render_api_error!("Not authorized.", 403)
@@ -19,8 +22,10 @@ module API
@users = User.where(username: params[:username])
else
@users = User.all
- @users = @users.active if params[:active].present?
+ @users = @users.active if to_boolean(params[:active])
@users = @users.search(params[:search]) if params[:search].present?
+ @users = @users.blocked if to_boolean(params[:blocked])
+ @users = @users.external if to_boolean(params[:external]) && current_user.is_admin?
@users = paginate @users
end