Class: AccessAllow::Configuration
- Inherits:
-
Object
- Object
- AccessAllow::Configuration
- Defined in:
- lib/access_allow.rb
Instance Attribute Summary collapse
-
#current_user_method ⇒ Object
Returns the value of attribute current_user_method.
-
#logger ⇒ Object
Falls back to Rails.logger at call time (not memoised) so a logger swapped in tests or after boot is always respected.
-
#permission_check_log_level ⇒ Object
Returns the value of attribute permission_check_log_level.
-
#permissions_association_name ⇒ Object
Returns the value of attribute permissions_association_name.
-
#role_method_name ⇒ Object
Returns the value of attribute role_method_name.
-
#roles_and_permissions ⇒ Object
Returns the value of attribute roles_and_permissions.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/access_allow.rb', line 31 def initialize @roles_and_permissions = {} @current_user_method = :current_user @permissions_association_name = :permissions @role_method_name = :role @logger = nil # Level used for the per-check "user cannot do X" lines. These fire on # every failed ability check and are normal control flow (menu # visibility, scoping), not violations — so they default to :debug. # Set to nil to silence them entirely. Actual access violations are # logged separately by ControllerAccessDsl at :info/:error. @permission_check_log_level = :debug end |
Instance Attribute Details
#current_user_method ⇒ Object
Returns the value of attribute current_user_method.
28 29 30 |
# File 'lib/access_allow.rb', line 28 def current_user_method @current_user_method end |
#logger ⇒ Object
Falls back to Rails.logger at call time (not memoised) so a logger swapped in tests or after boot is always respected.
47 48 49 |
# File 'lib/access_allow.rb', line 47 def logger @logger || (defined?(Rails) ? Rails.logger : nil) end |
#permission_check_log_level ⇒ Object
Returns the value of attribute permission_check_log_level.
28 29 30 |
# File 'lib/access_allow.rb', line 28 def @permission_check_log_level end |
#permissions_association_name ⇒ Object
Returns the value of attribute permissions_association_name.
28 29 30 |
# File 'lib/access_allow.rb', line 28 def @permissions_association_name end |
#role_method_name ⇒ Object
Returns the value of attribute role_method_name.
28 29 30 |
# File 'lib/access_allow.rb', line 28 def role_method_name @role_method_name end |
#roles_and_permissions ⇒ Object
Returns the value of attribute roles_and_permissions.
28 29 30 |
# File 'lib/access_allow.rb', line 28 def @roles_and_permissions end |