Class: LcpRuby::Authorization::ScopeResolver
- Inherits:
-
Object
- Object
- LcpRuby::Authorization::ScopeResolver
- Defined in:
- lib/lcp_ruby/authorization/scope_resolver.rb
Overview
Resolves a Pundit-style scope through the model’s policy class.
The standard ‘policy_scope` override in `Controller::Authorization` hardcodes `current_presenter.model`, so it cannot be reused for arbitrary target-model lookups (e.g. `/select_options` resolving options from an association’s target, or the ancestor-chain walk in reverse cascade). This is the canonical entry point for those multi-model paths.
Class Method Summary collapse
Class Method Details
.resolve(user, scope, model_name) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/lcp_ruby/authorization/scope_resolver.rb', line 19 def self.resolve(user, scope, model_name) PolicyFactory .policy_for(model_name) .const_get(:Scope) .new(user, scope) .resolve end |