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 <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Tomás Cohen Arazi 2021-11-17 13:07:12 -03:00 committed by Fridolin Somers
parent 2b432cec1d
commit 152bc1f04e

View file

@ -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(