diff options
author | Imre Farkas <ifarkas@gitlab.com> | 2018-11-08 16:03:56 +0100 |
---|---|---|
committer | Imre Farkas <ifarkas@gitlab.com> | 2018-11-12 12:16:25 +0100 |
commit | f3cd24a9f3f581488d621475e55e3a81bbd9e67c (patch) | |
tree | 66266d4ae8b2864a2e8423f7e8022483c357ccb9 /lib/api | |
parent | 369631c84195f6b8b26624d5647ae994e64b77e8 (diff) | |
download | gitlab-ce-f3cd24a9f3f581488d621475e55e3a81bbd9e67c.tar.gz |
Display impersonation token value only after creationif-53347_fix_impersonation_tokens
Since we migrated all PersonlAccessTokens to store only its hash in the
DB, the token value can no longer be shown to the user.
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/entities.rb | 6 | ||||
-rw-r--r-- | lib/api/users.rb | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 61d57c643f0..5572e86985c 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1263,7 +1263,11 @@ module API expose :token end - class ImpersonationToken < PersonalAccessTokenWithToken + class ImpersonationToken < PersonalAccessToken + expose :impersonation + end + + class ImpersonationTokenWithToken < PersonalAccessTokenWithToken expose :impersonation end diff --git a/lib/api/users.rb b/lib/api/users.rb index 2a56506f3a5..b41fce76df0 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -531,7 +531,7 @@ module API desc 'Create a impersonation token. Available only for admins.' do detail 'This feature was introduced in GitLab 9.0' - success Entities::ImpersonationToken + success Entities::ImpersonationTokenWithToken end params do requires :name, type: String, desc: 'The name of the impersonation token' @@ -542,7 +542,7 @@ module API impersonation_token = finder.build(declared_params(include_missing: false)) if impersonation_token.save - present impersonation_token, with: Entities::ImpersonationToken + present impersonation_token, with: Entities::ImpersonationTokenWithToken else render_validation_error!(impersonation_token) end |