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
