From c782a03956307a44a3b7228cca0af11d29f033e3 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 12 Jan 2021 14:06:45 +0000 Subject: [PATCH] Bug 15788: Add delete_borrowers permission Signed-off-by: David Nind Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart --- .../data/mysql/atomicupdate/bug_15788.perl | 20 +++++++++++++++++++ .../data/mysql/mandatory/userpermissions.sql | 1 + .../prog/en/includes/permissions.inc | 5 +++++ 3 files changed, 26 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_15788.perl diff --git a/installer/data/mysql/atomicupdate/bug_15788.perl b/installer/data/mysql/atomicupdate/bug_15788.perl new file mode 100644 index 0000000000..98e5d27430 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_15788.perl @@ -0,0 +1,20 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if ( CheckVersion($DBversion) ) { + + $dbh->do( + qq{ + INSERT IGNORE permissions (module_bit, code, description) + VALUES + (4, 'delete_borrowers', 'Delete borrowers') + } + ); + + $dbh->do( + qq{ + INSERT IGNORE INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 4, 'delete_borrowers' FROM borrowers WHERE borrowernumber IN ( SELECT borrowernumber FROM user_permissions WHERE code = 'edit_borrowers') + } + ); + + NewVersion( $DBversion, 15788, "Split edit_borrowers permission" ); +} diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql index 066e99daf7..edb52f0fdd 100644 --- a/installer/data/mysql/mandatory/userpermissions.sql +++ b/installer/data/mysql/mandatory/userpermissions.sql @@ -36,6 +36,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 3, 'manage_keyboard_shortcuts', 'Manage keyboard shortcuts for the advanced cataloging editor'), ( 3, 'manage_smtp_servers', 'Manage SMTP servers configuration'), ( 3, 'manage_background_jobs', 'Manage background jobs'), + ( 4, 'delete_borrowers', 'Delete patrons'), ( 4, 'edit_borrowers', 'Add, modify and view patron information'), ( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'), ( 6, 'place_holds', 'Place holds for patrons'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index eabe4d51ee..1ffce70b1f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -265,6 +265,11 @@ Manage background jobs ([% name | html %]) + [%- CASE 'delete_borrowers' -%] + + Delete patrons + + ([% name | html %]) [%- CASE 'edit_borrowers' -%] Add, modify and view patron information -- 2.39.5