From 8b377c96f9d930f7a62f9091b787bbfb230a1d6a Mon Sep 17 00:00:00 2001 From: Andrew Fuerste Henry Date: Thu, 12 Mar 2026 23:00:27 +0000 Subject: [PATCH] Bug 42083: Implement distinct permissions To test: 1 - have an staff account with 'send_messages_to_borrowers' permission but not top level 'borrowers' permission 2 - have a value in SMSSendDriver system preference 3 - log in under your staff account and confirm you can send both email and SMS messages from the Add Message button on a patron record 4 - apply patch, updatedatabase, restart_all 5 - confirm your staff account now has 'send_messages_to_borrowers_email' permission rather than 'send_messages_to_borrowers' 6 - confirm your staff account can now only send email messages from the Add Message button on a patron record 7 - add 'send_messages_to_borrowers_sms' permission to your staff account 8 - confirm your staff account can now send both email and sms messages from the Add Message button on a patron record 9 - remove 'send_messages_to_borrowers_email' from your staff account 10 - confirm your staff account can now only send sms messages from the Add Message button on a patron record --- circ/add_message.pl | 9 ++++++++- .../intranet-tmpl/prog/en/includes/members-toolbar.inc | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/circ/add_message.pl b/circ/add_message.pl index 33dc1d8c60d..2e872fbc57f 100755 --- a/circ/add_message.pl +++ b/circ/add_message.pl @@ -66,7 +66,14 @@ if ( $op eq 'cud-edit_message' && $message_id ) { if ( $message_type eq 'E' or $message_type eq 'SMS' ) { my $message_transport_type = $message_type eq 'SMS' ? 'sms' : 'email'; my $logged_in_patron = Koha::Patrons->find($loggedinuser); - if ( !$logged_in_patron->has_permission( { borrowers => 'send_messages_to_borrowers' } ) ) { + if ( $message_transport_type eq 'email' + && !$logged_in_patron->has_permission( { borrowers => 'send_messages_to_borrowers_email' } ) ) + { + C4::Output::output_and_exit( $input, $cookie, $template, 'insufficient_permission' ); + } + if ( $message_transport_type eq 'sms' + && !$logged_in_patron->has_permission( { borrowers => 'send_messages_to_borrowers_sms' } ) ) + { C4::Output::output_and_exit( $input, $cookie, $template, 'insufficient_permission' ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc index 51f26cb47a3..c7389c9ae1b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -186,11 +186,11 @@ -- 2.39.5