From eec2fbf8a1c9da8691c032223f8033bb24df44ea 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 --- 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 80b64ee963..be00526b05 100644 --- a/Koha/REST/V1/Patrons.pm +++ b/Koha/REST/V1/Patrons.pm @@ -49,7 +49,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.20.1