Class: RailsIam::Config::Authorization
- Inherits:
-
Object
- Object
- RailsIam::Config::Authorization
- Defined in:
- lib/rails_iam/config/authorization.rb
Instance Attribute Summary collapse
-
#authorization_rule_error ⇒ Object
Returns the value of attribute authorization_rule_error.
-
#cache_store ⇒ Object
Returns the value of attribute cache_store.
-
#cache_ttl ⇒ Object
Returns the value of attribute cache_ttl.
-
#excluded_controller_patterns ⇒ Object
Returns the value of attribute excluded_controller_patterns.
-
#missing_permission_error ⇒ Object
Returns the value of attribute missing_permission_error.
-
#missing_role_error ⇒ Object
Returns the value of attribute missing_role_error.
Instance Method Summary collapse
-
#initialize ⇒ Authorization
constructor
A new instance of Authorization.
Constructor Details
#initialize ⇒ Authorization
Returns a new instance of Authorization.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rails_iam/config/authorization.rb', line 13 def initialize # Accepts plain Strings, dynamic blocks, or Lambdas with positional keywords. @missing_role_error = lambda do |required:, actual:| "Missing roles: #{required.join(', ')}. You only have: #{actual.join(', ')}" end @missing_permission_error = lambda do |required:| "Missing permission(s): #{required.join(', ')}" end @authorization_rule_error = "No authorization rule applied for" # The store engine to cache resolved roles and permissions queries for low DB footprints. @cache_store = Rails.cache @cache_ttl = 15.minutes # Useful for third-party gems and mounted engines (e.g. Devise) # whose controllers inherit from ApplicationController but # should bypass RailsIam authorization. @excluded_controller_patterns = [] end |
Instance Attribute Details
#authorization_rule_error ⇒ Object
Returns the value of attribute authorization_rule_error.
6 7 8 |
# File 'lib/rails_iam/config/authorization.rb', line 6 def @authorization_rule_error end |
#cache_store ⇒ Object
Returns the value of attribute cache_store.
6 7 8 |
# File 'lib/rails_iam/config/authorization.rb', line 6 def cache_store @cache_store end |
#cache_ttl ⇒ Object
Returns the value of attribute cache_ttl.
6 7 8 |
# File 'lib/rails_iam/config/authorization.rb', line 6 def cache_ttl @cache_ttl end |
#excluded_controller_patterns ⇒ Object
Returns the value of attribute excluded_controller_patterns.
6 7 8 |
# File 'lib/rails_iam/config/authorization.rb', line 6 def excluded_controller_patterns @excluded_controller_patterns end |
#missing_permission_error ⇒ Object
Returns the value of attribute missing_permission_error.
6 7 8 |
# File 'lib/rails_iam/config/authorization.rb', line 6 def @missing_permission_error end |
#missing_role_error ⇒ Object
Returns the value of attribute missing_role_error.
6 7 8 |
# File 'lib/rails_iam/config/authorization.rb', line 6 def missing_role_error @missing_role_error end |