Class: CanTango::UserAcEngine
- Defined in:
- lib/cantango/user_ac_engine.rb
Instance Attribute Summary
Attributes inherited from Engine
Instance Method Summary collapse
- #engine_name ⇒ Object (also: #cache_key)
-
#initialize(ability) ⇒ UserAcEngine
constructor
A new instance of UserAcEngine.
- #permit_rules ⇒ Object
- #valid? ⇒ Boolean
Methods included from Ability::UserHelpers
#user, #user_account, #user_key_field
Methods included from Ability::RoleHelpers
Methods included from Helpers::RoleMethods
#config, #has_role_group_meth, #has_role_meth, #role_groups_list_meth, #roles_list_meth
Methods included from Ability::Executor
#cache, #clear_rules!, #execute!, #rules
Methods included from Ability::CacheHelpers
Methods included from Helpers::Debug
Methods inherited from Engine
Constructor Details
#initialize(ability) ⇒ UserAcEngine
Returns a new instance of UserAcEngine.
7 8 9 |
# File 'lib/cantango/user_ac_engine.rb', line 7 def initialize ability super end |
Instance Method Details
#engine_name ⇒ Object Also known as: cache_key
25 26 27 |
# File 'lib/cantango/user_ac_engine.rb', line 25 def engine_name :user_ac end |
#permit_rules ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/cantango/user_ac_engine.rb', line 11 def permit_rules .each do || ability.can .action.to_sym, .thing_type.constantize do |thing| thing.nil? || .thing_id.nil? || .thing_id == thing.id end end rules << ability_rules if !ability_rules.blank? end |
#valid? ⇒ Boolean
20 21 22 23 |
# File 'lib/cantango/user_ac_engine.rb', line 20 def valid? return false if !valid_mode? .empty? ? invalid : true end |