From 152bc1f04eb075ea2f3f276e5371263704586a81 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 --- 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 f1759b2f39..6fb1ccc4a5 100644 --- a/Koha/REST/V1/Patrons.pm +++ b/Koha/REST/V1/Patrons.pm @@ -51,7 +51,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