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: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Lari Taskula 2024-09-18 11:13:23 +00:00 committed by Paul Derscheid
parent 195136df34
commit cb283f3b8e
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
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

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