diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-10-30 18:49:46 +0100 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-11-02 11:39:03 +0100 |
commit | b7c8f7d76d0b2b33486c962d13efb7f496d44ec2 (patch) | |
tree | e81d96c82b7a325250b4f3b5d1e566dbef4aac5c /lib/api/helpers.rb | |
parent | a6c462b28c920704661463b562dabbf9b8cb1b17 (diff) | |
download | gitlab-ce-b7c8f7d76d0b2b33486c962d13efb7f496d44ec2.tar.gz |
Update specs for sudo behavior
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index b1b855fdd9c..1c12166e434 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -396,7 +396,7 @@ module API def sudo! return unless sudo_identifier - raise UnauthorizedError unless initial_current_user + unauthorized! unless initial_current_user unless initial_current_user.admin? forbidden!('Must be admin to use sudo') @@ -409,10 +409,7 @@ module API validate_access_token!(scopes: [:sudo]) sudoed_user = find_user(sudo_identifier) - - unless sudoed_user - not_found!("No user id or username for: #{sudo_identifier}") - end + not_found!("User with ID or username '#{sudo_identifier}'") unless sudoed_user @current_user = sudoed_user end |