Sha256: 13e846e58a032e7c194145d45da67c001b10c5aceebd44f6d0844f5c8f337197

Contents?: true

Size: 380 Bytes

Versions: 9

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 = Spree::Order.find_by_number(params[:id]) || current_order

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spree_auth-1.0.7 app/controllers/spree/orders_controller_decorator.rb
spree_auth-1.0.6 app/controllers/spree/orders_controller_decorator.rb
spree_auth-1.0.5 app/controllers/spree/orders_controller_decorator.rb
spree_auth-1.1.0 app/controllers/spree/orders_controller_decorator.rb
spree_auth-1.0.4 app/controllers/spree/orders_controller_decorator.rb
spree_auth-1.1.0.rc2 app/controllers/spree/orders_controller_decorator.rb
spree_auth-1.1.0.rc1 app/controllers/spree/orders_controller_decorator.rb
spree_auth-1.0.3 app/controllers/spree/orders_controller_decorator.rb
spree_auth-1.0.2 app/controllers/spree/orders_controller_decorator.rb