Pundit authorization sitewide
This commit is contained in:
parent
5930a20efc
commit
dcbeb8a72c
@ -1,4 +1,5 @@
|
|||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
|
include Pundit::Authorization
|
||||||
# Prevent CSRF attacks by raising an exception.
|
# Prevent CSRF attacks by raising an exception.
|
||||||
# For APIs, you may want to use :null_session instead.
|
# For APIs, you may want to use :null_session instead.
|
||||||
# protect_from_forgery with: :exception
|
# protect_from_forgery with: :exception
|
||||||
@ -9,7 +10,6 @@ class ApplicationController < ActionController::Base
|
|||||||
before_action :get_global_doodads
|
before_action :get_global_doodads
|
||||||
|
|
||||||
if (Rails.env.development? || Rails.env.test?)
|
if (Rails.env.development? || Rails.env.test?)
|
||||||
include Pundit::Authorization
|
|
||||||
after_action :verify_authorized, unless: -> { devise_controller? }
|
after_action :verify_authorized, unless: -> { devise_controller? }
|
||||||
# after_action :verify_policy_scoped, only: :index
|
# after_action :verify_policy_scoped, only: :index
|
||||||
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
|
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user