Sha256: d0512ff186af1dde6001f430ec98dea05b2d592d4cd4d004fd634d2d540c3bf8

Contents?: true

Size: 413 Bytes

Versions: 48

Compression:

Stored size: 413 Bytes

Contents

# frozen_string_literal: true

module Spree
  module PermissionSets
    class RestrictedStockDisplay < PermissionSets::Base
      def activate!
        can [:display, :admin], Spree::StockItem, stock_location_id: location_ids
        can :display, Spree::StockLocation, id: location_ids
      end

      private

      def location_ids
        @ids ||= user.stock_locations.pluck(:id)
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 2 rubygems

Version Path
solidus_core-2.10.5 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.10.3 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.10.2 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.9.6 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.8.6 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.10.1 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.9.5 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.10.0 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.9.4 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.6.6 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.7.4 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.8.5 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.9.3 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.9.2 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.10.0.beta1 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.7.3 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.6.5 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.9.1 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.9.0 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.9.0.rc.1 lib/spree/permission_sets/restricted_stock_display.rb