diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-25 08:37:28 -0700 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-03-25 08:37:28 -0700 |
commit | eda120dc4d8599e293afec7789847fd22ca0c1b0 (patch) | |
tree | ff008fc6295433fe6f54f62b89c18dd92b89a278 /lib/api | |
parent | d554070a62b0bc34ab2289d4a071b950df4d5485 (diff) | |
parent | f729f6044717635ca2dfbe054fa863d068de5c98 (diff) | |
download | gitlab-ce-eda120dc4d8599e293afec7789847fd22ca0c1b0.tar.gz |
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/helpers.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index a6e77002a01..be133a2920b 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -20,7 +20,7 @@ module API identifier = sudo_identifier() # If the sudo is the current user do nothing - if (identifier && !(@current_user.id == identifier || @current_user.username == identifier)) + 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? @current_user = User.by_username_or_id(identifier) not_found!("No user id or username for: #{identifier}") if @current_user.nil? @@ -33,7 +33,7 @@ module API identifier ||= params[SUDO_PARAM] ||= env[SUDO_HEADER] # Regex for integers - if (!!(identifier =~ /^[0-9]+$/)) + if !!(identifier =~ /^[0-9]+$/) identifier.to_i else identifier |