Bug 33440: Added permission requirements to unauthorized_transfer

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0edf689870)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Laura_Escamilla 2025-04-22 15:57:22 +00:00 committed by Paul Derscheid
parent 4efb86aec8
commit acae50f177
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 13 additions and 0 deletions

View File

@ -439,6 +439,19 @@ sub cannot_be_transferred {
if ( !Koha::Patrons->find($to) ) {
return 'new_owner_not_found';
}
my $to_patron = Koha::Patrons->find($to);
if ( $self->public ) {
return 'unauthorized_transfer'
unless C4::Auth::haspermission(
$to_patron->userid,
{
lists => [
'create_public_lists', 'delete_public_lists', 'edit_public_list_contents', 'edit_public_lists'
]
}
);
}
if ( !$self->public && !$shares->search( { borrowernumber => $to } )->count ) {
return 'new_owner_has_no_share';
}