From 87757829acd5688dc48528a66d010aee0eb52eed Mon Sep 17 00:00:00 2001 From: Donald McKendrick Date: Wed, 27 Sep 2023 17:55:26 -0700 Subject: [PATCH] Update fetches_things.rb to use custom policy if available --- lib/avo/concerns/fetches_things.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/avo/concerns/fetches_things.rb b/lib/avo/concerns/fetches_things.rb index 3afa77fb2f..b3f26feba9 100644 --- a/lib/avo/concerns/fetches_things.rb +++ b/lib/avo/concerns/fetches_things.rb @@ -89,7 +89,7 @@ def get_model_class_by_name(name) def get_available_resources(user = nil) valid_resources .select do |resource| - Services::AuthorizationService.authorize user, resource.model_class, Avo.configuration.authorization_methods.stringify_keys["index"], raise_exception: false + Services::AuthorizationService.authorize user, resource.model_class, Avo.configuration.authorization_methods.stringify_keys["index"], policy_class: resource.authorization_policy ,raise_exception: false end .sort_by { |r| r.name } end