Sha256: 042e4e8bccfffe922aff372b6975349ce815a4e65a129a6e5447f04f9d81e254

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 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, Order.where(user: user) do |order, token|
          order.user == user || (order.guest_token.present? && token == order.guest_token)
        end
        cannot :update, Order do |order|
          order.completed?
        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

6 entries across 6 versions & 1 rubygems

Version Path
solidus_core-2.10.5 lib/spree/permission_sets/default_customer.rb
solidus_core-2.10.3 lib/spree/permission_sets/default_customer.rb
solidus_core-2.10.2 lib/spree/permission_sets/default_customer.rb
solidus_core-2.10.1 lib/spree/permission_sets/default_customer.rb
solidus_core-2.10.0 lib/spree/permission_sets/default_customer.rb
solidus_core-2.10.0.beta1 lib/spree/permission_sets/default_customer.rb