Permit edits to exchanges involving enterprises permitted via E2E relationships

This commit is contained in:
Rohan Mitchell
2014-08-26 15:25:17 +10:00
parent 628d87b69a
commit a5debc19dc
4 changed files with 36 additions and 6 deletions

View File

@@ -3,8 +3,12 @@ module OrderCyclesHelper
@current_order_cycle ||= current_order(false).andand.order_cycle
end
def order_cycle_permitted_enterprises
OpenFoodNetwork::Permissions.new(spree_current_user).order_cycle_enterprises
end
def order_cycle_producer_enterprises
OpenFoodNetwork::Permissions.new(spree_current_user).order_cycle_enterprises.is_primary_producer.by_name
order_cycle_permitted_enterprises.is_primary_producer.by_name
end
def coordinating_enterprises
@@ -12,7 +16,7 @@ module OrderCyclesHelper
end
def order_cycle_hub_enterprises
OpenFoodNetwork::Permissions.new(spree_current_user).order_cycle_enterprises.is_distributor.by_name
order_cycle_permitted_enterprises.is_distributor.by_name
end
def order_cycle_local_remote_class(distributor, order_cycle)