Skip to content

Commit 873e43c

Browse files
committed
refactor: Renames admin_limited_access to Organizer
1 parent f592750 commit 873e43c

21 files changed

+32
-39
lines changed

app/controllers/manage/application_controller.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
class Manage::ApplicationController < ApplicationController
22
before_action :logged_in
3-
before_action :require_director_or_limited_admin
3+
before_action :require_director_or_organizer_or_event_tracking
44
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"]
55
skip_before_action :verify_authenticity_token, if: :json_request?
66

@@ -12,12 +12,12 @@ def require_director
1212
return redirect_to root_path unless current_user.try(:director?)
1313
end
1414

15-
def require_director_or_limited_admin
16-
return redirect_to root_path unless current_user.try(:director?) || current_user.try(:admin_limited_access?)
15+
def require_director_or_organizer
16+
return redirect_to root_path unless current_user.try(:director?) || current_user.try(:organizer?)
1717
end
1818

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?)
19+
def require_director_or_organizer_or_event_tracking
20+
redirect_to root_path unless current_user.try(:director?) || current_user.try(:organizer?) || current_user.try(:event_tracking?)
2121
end
2222

2323
def limit_write_access_to_directors

app/controllers/manage/checkins_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class Manage::CheckinsController < Manage::ApplicationController
2+
before_action :require_director_or_organizer
23
before_action :set_questionnaire, only: [:show]
34

45
respond_to :html, :json

app/controllers/manage/dashboard_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
class Manage::DashboardController < Manage::ApplicationController
2-
before_action :require_director_or_limited_admin
32

43
def index
54
end

app/controllers/manage/data_exports_controller.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
class Manage::DataExportsController < Manage::ApplicationController
2-
skip_before_action :require_director_or_limited_admin
32
before_action :require_director
43

54
before_action :set_data_export, only: [:destroy]

app/controllers/manage/trackable_events_controller.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
class Manage::TrackableEventsController < Manage::ApplicationController
2-
skip_before_action :require_director_or_limited_admin
3-
before_action :require_director_or_limited_admin_or_event_tracking
4-
52
before_action :set_trackable_event, only: [:show, :edit, :update, :destroy]
6-
before_action :scope_limited_admin_access, only: [:edit, :update, :destroy]
3+
before_action :scope_organizer_access, only: [:edit, :update, :destroy]
74

85
respond_to :html, :json
96

@@ -86,7 +83,7 @@ def limit_write_access_to_directors
8683
end
8784

8885
# If the user isn't a director, scope changes only to those they created
89-
def scope_limited_admin_access
86+
def scope_organizer_access
9087
return if current_user.director? || @trackable_event.blank? || @trackable_event.user.blank?
9188
redirect_to manage_trackable_events_path, notice: 'You may not view events you did not create.' if @trackable_event.user != current_user
9289
end

app/controllers/manage/trackable_tags_controller.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
class Manage::TrackableTagsController < Manage::ApplicationController
2-
skip_before_action :require_director_or_limited_admin
3-
before_action :require_director_or_limited_admin_or_event_tracking
4-
52
before_action :set_trackable_tag, only: [:show, :edit, :update, :destroy]
63

74
respond_to :html, :json

app/controllers/manage/users_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Manage::UsersController < Manage::ApplicationController
55
respond_to :html, :json
66

77
def index
8-
respond_with(:manage, User.where(role: [:director, :admin_limited_access, :event_tracking]))
8+
respond_with(:manage, User.where(role: [:director, :organizer, :event_tracking]))
99
end
1010

1111
def user_datatable

app/datatables/staff_datatable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ def data
4343
end
4444

4545
def get_raw_records
46-
User.where(role: [:director, :admin_limited_access, :event_tracking])
46+
User.where(role: [:director, :organizer, :event_tracking])
4747
end
4848
end

app/models/user.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class User < ApplicationRecord
2323
after_create :queue_reminder_email
2424
after_initialize :set_default_role, if: :new_record?
2525

26-
enum role: { user: 0, event_tracking: 1, admin_limited_access: 2, director: 3 }
26+
enum role: { user: 0, event_tracking: 1, organizer: 2, director: 3 }
2727

2828
def set_default_role
2929
self.role ||= :user
@@ -76,7 +76,7 @@ def self.from_omniauth(auth)
7676
end
7777

7878
def self.non_organizer
79-
User.where.not(role: :director).where.not(role: :admin_limited_access)
79+
User.where.not(role: :director).where.not(role: :organizer)
8080
end
8181

8282
def self.without_questionnaire

config/initializers/doorkeeper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# every time somebody will try to access the admin web interface.
1919
admin_authenticator do
2020
if current_user
21-
head :forbidden unless current_user.director? || current_user.admin_limited_access?
21+
head :forbidden unless current_user.director? || current_user.organizer?
2222
else
2323
redirect_to new_user_session_url
2424
end

0 commit comments

Comments
 (0)