|
1 | 1 | class Manage::ApplicationController < ApplicationController |
2 | 2 | before_action :logged_in |
3 | | - before_action :require_admin_or_limited_admin |
4 | | - before_action :limit_write_access_to_admins, only: ["edit", "update", "new", "create", "destroy", "convert_to_admin", "deliver", "merge", "perform_merge", "toggle_bus_captain", "duplicate", "update_acc_status", "send_update_email", "live_preview"] |
| 3 | + before_action :require_director_or_limited_admin |
| 4 | + before_action :limit_write_access_to_directors, only: ["edit", "update", "new", "create", "destroy", "convert_to_admin", "deliver", "merge", "perform_merge", "toggle_bus_captain", "duplicate", "update_acc_status", "send_update_email", "live_preview"] |
5 | 5 | skip_before_action :verify_authenticity_token, if: :json_request? |
6 | 6 |
|
7 | 7 | def logged_in |
8 | 8 | authenticate_user! |
9 | 9 | end |
10 | 10 |
|
11 | | - def require_full_admin |
12 | | - return redirect_to root_path unless current_user.try(:admin?) |
| 11 | + def require_director |
| 12 | + return redirect_to root_path unless current_user.try(:director?) |
13 | 13 | end |
14 | 14 |
|
15 | | - def require_admin_or_limited_admin |
16 | | - return redirect_to root_path unless current_user.try(:admin?) || current_user.try(:admin_limited_access?) |
| 15 | + def require_director_or_limited_admin |
| 16 | + return redirect_to root_path unless current_user.try(:director?) || current_user.try(:admin_limited_access?) |
17 | 17 | end |
18 | 18 |
|
19 | | - def require_admin_or_limited_admin_or_event_tracking |
20 | | - redirect_to root_path unless current_user.try(:admin?) || current_user.try(:admin_limited_access?) || current_user.try(:event_tracking?) |
| 19 | + def require_director_or_limited_admin_or_event_tracking |
| 20 | + redirect_to root_path unless current_user.try(:director?) || current_user.try(:admin_limited_access?) || current_user.try(:event_tracking?) |
21 | 21 | end |
22 | 22 |
|
23 | | - def limit_write_access_to_admins |
24 | | - redirect_to url_for(controller: controller_name, action: :index) unless current_user.try(:admin?) |
| 23 | + def limit_write_access_to_directors |
| 24 | + redirect_to url_for(controller: controller_name, action: :index) unless current_user.try(:director?) |
25 | 25 | end |
26 | 26 |
|
27 | 27 | def json_request? |
|
0 commit comments