Sha256: 740311ff2c2064adb36a02989c48ce8d9e0a614616ccd8ffee3197e891f5fa6d

Contents?: true

Size: 688 Bytes

Versions: 17

Compression:

Stored size: 688 Bytes

Contents

module Spree::Admin::OrdersControllerDecorator

  def self.prepended(base)
    base.before_action :check_authorization
  end

  private

  def load_order_action
    [:edit, :update, :cancel, :resume, :approve, :resend, :open_adjustments, :close_adjustments, :cart]
  end

  def check_authorization
    action = params[:action].to_sym
    if load_order_action.include?(action)
      load_order
      session[:access_token] ||= params[:token]
      resource = @order || Spree::Order.new
      authorize! action, resource, session[:access_token]
    else
      authorize! :index, Spree::Order
    end
  end
end
Spree::Admin::OrdersController.prepend(Spree::Admin::OrdersControllerDecorator)

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
spree_auth_devise-4.4.2 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.0.1 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.1.1 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.2.1 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.4.1 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.4.0 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.3.4 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.3.3 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.3.2 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.3.1 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.3.0 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.2.0 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.1.0 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.1.0.rc1 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.0.0 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.0.0.rc2 lib/controllers/backend/spree/admin/orders_controller_decorator.rb
spree_auth_devise-4.0.0.rc1 lib/controllers/backend/spree/admin/orders_controller_decorator.rb