Initial commit
This commit is contained in:
18
app/controllers/admin/application_controller.rb
Normal file
18
app/controllers/admin/application_controller.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
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
|
||||
Reference in New Issue
Block a user