diff options
author | Rémy Coutable <remy@rymai.me> | 2017-06-20 17:54:30 +0300 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2017-06-20 18:28:54 +0300 |
commit | b5d6ef0eeb337c221a6a5a8594d7154c1fba8c26 (patch) | |
tree | 5da73a812823bcba8ef850864c1590a912645194 /lib | |
parent | 57682e8dee73f04832bec69e5fe21b0537072d39 (diff) |
Merge branch '33260-allow-admins-to-list-admins' into 'master'
Re-instate is_admin flag in users API is current user is an admin
Closes #33260
See merge request !12211
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 7 | ||||
-rw-r--r-- | lib/api/users.rb | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index a836df3dc81..a4c41ceb724 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -43,11 +43,14 @@ module API expose :external end - class UserWithPrivateDetails < UserPublic - expose :private_token + class UserWithAdmin < UserPublic expose :admin?, as: :is_admin end + class UserWithPrivateDetails < UserWithAdmin + expose :private_token + end + class Email < Grape::Entity expose :id, :email end diff --git a/lib/api/users.rb b/lib/api/users.rb index dda64715ee1..37f868bb343 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -58,7 +58,7 @@ module API users = UsersFinder.new(current_user, params).execute - entity = current_user.admin? ? Entities::UserPublic : Entities::UserBasic + entity = current_user.admin? ? Entities::UserWithAdmin : Entities::UserBasic present paginate(users), with: entity end |