diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-07-12 11:36:10 +0000 |
---|---|---|
committer | Clement Ho <ClemMakesApps@gmail.com> | 2017-07-12 10:41:12 -0500 |
commit | 9355d91c5bec7d2e97bf20d91398d692acce2bcf (patch) | |
tree | ef960617ae0a650c71332ff11e2fa7f4fde3bbb0 /lib/api/users.rb | |
parent | 462ef2d83840195ea77c1c41abec6e2bfbe0fa02 (diff) | |
download | gitlab-ce-9-3-stable-patch-7.tar.gz |
Merge branch '34325-reinstate-is_admin-for-user-api' into 'master'9-3-stable-patch-7
Return `is_admin` attribute in the GET /user endpoint for admins
Closes #34325
See merge request !12811
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 db1f0ff392b..861d92e5b21 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -402,7 +402,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 |