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_devise_token_auth-2.8.0.alpha.4 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core_devise_token_auth-2.8.0.alpha.3 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core_devise_token_auth-2.8.0.alpha.1 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core_devise_token_auth-2.8.0.alpha.0 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.7.0 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.6.1 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.6.0 lib/spree/permission_sets/restricted_stock_display.rb
solidus_core-2.6.0.rc1 lib/spree/permission_sets/restricted_stock_display.rb