diff options
author | Rémy Coutable <remy@rymai.me> | 2017-07-12 12:18:14 +0200 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-07-12 12:45:46 +0200 |
commit | 91f63820a540e7f3e7206dc8044e257cf28527dc (patch) | |
tree | cb00077df90431ce561d6314a4542cb3a7aa988b /lib/api/users.rb | |
parent | dc05bcd885e441e8cac0e5038141bca0775f049d (diff) | |
download | gitlab-ce-91f63820a540e7f3e7206dc8044e257cf28527dc.tar.gz |
Return `is_admin` attribute in the GET /user endpoint for admins
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r-- | lib/api/users.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb index c469751c31c..81c68ea2658 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -421,7 +421,16 @@ module API success Entities::UserPublic end get do - present current_user, with: sudo? ? Entities::UserWithPrivateDetails : Entities::UserPublic + entity = + if sudo? + Entities::UserWithPrivateDetails + elsif current_user.admin? + Entities::UserWithAdmin + else + Entities::UserPublic + end + + present current_user, with: entity end desc "Get the currently authenticated user's SSH keys" do |