Bugzilla – Attachment 187060 Details for
Bug 35830
Add separate permission for Merging Patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35830: Add merge_borrowers subpermission
Bug-35830-Add-mergeborrowers-subpermission.patch (text/plain), 6.25 KB, created by
Brendan Lawlor
on 2025-09-29 16:08:07 UTC
(
hide
)
Description:
Bug 35830: Add merge_borrowers subpermission
Filename:
MIME Type:
Creator:
Brendan Lawlor
Created:
2025-09-29 16:08:07 UTC
Size:
6.25 KB
patch
obsolete
>From c950d44453532030f812e1a8b2e0bd48f03e375d Mon Sep 17 00:00:00 2001 >From: Brendan Lawlor <blawlor@clamsnet.org> >Date: Tue, 9 Sep 2025 13:56:15 +0000 >Subject: [PATCH] Bug 35830: Add merge_borrowers subpermission > >Merging patrons only required edit_borrowers permission >but would result in a patron deletion. > >This patch requires a new merge_borrowers subpermission > >To test: >1. Give a patron the following permissions > catalogue, edit_borrowers, list_borrowers >2. Log into the staff interface as the patron >3. Do a patron search and select 2 patrons >4. Click merge patron - success - a patron got deleted >5. Apply patch, updatedatabase and restart_all >6. Repeat steps 3 and 4 - you can't >7. Add the new permission for merge_borrowers >8. Repeat steps 3 and 4 - now you can >9. prove t/Koha/Auth/Patrons.t > >Sponsored-by: CLAMS >--- > ...ug_35830_add_merge_borrowers_permission.pl | 24 +++++++++++++++++++ > .../data/mysql/mandatory/userpermissions.sql | 1 + > .../prog/en/includes/permissions.inc | 3 +++ > .../prog/en/modules/members/member.tt | 2 +- > members/merge-patrons.pl | 2 +- > t/Koha/Auth/Permissions.t | 1 + > 6 files changed, 31 insertions(+), 2 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/Bug_35830_add_merge_borrowers_permission.pl > >diff --git a/installer/data/mysql/atomicupdate/Bug_35830_add_merge_borrowers_permission.pl b/installer/data/mysql/atomicupdate/Bug_35830_add_merge_borrowers_permission.pl >new file mode 100755 >index 0000000000..776cdb9005 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/Bug_35830_add_merge_borrowers_permission.pl >@@ -0,0 +1,24 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "35830", >+ description => "Add permission borrowers:merge_borrowers", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do( >+ q{INSERT IGNORE INTO permissions (module_bit, code, description) >+ VALUES (4, 'merge_borrowers', 'Merge patrons')} >+ ); >+ >+ say $out "Added new permission 'merge_borrowers'"; >+ >+ $dbh->do( >+ q{INSERT INTO user_permissions (borrowernumber, module_bit, code) SELECT borrowernumber, module_bit, 'merge_borrowers' FROM user_permissions where module_bit = 4 and code = 'edit_borrowers';} >+ ); >+ >+ say $out "Added 'merge_borrowers' permission to existing users with 'edit_borrowers'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql >index 509cfd79f3..34b868d2d5 100644 >--- a/installer/data/mysql/mandatory/userpermissions.sql >+++ b/installer/data/mysql/mandatory/userpermissions.sql >@@ -49,6 +49,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > ( 4, 'delete_borrowers', 'Delete patrons'), > ( 4, 'edit_borrowers', 'Add, modify and view patron information'), > ( 4, 'list_borrowers', 'Search, list and view patrons'), >+ ( 4, 'merge_borrowers', 'Merge patrons'), > ( 4, 'send_messages_to_borrowers', 'Send messages to patrons'), > ( 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 8cb47687a6..e98875fc4e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >@@ -228,6 +228,9 @@ > [%- CASE 'delete_borrowers' -%] > <span class="sub_permission delete_borrowers_subpermission"> Delete patrons </span> > <span class="permissioncode">([% name | html %])</span> >+ [%- CASE 'merge_borrowers' -%] >+ <span class="sub_permission merge_borrowers_subpermission"> Merge patrons </span> >+ <span class="permissioncode">([% name | html %])</span> > [%- CASE 'edit_borrowers' -%] > <span class="sub_permission edit_borrowers_subpermission"> Add, modify and view patron information </span> > <span class="permissioncode">([% name | html %])</span> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >index fb42e1d5b7..e81b6aedd2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt >@@ -95,7 +95,7 @@ > </div> > [% END %] > >- [% IF CAN_user_borrowers_edit_borrowers %] >+ [% IF CAN_user_borrowers_merge_borrowers %] > <div class="btn-group"> > <button id="merge-patrons" class="btn btn-default btn-sm disabled" disabled="disabled" type="submit"><i class="fa fa-compress" aria-hidden="true"></i> Merge selected patrons</button> > </div> >diff --git a/members/merge-patrons.pl b/members/merge-patrons.pl >index c862921427..dce1e5e94c 100755 >--- a/members/merge-patrons.pl >+++ b/members/merge-patrons.pl >@@ -33,7 +33,7 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( > template_name => "members/merge-patrons.tt", > query => $cgi, > type => "intranet", >- flagsrequired => { borrowers => 'edit_borrowers' }, >+ flagsrequired => { borrowers => 'merge_borrowers' }, > } > ); > >diff --git a/t/Koha/Auth/Permissions.t b/t/Koha/Auth/Permissions.t >index 5ead5e3a31..ed684c2ffc 100755 >--- a/t/Koha/Auth/Permissions.t >+++ b/t/Koha/Auth/Permissions.t >@@ -127,6 +127,7 @@ subtest 'superlibrarian tests' => sub { > 'CAN_user_acquisition' => 1, > 'CAN_user_borrowers_send_messages_to_borrowers' => 1, > 'CAN_user_borrowers_delete_borrowers' => 1, >+ 'CAN_user_borrowers_merge_borrowers' => 1, > 'CAN_user_borrowers_edit_borrowers' => 1, > 'CAN_user_borrowers_list_borrowers' => 1, > 'CAN_user_borrowers_api_validate_password' => 1, >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35830
:
186301
|
186302
| 187060