Sha256: 80fee0c83b1ed9c3cacf856b5412490be6e51cad09602b793586b11523dda63f
Contents?: true
Size: 663 Bytes
Versions: 19
Compression:
Stored size: 663 Bytes
Contents
# frozen_string_literal: true module Spree module PermissionSets # 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 RestrictedStockManagement < PermissionSets::Base def activate! can :manage, Spree::StockItem, stock_location_id: location_ids can :read, Spree::StockLocation, id: location_ids end private def location_ids @ids ||= user.stock_locations.pluck(:id) end end end end
Version data entries
19 entries across 19 versions & 1 rubygems