Skip to content

Commit

Permalink
Merge pull request #351 from athal7/returns-in-order-management-permi…
Browse files Browse the repository at this point in the history
…ssions

Flesh out the returns permissions for order display/management
  • Loading branch information
Andrew Thal committed Sep 3, 2015
2 parents 34ddf88 + a1d2851 commit 81cbc5c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/app/models/spree/permission_sets/order_display.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions core/app/models/spree/permission_sets/order_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions core/spec/models/spree/permission_sets/order_display_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 81cbc5c

Please sign in to comment.