diff options
author | Mike Ricketts <rickettm@uk.ibm.com> | 2017-06-20 14:54:29 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-06-20 14:54:29 +0000 |
commit | 0e7478064f3cf91fec8cffb86a74503ab3e0322d (patch) | |
tree | be88ac18b51372e72855355e935489591a9d3775 /lib/api | |
parent | 745d46bc88be45066d4abb448f1308f11f970e26 (diff) | |
download | gitlab-ce-0e7478064f3cf91fec8cffb86a74503ab3e0322d.tar.gz |
Re-instate is_admin flag in users API is current user is an admin
Diffstat (limited to 'lib/api')
-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 412443a2405..8bce79529e6 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 7257ecb5b67..bfb69d6dc18 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -59,7 +59,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 |