Method: Spree::RoleConfiguration#activate_permissions!
- Defined in:
- lib/spree/core/role_configuration.rb
#activate_permissions!(ability, user) ⇒ Object
Given a CanCan::Ability, and a user, determine what permissions sets can be activated on the ability, then activate them.
This performs can/cannot declarations on the ability, and can modify its internal permissions.
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/spree/core/role_configuration.rb', line 38 def ability, user spree_roles = ['default'] | user.spree_roles.map(&:name) = Set.new spree_roles.each do |role_name| |= roles[role_name]. end .each do || .new(ability).activate! end end |