diff options
Diffstat (limited to 'app/controllers/concerns/role_required.rb')
| -rw-r--r-- | app/controllers/concerns/role_required.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/controllers/concerns/role_required.rb b/app/controllers/concerns/role_required.rb index b841b8cc..22ce625e 100644 --- a/app/controllers/concerns/role_required.rb +++ b/app/controllers/concerns/role_required.rb | |||
| @@ -20,4 +20,13 @@ module RoleRequired | |||
| 20 | flash[:error] = t("flash.common.#{key}") | 20 | flash[:error] = t("flash.common.#{key}") |
| 21 | redirect_to admin_path | 21 | redirect_to admin_path |
| 22 | end | 22 | end |
| 23 | |||
| 24 | # require_admin must precede this in the filter chain, so a non-admin is | ||
| 25 | # denied by role before elevation is ever considered. | ||
| 26 | def require_elevation | ||
| 27 | return if elevated? | ||
| 28 | |||
| 29 | session[:elevation_return_to] = request.fullpath | ||
| 30 | redirect_to new_elevation_path | ||
| 31 | end | ||
| 23 | end | 32 | end |
