mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-11 23:17:48 +00:00
Auto-merge from CI [skip ci]
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
Spree::Admin::LineItemsController.class_eval do
|
||||
private
|
||||
|
||||
def load_order
|
||||
@order = Spree::Order.find_by_number!(params[:order_id])
|
||||
authorize! :update, @order
|
||||
end
|
||||
end
|
||||
@@ -144,11 +144,27 @@ class AbilityDecorator
|
||||
end
|
||||
can [:admin, :bulk_management], Spree::Order if user.admin? || user.enterprises.any?(&:is_distributor)
|
||||
can [:admin, :create], Spree::LineItem
|
||||
can [:destroy], Spree::LineItem do |item|
|
||||
user.admin? || user.enterprises.include?(order.distributor) || user == order.order_cycle.manager
|
||||
end
|
||||
|
||||
can [:admin, :index, :read, :create, :edit, :update, :fire], Spree::Payment
|
||||
can [:admin, :index, :read, :create, :edit, :update, :fire], Spree::Shipment
|
||||
can [:admin, :index, :read, :create, :edit, :update, :fire], Spree::Adjustment
|
||||
can [:admin, :index, :read, :create, :edit, :update, :fire], Spree::ReturnAuthorization
|
||||
can [:destroy], Spree::Adjustment do |adjustment|
|
||||
# Sharing code with destroying a line item. This should be unified and probably applied for other actions as well.
|
||||
binding.pry
|
||||
if user.admin?
|
||||
true
|
||||
elsif adjustment.adjustable.instance_of? Spree::Order
|
||||
order = adjustment.adjustable
|
||||
user.enterprises.include?(order.distributor) || user == order.order_cycle.manager
|
||||
elsif adjustment.adjustable.instance_of? Spree::LineItem
|
||||
order = adjustment.adjustable.order
|
||||
user.enterprises.include?(order.distributor) || user == order.order_cycle.manager
|
||||
end
|
||||
end
|
||||
|
||||
can [:create], OrderCycle
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
/ replace "code[erb-loud]:contains('button t(:update)')"
|
||||
|
||||
= button t(:update_and_recalculate_fees), 'icon-refresh'
|
||||
@@ -10,15 +10,15 @@ feature "Authentication", js: true do
|
||||
|
||||
scenario "logging into admin redirects home, then back to admin" do
|
||||
# This is the first admin spec, so give a little extra load time for slow systems
|
||||
Capybara.using_wait_time(60) do
|
||||
Capybara.using_wait_time(120) do
|
||||
visit spree.admin_path
|
||||
end
|
||||
|
||||
fill_in "Email", with: user.email
|
||||
fill_in "Password", with: user.password
|
||||
click_login_button
|
||||
page.should have_content "DASHBOARD"
|
||||
current_path.should == spree.admin_path
|
||||
fill_in "Email", with: user.email
|
||||
fill_in "Password", with: user.password
|
||||
click_login_button
|
||||
page.should have_content "DASHBOARD"
|
||||
current_path.should == spree.admin_path
|
||||
end
|
||||
end
|
||||
|
||||
scenario "viewing my account" do
|
||||
|
||||
Reference in New Issue
Block a user