diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0472ccf..4bf7ac4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -3,13 +3,11 @@ class UsersController < ApplicationController before_action :find_user, only: [:show, :update, :disguise] - before_action do - case action_name.to_sym - when :revert - raise AccessForbidden unless current_user_disguised? - else - raise AccessForbidden unless current_user.at_least(:admin) - end + before_action only: :revert do + raise AccessForbidden unless current_user_disguised? + end + before_action except: :revert do + raise AccessForbidden unless current_user.at_least(:admin) end def index diff --git a/config/locales/en.yml b/config/locales/en.yml index 31dd9a9..1ba2a21 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -34,7 +34,7 @@ en: You have not been granted access to this action (403 Forbidden). This should not happen, please notify site administrator. not_found: > - The record that you requested operation on does not exist (404). + The record that you requested operation on does not exist (404 Not Found). This should not happen, please notify site administrator. unprocessable_entity: > The request is semantically incorrect and was rejected (422 Unprocessable Entity).