do not allow access to admin area if user does not have a relevant role

This commit is contained in:
Stella Rouzi 2014-07-22 17:00:41 +03:00
parent 80d48ed7d8
commit 9d0c9b5b25

View file

@ -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