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
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-10-30 20:49:46 +0300
committerDouwe Maan <douwe@selenight.nl>2017-11-02 13:39:03 +0300
commitb7c8f7d76d0b2b33486c962d13efb7f496d44ec2 (patch)
treee81d96c82b7a325250b4f3b5d1e566dbef4aac5c /lib/api/helpers.rb
parenta6c462b28c920704661463b562dabbf9b8cb1b17 (diff)
Update specs for sudo behavior
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb7
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