osem-fcy/app/controllers/admin/base_controller.rb

18 lines
633 B
Ruby
Raw Normal View History

module Admin
class BaseController < ApplicationController
before_filter :verify_user_admin
def verify_user_admin
if (current_user.nil?)
redirect_to sign_in_path
return false
end
unless (current_user.has_role? :organizer, :any) || (current_user.has_role? :cfp, :any) ||
2017-06-13 04:39:47 +05:30
(current_user.has_role? :info_desk, :any) || (current_user.has_role? :organization_admin, :any) ||
(current_user.has_role? :volunteers_coordinator, :any) || current_user.is_admin
raise CanCan::AccessDenied.new('You are not authorized to access this page.')
end
end
end
end