Bug 29508: Make GET /patrons/:patron_id use Koha::Patrons->search_limited

This patch makes the route return 404 if the user is not allowed to see
the requested patron information.

To test:
1. Apply the regression tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> FAIL: The code doesn't respect limits
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
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>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Tomas Cohen Arazi 2021-11-17 16:36:11 -03:00 committed by Kyle Hall
parent dd3ffbdd7c
commit 5ee42b6b60
1 changed files with 1 additions and 1 deletions

View File

@ -74,7 +74,7 @@ sub get {
return try {
my $patron_id = $c->validation->param('patron_id');
my $patron = $c->objects->find( Koha::Patrons->new, $patron_id );
my $patron = $c->objects->find( scalar Koha::Patrons->search_limited, $patron_id );
unless ($patron) {
return $c->render(