From a862ab09f2e7e2736581a9203d4930966fc8f307 Mon Sep 17 00:00:00 2001 From: Thibaud Guillot Date: Thu, 30 Nov 2023 15:14:42 +0100 Subject: [PATCH] Bug 30230: Add new 'list_borrowers' permission When a patron search is performed only a user with edit_borrowers permission can search by name. Search can works only with cardnumber but it makes searching less intuitive I think. So, as mentioned in the discussion, I've added a new 'list_borrowers' permission, completely independent of 'edit_borrowers', so that I can search for a member via the interface and get the results. In addition to the permission to perform check in and checkouts, this no longer poses an obstacle to simple use. Test plan: 1) Check with a user without 'edit_borrowers' permission that the patron search can only be performed with cardnumber 2) Apply this patch 3) Make the updatedatabase to add new 'list_borrowers' permissions 4) Set 'list_borrowers' permission on one user and see the difference --- api/v1/swagger/paths/patrons.yaml | 1 + .../bug_29509_add-new-list-borrowers-permission.pl | 14 ++++++++++++++ installer/data/mysql/mandatory/userpermissions.sql | 1 + .../prog/en/includes/patron-search-header.inc | 8 +++++--- .../intranet-tmpl/prog/en/includes/permissions.inc | 5 +++++ .../intranet-tmpl/prog/en/modules/intranet-main.tt | 2 +- members/member.pl | 2 +- members/members-home.pl | 2 +- 8 files changed, 29 insertions(+), 6 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_29509_add-new-list-borrowers-permission.pl diff --git a/api/v1/swagger/paths/patrons.yaml b/api/v1/swagger/paths/patrons.yaml index cf8aa09122..3ff5be1239 100644 --- a/api/v1/swagger/paths/patrons.yaml +++ b/api/v1/swagger/paths/patrons.yaml @@ -397,6 +397,7 @@ - tools: "label_creator" - serials: "routing" - acquisition: "order_manage" + - list_borrowers: 1 post: x-mojo-to: Patrons#add operationId: addPatron diff --git a/installer/data/mysql/atomicupdate/bug_29509_add-new-list-borrowers-permission.pl b/installer/data/mysql/atomicupdate/bug_29509_add-new-list-borrowers-permission.pl new file mode 100755 index 0000000000..aa09793d21 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_29509_add-new-list-borrowers-permission.pl @@ -0,0 +1,14 @@ +use Modern::Perl; + +return { + bug_number => "BUG_29509", + description => "Add new list_borrowers permission", + 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 and list patrons')"); + + say $out "Added new permission 'list_borrowers'"; + }, +}; diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql index 9660879f86..2f5451f089 100644 --- a/installer/data/mysql/mandatory/userpermissions.sql +++ b/installer/data/mysql/mandatory/userpermissions.sql @@ -45,6 +45,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 3, 'manage_identity_providers', 'Manage identity providers'), ( 4, 'delete_borrowers', 'Delete patrons'), ( 4, 'edit_borrowers', 'Add, modify and view patron information'), + ( 4, 'list_borrowers', 'Search and list patrons'), ( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'), ( 6, 'place_holds', 'Place holds for patrons'), ( 6, 'modify_holds_priority', 'Modify holds priority'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc index b3a21080be..cbb8c8bda9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc @@ -14,9 +14,11 @@ [% END %]