forked from fixin.me/fixin.me
Return to per-action permission filters
This commit is contained in:
parent
13685aa476
commit
b38d72e9b0
@ -3,13 +3,11 @@ class UsersController < ApplicationController
|
|||||||
|
|
||||||
before_action :find_user, only: [:show, :update, :disguise]
|
before_action :find_user, only: [:show, :update, :disguise]
|
||||||
|
|
||||||
before_action do
|
before_action only: :revert do
|
||||||
case action_name.to_sym
|
raise AccessForbidden unless current_user_disguised?
|
||||||
when :revert
|
end
|
||||||
raise AccessForbidden unless current_user_disguised?
|
before_action except: :revert do
|
||||||
else
|
raise AccessForbidden unless current_user.at_least(:admin)
|
||||||
raise AccessForbidden unless current_user.at_least(:admin)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@ -34,7 +34,7 @@ en:
|
|||||||
You have not been granted access to this action (403 Forbidden).
|
You have not been granted access to this action (403 Forbidden).
|
||||||
This should not happen, please notify site administrator.
|
This should not happen, please notify site administrator.
|
||||||
not_found: >
|
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.
|
This should not happen, please notify site administrator.
|
||||||
unprocessable_entity: >
|
unprocessable_entity: >
|
||||||
The request is semantically incorrect and was rejected (422 Unprocessable Entity).
|
The request is semantically incorrect and was rejected (422 Unprocessable Entity).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user