Class: CanTango::PermitEngine::Executor::Base
- Includes:
- Helpers::RoleMethods
- Defined in:
- lib/cantango/permit_engine/executor/base.rb
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
-
#execute! ⇒ Object
execute the permit.
- #permit_for_user_group? ⇒ Boolean
- #permit_for_user_role? ⇒ Boolean
-
#role_execution ⇒ Object
only execute the permit if the user has the role of the permit or is for any role.
- #role_group_execution ⇒ Object
Methods included from Helpers::RoleMethods
#config, #has_role_group_meth, #has_role_meth, #role_groups_list_meth, #roles_list_meth
Methods inherited from Abstract
Constructor Details
This class inherits a constructor from CanTango::PermitEngine::Executor::Abstract
Instance Method Details
#execute! ⇒ Object
execute the permit
6 7 8 9 |
# File 'lib/cantango/permit_engine/executor/base.rb', line 6 def execute! role_execution #role_group_execution end |
#permit_for_user_group? ⇒ Boolean
25 26 27 |
# File 'lib/cantango/permit_engine/executor/base.rb', line 25 def permit_for_user_group? subject_in_role_group? || false end |
#permit_for_user_role? ⇒ Boolean
16 17 18 |
# File 'lib/cantango/permit_engine/executor/base.rb', line 16 def permit_for_user_role? subject_in_role? || role == :any end |
#role_execution ⇒ Object
only execute the permit if the user has the role of the permit or is for any role
12 13 14 |
# File 'lib/cantango/permit_engine/executor/base.rb', line 12 def role_execution permit? if permit_for_user_role? || permit_for_user_group? end |
#role_group_execution ⇒ Object
20 21 22 23 |
# File 'lib/cantango/permit_engine/executor/base.rb', line 20 def role_group_execution # could also use #user.is_member_of? permit? if permit_for_user_group? end |