Class: Spree::PermissionSets::UserManagement

Inherits:
Base
  • Object
show all
Defined in:
lib/spree/permission_sets/user_management.rb

Overview

Full permissions for user management.

This permission set grants full control over all user and related resources, including:

  • Users

  • Store credits

  • Roles

  • API keys

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Spree::PermissionSets::Base

Instance Method Details

#activate!Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/spree/permission_sets/user_management.rb', line 15

def activate!
  can [:admin, :read, :create, :update, :save_in_address_book, :remove_from_address_book, :addresses, :orders, :items], Spree.user_class

  # Note: This does not work with accessible_by.
  # See https://github.com/solidusio/solidus/pull/1263
  can :update_email, Spree.user_class do |user|
    user.spree_roles.none?
  end
  can :update_password, Spree.user_class do |user|
    user.spree_roles.none?
  end

  cannot :destroy, Spree.user_class
  can :manage, Spree::StoreCredit
  can :manage, :api_key
  can :read, Spree::Role
end