From a1d2851f7363414c50244c4b149e97fcadbfd48f Mon Sep 17 00:00:00 2001 From: Andrew Thal Date: Thu, 3 Sep 2015 09:28:06 -0400 Subject: [PATCH] Flesh out the returns permissions for order display/management There are a few more models required to fully enable returns management with the order-related permission sets. --- core/app/models/spree/permission_sets/order_display.rb | 4 ++++ core/app/models/spree/permission_sets/order_management.rb | 3 +++ .../spec/models/spree/permission_sets/order_display_spec.rb | 6 ++++++ .../models/spree/permission_sets/order_management_spec.rb | 6 ++++++ 4 files changed, 19 insertions(+) diff --git a/core/app/models/spree/permission_sets/order_display.rb b/core/app/models/spree/permission_sets/order_display.rb index a20d8cc9f9c..cd4cc04682f 100644 --- a/core/app/models/spree/permission_sets/order_display.rb +++ b/core/app/models/spree/permission_sets/order_display.rb @@ -9,6 +9,10 @@ def activate! can [:display, :admin], Spree::LineItem can [:display, :admin], Spree::ReturnAuthorization can [:display, :admin], Spree::CustomerReturn + can [:display, :admin], Spree::OrderCancellations + can [:display, :admin], Spree::Reimbursement + can [:display, :admin], Spree::ReturnItem + can [:display, :admin], Spree::Refund end end end diff --git a/core/app/models/spree/permission_sets/order_management.rb b/core/app/models/spree/permission_sets/order_management.rb index 2a3144fba1b..1c11457de08 100644 --- a/core/app/models/spree/permission_sets/order_management.rb +++ b/core/app/models/spree/permission_sets/order_management.rb @@ -11,6 +11,9 @@ def activate! can :manage, Spree::ReturnAuthorization can :manage, Spree::CustomerReturn can :manage, Spree::OrderCancellations + can :manage, Spree::Reimbursement + can :manage, Spree::ReturnItem + can :manage, Spree::Refund end end end diff --git a/core/spec/models/spree/permission_sets/order_display_spec.rb b/core/spec/models/spree/permission_sets/order_display_spec.rb index 947d6186d5c..83c402d38be 100644 --- a/core/spec/models/spree/permission_sets/order_display_spec.rb +++ b/core/spec/models/spree/permission_sets/order_display_spec.rb @@ -26,6 +26,9 @@ it { is_expected.to be_able_to(:admin, Spree::CustomerReturn) } it { is_expected.to be_able_to(:edit, Spree::Order) } it { is_expected.to be_able_to(:cart, Spree::Order) } + it { is_expected.to be_able_to(:display, Spree::Reimbursement) } + it { is_expected.to be_able_to(:display, Spree::ReturnItem) } + it { is_expected.to be_able_to(:display, Spree::Refund) } end context "when not activated" do @@ -44,6 +47,9 @@ it { is_expected.not_to be_able_to(:admin, Spree::ReturnAuthorization) } it { is_expected.not_to be_able_to(:admin, Spree::CustomerReturn) } it { is_expected.not_to be_able_to(:cart, Spree::Order) } + it { is_expected.not_to be_able_to(:display, Spree::Reimbursement) } + it { is_expected.not_to be_able_to(:display, Spree::ReturnItem) } + it { is_expected.not_to be_able_to(:display, Spree::Refund) } end end diff --git a/core/spec/models/spree/permission_sets/order_management_spec.rb b/core/spec/models/spree/permission_sets/order_management_spec.rb index 8b34dfecfd7..d3a12af3905 100644 --- a/core/spec/models/spree/permission_sets/order_management_spec.rb +++ b/core/spec/models/spree/permission_sets/order_management_spec.rb @@ -19,6 +19,9 @@ it { is_expected.to be_able_to(:manage, Spree::CustomerReturn) } it { is_expected.to be_able_to(:display, Spree::ReimbursementType) } it { is_expected.to be_able_to(:manage, Spree::OrderCancellations) } + it { is_expected.to be_able_to(:manage, Spree::Reimbursement) } + it { is_expected.to be_able_to(:manage, Spree::ReturnItem) } + it { is_expected.to be_able_to(:manage, Spree::Refund) } end context "when not activated" do @@ -31,6 +34,9 @@ it { is_expected.not_to be_able_to(:manage, Spree::CustomerReturn) } it { is_expected.not_to be_able_to(:display, Spree::ReimbursementType) } it { is_expected.not_to be_able_to(:manage, Spree::OrderCancellations) } + it { is_expected.not_to be_able_to(:manage, Spree::Reimbursement) } + it { is_expected.not_to be_able_to(:manage, Spree::ReturnItem) } + it { is_expected.not_to be_able_to(:manage, Spree::Refund) } end end