diff options
author | James Lopez <james@jameslopez.es> | 2017-07-07 09:29:00 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-07-07 10:38:57 +0200 |
commit | 1a7d2aba3b06a1e4fcc3861eeb70af30fc3330f6 (patch) | |
tree | 749815838ad52bc4547f4d6d28f56a8e623fe319 /lib | |
parent | b08df253ef16d635883451aafeb71b4a6f4ccd09 (diff) | |
download | gitlab-ce-1a7d2aba3b06a1e4fcc3861eeb70af30fc3330f6.tar.gz |
add created at filter logic to users finder and API
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/users.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb index 88bca235692..47a44ba9598 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -48,6 +48,8 @@ module API optional :active, type: Boolean, default: false, desc: 'Filters only active users' optional :external, type: Boolean, default: false, desc: 'Filters only external users' optional :blocked, type: Boolean, default: false, desc: 'Filters only blocked users' + optional :created_after, type: DateTime, desc: 'Return users created after the specified time' + optional :created_before, type: DateTime, desc: 'Return users created before the specified time' all_or_none_of :extern_uid, :provider use :pagination @@ -55,6 +57,10 @@ module API get do authenticated_as_admin! if params[:external].present? || (params[:extern_uid].present? && params[:provider].present?) + unless current_user.admin? + params.except!(:created_after, :created_before) + end + users = UsersFinder.new(current_user, params).execute authorized = can?(current_user, :read_users_list) |