Bug 39379: Only display Edit patron button if enough permissions

This patch adds a check for the current user permissions in order to
display the 'Edit' button on the patron search screen.

To test:
1. Have a patron with staff access and only `list_borrowers` permission
   (I picked Henry Acevedo, henry - Acevedo123)
2. Login as that user
3. Perform a patron search at http://kohadev-intra.localhost/cgi-bin/koha/members/members-home.pl
=> FAIL: There's an 'Edit' button
4. Click on the 'Edit' button
=> SUCCESS: You are told you don't have enough permissions
5. Apply this patch
6. Repeat 3
=> SUCCESS: The button is not displayed
7. Login with a superlibrarian user
8. Repeat 3
=> SUCCESS: You can see the button
9. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 989924e963)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Tomas Cohen Arazi 2025-04-24 17:25:31 -03:00 committed by Fridolin Somers
parent c53631d969
commit d0895bf487
No known key found for this signature in database
GPG Key ID: 9A8E73E2A8B96537
1 changed files with 3 additions and 1 deletions

View File

@ -697,7 +697,9 @@
[% CASE 'add' %]
action_node += '<a href="#" class="btn btn-default btn-xs add_user" data-borrowernumber="' + patron_id + '">' + _("Add") + '</a>';
[% CASE 'edit' %]
action_node += '<a href="/cgi-bin/koha/members/memberentry.pl?op=edit_form&amp;destination=circ&amp;borrowernumber=' + patron_id + '" class="btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + _("Edit") + '</a>';
[% IF CAN_user_borrowers_edit_borrowers %]
action_node += '<a href="/cgi-bin/koha/members/memberentry.pl?op=edit_form&amp;destination=circ&amp;borrowernumber=' + patron_id + '" class="btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + _("Edit") + '</a>';
[% END %]
[% CASE 'checkout' %]
[% IF CAN_user_circulate_circulate_remaining_permissions %]
action_node += '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=' + patron_id + '"><i class="fa fa-barcode"></i> ' + _("Check out") + '</a>';