Bugzilla – Attachment 180608 Details for
Bug 35871
Adding a merge_delete_authorities subpermission for editauthorities
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35871: Add new subpermission merge_delete_authorities
Bug-35871-Add-new-subpermission-mergedeleteauthori.patch (text/plain), 8.40 KB, created by
Wainui Witika-Park
on 2025-04-03 23:42:33 UTC
(
hide
)
Description:
Bug 35871: Add new subpermission merge_delete_authorities
Filename:
MIME Type:
Creator:
Wainui Witika-Park
Created:
2025-04-03 23:42:33 UTC
Size:
8.40 KB
patch
obsolete
>From 7fe390d81c081274e88bdd82aa3b7fbf46b3f415 Mon Sep 17 00:00:00 2001 >From: wainuiwitikapark <wainuiwitikapark@catalyst.net.nz> >Date: Thu, 3 Apr 2025 23:39:41 +0000 >Subject: [PATCH] Bug 35871: Add new subpermission merge_delete_authorities > >Add a new sub permission for merging and deleting >authority records. > >Test plan: >1. Apply the patch (including bug 35870). >2. Update the database. >3. Login to the staff interface as a superlibrarian. >4. Add or edit an existing staff patron. >5. Set the patron's permissions to catalogue so they can access > the staff interface. >6. Also add the edit_authorities permission, but not > merge_delete_authorities. >7. Logout and log back in to the staff interface as the patron. >8. Go to Authorities. >9. Search for an authority record, for example search for 'a'. >10. Notice that there is an 'Actions' dropdown next to each authority > search result. >11. Notice that the dropdown does not give you the option to > choose Merge or Delete >12. Logout and log back in to the staff interface as a superlibrarian. >13. Edit the staff patron - add the sub permission > merge_delete_authorities. >14. Logout and log back in to the staff interface as the staff > patron. >15. Repeat steps 8 to 9. >16. Click the Action dropdown and notice you can merge. >17. Check that you can merge authority records. >18. Also check you can delete a search result that has 0 records. > >Sponsored-by: Education Services Australia SCIS >--- > authorities/merge.pl | 2 +- > installer/data/mysql/atomicupdate/bug_35871.pl | 17 +++++++++++++++++ > .../data/mysql/mandatory/userpermissions.sql | 1 + > .../prog/en/includes/authorities-toolbar.inc | 6 ++++-- > .../prog/en/includes/permissions.inc | 5 +++++ > .../prog/en/modules/authorities/merge.tt | 5 +++++ > .../en/modules/authorities/searchresultlist.tt | 2 ++ > 7 files changed, 35 insertions(+), 3 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_35871.pl > >diff --git a/authorities/merge.pl b/authorities/merge.pl >index 3204b5c93a3..a5be7899a6a 100755 >--- a/authorities/merge.pl >+++ b/authorities/merge.pl >@@ -39,7 +39,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > template_name => "authorities/merge.tt", > query => $input, > type => "intranet", >- flagsrequired => { editauthorities => 1 }, >+ flagsrequired => { editauthorities => 'merge_delete_authorities' }, > } > ); > >diff --git a/installer/data/mysql/atomicupdate/bug_35871.pl b/installer/data/mysql/atomicupdate/bug_35871.pl >new file mode 100755 >index 00000000000..d1740a3a939 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_35871.pl >@@ -0,0 +1,17 @@ >+use Modern::Perl; >+use Koha::Installer::Output qw(say_warning say_success say_info); >+ >+return { >+ bug_number => "35871", >+ description => "Add a merge_delete_authorities subpermission for editauthorities", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do( >+ q{INSERT IGNORE INTO permissions (module_bit, code, description) VALUES ('14','merge_delete_authorities','Merge and delete authority records')} >+ ); >+ >+ say_success( $out, "Added new permission 'merge_delete_authorities'" ); >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql >index bcb2fa6033a..ce2d07d42e1 100644 >--- a/installer/data/mysql/mandatory/userpermissions.sql >+++ b/installer/data/mysql/mandatory/userpermissions.sql >@@ -128,6 +128,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > (13, 'upload_general_files', 'Upload any file'), > (13, 'upload_manage', 'Manage uploaded files'), > (14, 'edit_authorities', 'Edit authority records'), >+ (14, 'merge_delete_authorities', 'Merge and delete authority records'), > (15, 'check_expiration', 'Check the expiration of a serial'), > (15, 'claim_serials', 'Claim missing serials'), > (15, 'create_subscription', 'Create a new subscription'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc >index 8727903a5ff..f5fb9b428d9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc >@@ -26,8 +26,10 @@ > [% IF servers.count > 0 %] > <li><a class="dropdown-item" id="z3950_replace" href="#">Replace record via Z39.50/SRU</a></li> > [% END %] >- [% UNLESS ( count ) %] >- <li><a class="dropdown-item" href="#" id="delAuth">Delete record</a></li> >+ [% IF ( CAN_user_editauthorities_merge_delete_authorities ) %] >+ [% UNLESS ( count ) %] >+ <li><a class="dropdown-item" href="#" id="delAuth">Delete record</a></li> >+ [% END %] > [% END %] > </ul> > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >index c187a794822..43e185abd1e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >@@ -450,6 +450,11 @@ > [%- CASE 'view_system_logs' -%] > <span class="sub_permission view_system_logs_subpermission"> Browse the system logs </span> > <span class="permissioncode">([% name | html %])</span> >+ [%- CASE 'merge_delete_authorities' -%] >+ <span class="sub_permission merge_delete_authorities"> >+ Merge and delete authority records >+ </span> >+ <span class="permissioncode">([% name | html %])</span> > [%- CASE 'check_expiration' -%] > <span class="sub_permission check_expiration_subpermission"> Check the expiration of a serial </span> > <span class="permissioncode">([% name | html %])</span> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt >index 9f4e2a7c052..ad97a03805d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt >@@ -44,6 +44,8 @@ > [% WRAPPER 'main-container.inc' wide_full => 1 %] > <h1>Merging records</h1> > >+ [% IF CAN_user_editauthorities_merge_delete_authorities %] >+ > [% IF ( errors ) %] > > [% FOREACH error IN errors %] >@@ -137,6 +139,9 @@ > </fieldset> > </form> > [% END %] >+ [% ELSE %] >+ <div class="dialog alert">You do not have the required privileges to merge authorities.</div> >+ [% END %] > [% END %] > > [% MACRO jsinclude BLOCK %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt >index cad44eea6e5..88221f7aacf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt >@@ -109,6 +109,7 @@ > <li > ><a class="dropdown-item" href="/cgi-bin/koha/authorities/authorities.pl?authid=[% resul.authid | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a></li > > >+ [% IF CAN_user_editauthorities_merge_delete_authorities %] > <li > ><a class="merge_auth dropdown-item" href="#merge"><i class="fa fa-compress"></i> Merge</a></li > > >@@ -132,6 +133,7 @@ > </form></li > > > [% END %] >+ [% END %] > <li class="authority_preview"> > <a class="dropdown-item" data-authid="[% resul.authid | html %]" href="/cgi-bin/koha/authorities/detail.pl?authid=[% resul.authid | uri %]"><i class="fa-solid fa-eye"></i> MARC preview</a> > </li> >-- >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 35871
:
161263
|
161318
|
161319
|
177209
|
177495
| 180608