Class: Spree::PermissionSets::UserManagement
- Defined in:
- lib/spree/permission_sets/user_management.rb
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Spree::PermissionSets::Base
Instance Method Details
#activate! ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/spree/permission_sets/user_management.rb', line 4 def activate! can [:admin, :display, :create, :update, :save_in_address_book, :remove_from_address_book, :addresses, :orders, :items], Spree.user_class # due to how cancancan filters by associations, # we have to define this twice, once for `accessible_by` can :update_email, Spree.user_class, spree_roles: { id: nil } # and once for `can?` can :update_email, Spree.user_class do |user| user.spree_roles.none? end cannot [:delete, :destroy], Spree.user_class can :manage, Spree::StoreCredit can :display, Spree::Role end |