From 02edd829b9cb5fa31af9a8baf17fd2ad57fd93c6 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 25 Aug 2023 09:03:12 +1000 Subject: [PATCH] Allow to admin vouchers if you know the URL The generic FeatureToggleConstraint in routing knows about the current user but not about the enterprise to edit. We could create a new custom constraint for routing but it's much easier to handle permissions in the controller. Let's keep routes simple. --- config/routes/admin.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/config/routes/admin.rb b/config/routes/admin.rb index 95da893872..3d22d65201 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -41,9 +41,7 @@ Openfoodnetwork::Application.routes.draw do resources :tag_rules, only: [:destroy] - constraints FeatureToggleConstraint.new(:vouchers) do - resources :vouchers, only: [:new, :create] - end + resources :vouchers, only: [:new, :create] end resources :enterprise_relationships