do not allow access to admin area if user does not have a relevant role
This commit is contained in:
parent
80d48ed7d8
commit
9d0c9b5b25
1 changed files with 6 additions and 2 deletions
|
|
@ -35,8 +35,12 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def verify_user_admin
|
||||
if self.class.to_s.split('::').first == 'Admin'
|
||||
verify_user
|
||||
if self.class.to_s.split('::').first == 'Admin' && verify_user
|
||||
unless (current_user.has_role? :organizer, :any) || (current_user.has_role? :cfp, :any) ||
|
||||
(current_user.has_role? :info_desk, :any) ||
|
||||
(current_user.has_role? :volunteers_coordinator, :any)
|
||||
raise CanCan::AccessDenied.new('You are not authorized to access this area!')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue