From 9b64ef1d1286e3c5e8db0e30cc25f5b0f69413bf 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. --- 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.20.1