From 1bbc53f65fba7cb28d7e56edede0e48349f5fff3 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 15 Jul 2022 17:21:13 +0100 Subject: [PATCH] Bug 30335: (follow-up) Ensure existing users remain permitted This patch updates the database update to ensure users with the 'remaining_permissions' subpermission of 'updatecharges' continue to be able to manually invoice and manually credit borrower accounts after the patch is applied. Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/atomicupdate/bug_30335.pl | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_30335.pl b/installer/data/mysql/atomicupdate/bug_30335.pl index 3afb3b2148..127439d5dd 100644 --- a/installer/data/mysql/atomicupdate/bug_30335.pl +++ b/installer/data/mysql/atomicupdate/bug_30335.pl @@ -1,15 +1,25 @@ use Modern::Perl; return { - bug_number => "30335", + bug_number => "30335", description => "Add manual_invoice and manual_credit permissions", - up => sub { + up => sub { my ($args) = @_; - my ($dbh, $out) = @$args{qw(dbh out)}; + my ( $dbh, $out ) = @$args{qw(dbh out)}; $dbh->do(q{ INSERT IGNORE permissions (module_bit, code, description) VALUES (10, 'manual_credit', 'Add manual credits to a patron account'), (10, 'manual_invoice', 'Add manual invoices to a patron account') }); + + $dbh->do(q{ + INSERT IGNORE INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 10, 'manual_credit' FROM user_permissions WHERE code = 'remaining_permissions' + }); + + $dbh->do(q{ + INSERT IGNORE INTO user_permissions (borrowernumber, module_bit, code) + SELECT borrowernumber, 10, 'manual_invoice' FROM user_permissions WHERE code = 'remaining_permissions' + }); }, }; -- 2.39.5