Class: Spree::PermissionSets::DefaultCustomer
- Defined in:
- lib/spree/permission_sets/default_customer.rb
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Spree::PermissionSets::Base
Instance Method Details
#activate! ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/spree/permission_sets/default_customer.rb', line 6 def activate! can :read, Country can :read, OptionType can :read, OptionValue can :create, Order do |order, token| # same user, or both nil order.user == user || # guest checkout order order.email.present? || # via API, just like with show and update (order.guest_token.present? && token == order.guest_token) end can [:show, :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 || .order.user == user end can [:read, :update], CreditCard, user_id: user.id can :read, Product can :read, ProductProperty can :read, Property can :create, Spree.user_class can [:show, :update, :update_email], Spree.user_class, id: user.id can :read, State can :read, StockItem, stock_location: { active: true } can :read, StockLocation, active: true can :read, Taxon can :read, Taxonomy can [:save_in_address_book, :remove_from_address_book], Spree.user_class, id: user.id can [:read, :view_out_of_stock], Variant can :read, Zone end |