Sha256: 6769e8dd77dfa156e46677ffc0292c673f162b0d0e87853a34b6c1c06f03cac5
Contents?: true
Size: 695 Bytes
Versions: 19
Compression:
Stored size: 695 Bytes
Contents
# frozen_string_literal: true module Spree module PermissionSets # 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 RestrictedStockDisplay < PermissionSets::Base def activate! can [:read, :admin], 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