Class: Spree::PermissionSets::RestrictedStockManagement

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

Overview

Full permissions for stock management limited to allowed locations.

This permission set grants full control over all stock items a user has access to their locations. Those locations are also readable by the corresponding ability.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Class Method Details

.categoryObject



16
17
18
# File 'lib/spree/permission_sets/restricted_stock_management.rb', line 16

def category
  :restricted_stock
end

.privilegeObject



12
13
14
# File 'lib/spree/permission_sets/restricted_stock_management.rb', line 12

def privilege
  :management
end

Instance Method Details

#activate!Object



21
22
23
24
# File 'lib/spree/permission_sets/restricted_stock_management.rb', line 21

def activate!
  can :manage, Spree::StockItem, stock_location_id: location_ids
  can :read, Spree::StockLocation, id: location_ids
end