diff options
author | Nihad Abbasov <narkoz.2008@gmail.com> | 2013-10-16 22:31:46 +0500 |
---|---|---|
committer | Nihad Abbasov <narkoz.2008@gmail.com> | 2013-10-16 22:31:46 +0500 |
commit | 12420a2256168a122b3a1f5a2c974df52fe802ec (patch) | |
tree | e78b9da0d3729f1f79f1d377959eed508c29973f /lib/api | |
parent | e09cc195a7400187e7b59f7ff24273962d9912d7 (diff) | |
download | gitlab-ce-12420a2256168a122b3a1f5a2c974df52fe802ec.tar.gz |
refactor by_username_or_id
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/helpers.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 2cac04d3495..1db1f396389 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -11,11 +11,7 @@ module API # If the sudo is the current user do nothing if (identifier && !(@current_user.id == identifier || @current_user.username == identifier)) render_api_error!('403 Forbidden: Must be admin to use sudo', 403) unless @current_user.is_admin? - begin - @current_user = User.by_username_or_id(identifier) - rescue => ex - not_found!("No user id or username for: #{identifier}") - end + @current_user = User.by_username_or_id(identifier) not_found!("No user id or username for: #{identifier}") if @current_user.nil? end @current_user |