Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authortiagonbotelho <tiagonbotelho@hotmail.com>2016-11-21 14:42:10 +0300
committertiagonbotelho <tiagonbotelho@hotmail.com>2016-12-07 17:42:51 +0300
commit8b379465a5be48c8062379a3dea8e58110c52d87 (patch)
tree8196abefc1b7b8389b877b4faaad55058d7bd06d /lib
parente09c6df0682c499e221a0da41ac263482fbcf568 (diff)
Reenables /user API request to return private-token if user is admin and requested with sudo
Diffstat (limited to 'lib')
-rw-r--r--lib/api/entities.rb1
-rw-r--r--lib/api/users.rb2
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 899d68bc6c7..1dd191161ef 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -32,6 +32,7 @@ module API
expose :can_create_project?, as: :can_create_project
expose :two_factor_enabled?, as: :two_factor_enabled
expose :external
+ expose :private_token, if: lambda { |user, options| user.is_admin? && options[:sudo_identifier] }
end
class UserLogin < UserFull
diff --git a/lib/api/users.rb b/lib/api/users.rb
index bc2362aa72e..b3870e0c7c8 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -353,7 +353,7 @@ module API
success Entities::UserFull
end
get do
- present current_user, with: Entities::UserFull
+ present current_user, with: Entities::UserFull, sudo_identifier: sudo_identifier
end
desc "Get the currently authenticated user's SSH keys" do