From 7d38b15d65aad783e68957dad43b30d42896f627 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 17 Nov 2021 13:07:12 -0300 Subject: [PATCH] Bug 29503: Make GET /patrons use Koha::Patrons->search_limited This patch makes the controller method use Koha::Patrons->search_limited so filters based on configuration and permissions apply when fetching patrons. To test: 1. Apply the regression tests patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/patrons.t => FAIL: Boo, you get more patrons than you should 3. Apply the patch 4. Repeat 2 => SUCCESS: Yay! Things are filtered as expected (i.e. using Koha::Patron->libraries_where_can_see_patrons) 5. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall --- Koha/REST/V1/Patrons.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm index 122b99a2ce..da96b39e74 100644 --- a/Koha/REST/V1/Patrons.pm +++ b/Koha/REST/V1/Patrons.pm @@ -50,7 +50,7 @@ sub list { $query->{debarred} = { '!=' => undef } if $restricted; - my $patrons_rs = Koha::Patrons->search($query); + my $patrons_rs = Koha::Patrons->search_limited($query); my $patrons = $c->objects->search( $patrons_rs ); return $c->render( -- 2.39.5