Module: ActionPolicy::Railtie::Config
- Defined in:
- lib/action_policy/railtie.rb
Overview
Provides Rails-specific configuration, accessible through ‘Rails.application.config.action_policy`
Class Attribute Summary collapse
-
.auto_inject_into_channel ⇒ Object
Define whether we need to include ActionCable::Channel::Base with the default authorization logic.
-
.auto_inject_into_controller ⇒ Object
Define whether we need to extend ApplicationController::Base with the default authorization logic.
-
.channel_authorize_current_user ⇒ Object
Define whether we want to specify ‘current_user` as the default authorization context in channels.
-
.controller_authorize_current_user ⇒ Object
Define whether we want to specify ‘current_user` as the default authorization context in controller.
-
.namespace_cache_enabled ⇒ Object
Define whether to cache namespaced policy resolution result (e.g. in controllers).
Class Method Summary collapse
Class Attribute Details
.auto_inject_into_channel ⇒ Object
Define whether we need to include ActionCable::Channel::Base with the default authorization logic
22 23 24 |
# File 'lib/action_policy/railtie.rb', line 22 def auto_inject_into_channel @auto_inject_into_channel end |
.auto_inject_into_controller ⇒ Object
Define whether we need to extend ApplicationController::Base with the default authorization logic
14 15 16 |
# File 'lib/action_policy/railtie.rb', line 14 def auto_inject_into_controller @auto_inject_into_controller end |
.channel_authorize_current_user ⇒ Object
Define whether we want to specify ‘current_user` as the default authorization context in channels
26 27 28 |
# File 'lib/action_policy/railtie.rb', line 26 def @channel_authorize_current_user end |
.controller_authorize_current_user ⇒ Object
Define whether we want to specify ‘current_user` as the default authorization context in controller
18 19 20 |
# File 'lib/action_policy/railtie.rb', line 18 def @controller_authorize_current_user end |
.namespace_cache_enabled ⇒ Object
Define whether to cache namespaced policy resolution result (e.g. in controllers). Enabled only in production by default.
31 32 33 |
# File 'lib/action_policy/railtie.rb', line 31 def namespace_cache_enabled @namespace_cache_enabled end |
Class Method Details
.cache_store=(store, *args) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/action_policy/railtie.rb', line 33 def cache_store=(store, *args) if store.is_a?(Symbol) store = ActiveSupport::Cache.lookup_store( store, *args ) end ActionPolicy.cache_store = store end |