summaryrefslogtreecommitdiff
path: root/lib/api/users.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-07-12 12:18:14 +0200
committerRémy Coutable <remy@rymai.me>2017-07-12 12:45:46 +0200
commit91f63820a540e7f3e7206dc8044e257cf28527dc (patch)
treecb00077df90431ce561d6314a4542cb3a7aa988b /lib/api/users.rb
parentdc05bcd885e441e8cac0e5038141bca0775f049d (diff)
downloadgitlab-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.rb11
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