Skip to content

Commit

Permalink
added the _pundit_authorization_performed variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Samy-Amar committed May 25, 2016
1 parent d044660 commit 4017395
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/rails_admin/extensions/pundit/authorization_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def policy(record)
# instance if it is available.
def authorize(action, abstract_model = nil, model_object = nil)
@controller.instance_variable_set(:@_policy_authorized, true)
@controller.instance_variable_set(:@_pundit_policy_authorized, true)
record = model_object || abstract_model && abstract_model.model
unless policy(record).rails_admin?(action)
raise ::Pundit::NotAuthorizedError, "not allowed to #{action} this #{record}"
Expand Down

0 comments on commit 4017395

Please sign in to comment.