From ba23e9098428f9b4be4fdd747da627a4c7168f78 Mon Sep 17 00:00:00 2001 From: Thomas Burkhalter Date: Tue, 12 Sep 2023 09:15:29 +0200 Subject: [PATCH] Revert "Remove preemptive allow filter override" This reverts commit 7dd73e1ea5567236e1b7e3cc270c8f089561908c. Because we want a lasting solution, working for all users. --- .../admin/assemblies_controller_override.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 app/overrides/assemblies/admin/assemblies_controller_override.rb diff --git a/app/overrides/assemblies/admin/assemblies_controller_override.rb b/app/overrides/assemblies/admin/assemblies_controller_override.rb new file mode 100644 index 0000000..35fdade --- /dev/null +++ b/app/overrides/assemblies/admin/assemblies_controller_override.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +Decidim::Assemblies::Admin::AssembliesController.class_eval do + def filtered_collection + valid_ids = + query + .result + .select { |a| allowed_to? :list, :assembly, assembly: a } + .map(&:id) + + assemblies = query.result.where(id: valid_ids) + + paginate(assemblies) + end +end