Sha256: da8497c655a604b207bad3d6dd536929565459053bda0165a96f676dcae80796
Contents?: true
Size: 812 Bytes
Versions: 3
Compression:
Stored size: 812 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 class << self def privilege :management end def category :restricted_stock end end 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
3 entries across 3 versions & 1 rubygems