Class: Wallaby::Her::PunditProvider
- Inherits:
-
PunditAuthorizationProvider
- Object
- PunditAuthorizationProvider
- Wallaby::Her::PunditProvider
- Defined in:
- lib/adapters/wallaby/her/pundit_provider.rb
Overview
Pundit provider for Her
Instance Method Summary collapse
-
#accessible_for(_action, scope) ⇒ Object
Find out the class and filter scope.
Instance Method Details
#accessible_for(_action, scope) ⇒ Object
Find out the class and filter scope.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/adapters/wallaby/her/pundit_provider.rb', line 11 def accessible_for(_action, scope) klass = if scope.is_a? ::Her::Model::Relation scope.instance_variable_get :@parent else scope end scope_policy = Pundit::PolicyFinder.new(klass).scope scope_policy ? scope_policy.new(user, scope).resolve : scope end |