summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/users.rb')
-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