summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
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