From 70a71ce1f5eda18c8c66616324e2c4f55fb5bec1 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 22 Jan 2024 16:49:56 +0000 Subject: [PATCH] Bug 29509: WIP - Start of DB and specification update --- api/v1/swagger/paths/patrons.yaml | 5 ---- .../data/mysql/atomicupdate/bug_29509.pl | 27 +++++++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_29509.pl diff --git a/api/v1/swagger/paths/patrons.yaml b/api/v1/swagger/paths/patrons.yaml index 641ba4f1ae1..02894e2dd05 100644 --- a/api/v1/swagger/paths/patrons.yaml +++ b/api/v1/swagger/paths/patrons.yaml @@ -394,11 +394,6 @@ x-koha-authorization: permissions: - borrowers: "list_borrowers" - - borrowers: "edit_borrowers" - - circulate: "manage_bookings" - - tools: "label_creator" - - serials: "routing" - - acquisition: "order_manage" post: x-mojo-to: Patrons#add operationId: addPatron diff --git a/installer/data/mysql/atomicupdate/bug_29509.pl b/installer/data/mysql/atomicupdate/bug_29509.pl new file mode 100644 index 00000000000..5a8b0714ebb --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_29509.pl @@ -0,0 +1,27 @@ +use Modern::Perl; + +return { + bug_number => "29509", + description => "Update users with list_borrowers permission where required", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do( + "INSERT IGNORE INTO permissions (module_bit, code, description) VALUES (4, 'list_borrowers', 'Search, list and view patrons')" + ); + + # Check for 'borrowers' or 'borrowers > edit_borrowers' permission + say $out "list_borrowers added to all users with edit_borrowers"; + # Check for 'circulate' or 'circulate > manage_bookings' permission + say $out "list_borrowers added to all users with manage_bookings"; + # Check for 'tools' or 'tools > label_creator' permission + say $out "list_borrowers added to all users with label_creator"; + # Check for 'serials' or 'serials > routing' permission + say $out "list_borrowers added to all users with routing"; + # Check for 'acquisitions' or 'acquisitions > order_manage' permission + say $out "list_borrowers added to all users with order_manage"; + + # Checks above should also confirm users don't already have top level 'borrowers' permission before adding the sub-permission + }, +}; -- 2.43.0