Sha256: 8bd489e472f52e6aa8797ed7ebaae28938d73507e1ec6d0b9298794086801a7d

Contents?: true

Size: 380 Bytes

Versions: 6

Compression:

Stored size: 380 Bytes

Contents

Spree::OrdersController.class_eval do
  before_filter :check_authorization

  private
    def check_authorization
      session[:access_token] ||= params[:token]
      order = current_order || Spree::Order.find_by_number(params[:id])

      if order
        authorize! :edit, order, session[:access_token]
      else
        authorize! :create, Spree::Order
      end
    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree_auth-1.0.1 app/controllers/spree/orders_controller_decorator.rb
spree_auth-1.0.0 app/controllers/spree/orders_controller_decorator.rb
spree_auth-1.0.0.rc4 app/controllers/spree/orders_controller_decorator.rb
spree_auth-1.0.0.rc3 app/controllers/spree/orders_controller_decorator.rb
spree_auth-1.0.0.rc2 app/controllers/spree/orders_controller_decorator.rb
spree_auth-1.0.0.rc1 app/controllers/spree/orders_controller_decorator.rb