Files
old-holivud2/app/controllers/admin/application_controller.rb

19 lines
542 B
Ruby
Raw Normal View History

2020-05-31 22:38:19 +02:00
class Admin::ApplicationController < ActionController::Base
include Oath::ControllerHelpers # Methods for authentication
include Pundit # Methods for authorization
before_action :require_login
include SetCurrentRequestDetails
before_action :require_admin_login
after_action :verify_authorized, except: :index
after_action :verify_policy_scoped, only: :index
private
def require_admin_login
if !Current.user.admin?
redirect_to signed_in_root_url, alert: "You are not authorized to access this"
end
end
end