Sha256: c9dc781520a060d1591edcf2e0397cfc38fa033fd631d5d2d1ae184b797d9408

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

module Spree
  module PermissionSets
    class DefaultCustomer < PermissionSets::Base
      def activate!
        can :display, Country
        can :display, OptionType
        can :display, OptionValue
        can :create, Order
        can [:read, :update], Order do |order, token|
          order.user == user || (order.guest_token.present? && token == order.guest_token)
        end
        can :create, ReturnAuthorization do |return_authorization|
          return_authorization.order.user == user
        end
        can [:display, :update], CreditCard, user_id: user.id
        can :display, Product
        can :display, ProductProperty
        can :display, Property
        can :create, Spree.user_class
        can [:read, :update, :update_email], Spree.user_class, id: user.id
        can :display, State
        can :display, StockItem, stock_location: { active: true }
        can :display, StockLocation, active: true
        can :display, Taxon
        can :display, Taxonomy
        can [:save_in_address_book, :remove_from_address_book], Spree.user_class, id: user.id
        can [:display, :view_out_of_stock], Variant
        can :display, Zone
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
solidus_core-2.6.6 lib/spree/permission_sets/default_customer.rb
solidus_core-2.6.5 lib/spree/permission_sets/default_customer.rb
solidus_core-2.6.4 lib/spree/permission_sets/default_customer.rb
solidus_core-2.6.3 lib/spree/permission_sets/default_customer.rb
solidus_core-2.6.2 lib/spree/permission_sets/default_customer.rb
solidus_core-2.6.1 lib/spree/permission_sets/default_customer.rb
solidus_core-2.6.0 lib/spree/permission_sets/default_customer.rb
solidus_core-2.6.0.rc1 lib/spree/permission_sets/default_customer.rb