Bug 28907: REST - Remove allow-owner from public checkout availability route

To test:
1. prove t/db_dependent/api/v1/checkouts.t
2. Apply patch
3. prove t/db_dependent/api/v1/checkouts.t

Observe success in both cases.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
This commit is contained in:
Lari Taskula 2024-09-18 11:13:23 +00:00 committed by Alex Buckley
parent e2bc259dda
commit e6cd5ae59f
2 changed files with 10 additions and 3 deletions

View File

@ -153,7 +153,16 @@ sub get_availability {
my $c = shift->openapi->valid_input or return;
my $user = $c->stash('koha.user');
my $patron = Koha::Patrons->find( $c->param('patron_id') );
my $patron_id = $c->param('patron_id');
return if try {
$c->auth->public($patron_id) if $c->stash('is_public');
return 0; # authorization successful, do not "return" after try-catch
} catch {
return $c->unhandled_exception($_);
};
my $patron = Koha::Patrons->find($patron_id);
my $item = Koha::Items->find( $c->param('item_id') );
my ( $impossible, $confirmation, $warnings ) =

View File

@ -447,5 +447,3 @@
description: Under maintenance
schema:
$ref: "../swagger.yaml#/definitions/error"
x-koha-authorization:
allow-owner: true