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.
-
.instrumentation_enabled ⇒ Object
Define whether to include instrumentation functionality.
-
.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 |
.instrumentation_enabled ⇒ Object
Define whether to include instrumentation functionality. Enabled by default.
35 36 37 |
# File 'lib/action_policy/railtie.rb', line 35 def instrumentation_enabled @instrumentation_enabled 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) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/action_policy/railtie.rb', line 37 def cache_store=(store) # Handle both: # store = :memory # store = :mem_cache, ENV['MEMCACHE'] if store.is_a?(Symbol) || store.is_a?(Array) store = ActiveSupport::Cache.lookup_store(store) end ActionPolicy.cache_store = store end |