Class: Spree::PermissionSets::RestrictedStockDisplay

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

Overview

Read permissions for stock limited to allowed locations.

This permission set allows users to view information about stock items and locations, both of them limited to locations they have access to. Permissions are also granted for the admin panel for items.

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_display.rb', line 16

def category
  :restricted_stock
end

.privilegeObject



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

def privilege
  :display
end

Instance Method Details

#activate!Object



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

def activate!
  can [:read, :admin], Spree::StockItem, stock_location_id: location_ids
  can :read, Spree::StockLocation, id: location_ids
end