Bugzilla – Attachment 177495 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), 10.80 KB, created by
David Nind
on 2025-02-04 01:07:28 UTC
(
hide
)
Description:
Bug 35871: Add new subpermission merge_delete_authorities
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-02-04 01:07:28 UTC
Size:
10.80 KB
patch
obsolete
>From 5f30f1778c580ce09a8f46050cc064daf9569450 Mon Sep 17 00:00:00 2001 >From: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> >Date: Tue, 23 Jan 2024 16:33:06 +1300 >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 +- > .../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 | 8 ++++ > .../modules/authorities/searchresultlist.tt | 38 ++++++++++--------- > 7 files changed, 56 insertions(+), 21 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_35871.pl > >diff --git a/authorities/merge.pl b/authorities/merge.pl >index d3208a8fa2..0b8d41b9c4 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 0000000000..d1740a3a93 >--- /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 bcb2fa6033..ce2d07d42e 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 fa69af6634..af8612e021 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc >@@ -33,8 +33,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 c54ab4216e..b2a33aba48 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >@@ -672,6 +672,11 @@ > 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 >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 7948d9a212..6bdc89dad9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt >@@ -42,6 +42,8 @@ div#result { margin-top: 1em; } > > <h1>Merging records</h1> > >+[% IF CAN_user_editauthorities_merge_delete_authorities %] >+ > [% IF ( errors ) %] > > [% FOREACH error IN errors %] >@@ -129,6 +131,12 @@ div#result { margin-top: 1em; } > </fieldset> > </form> > >+[% END %] >+ >+[% ELSE %] >+ >+<div class="dialog alert">You do not have the required privileges to merge authorities.</div> >+ > [% END %] > > </main> >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 d0b9cc772c..9ccbc2d5c1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt >@@ -108,24 +108,26 @@ > Actions</a> > <ul class="dropdown-menu dropdown-menu-end" role="menu" aria-labelledby="authactions[% resul.authid | html %]"> > <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> >- <li><a class="merge_auth dropdown-item" href="#merge"><i class="fa fa-compress"></i> Merge</a></li> >- [% UNLESS ( resul.used ) %] >- <li><form class="form_delete" method="post" action="/cgi-bin/koha/authorities/authorities-home.pl"> >- [% INCLUDE 'csrf-token.inc' %] >- <input type="hidden" name="op" value="cud-delete" /> >- <input type="hidden" name="authid" value="[% resul.authid | html %]" /> >- <input type="hidden" name="type" value="intranet" /> >- <input type="hidden" name="authtypecode" value="[% authtypecode | html %]" /> >- <input type="hidden" name="marclist" value="[% marclist | html %]" /> >- <input type="hidden" name="and_or" value="[% and_or | html %]" /> >- <input type="hidden" name="excluding" value="[% excluding | html %]" /> >- <input type="hidden" name="operator" value="[% operator | html %]" /> >- <input type="hidden" name="orderby" value="[% orderby | html %]" /> >- <input type="hidden" name="value" value="[% value | html %]" /> >- <input type="hidden" name="startfrom" value="[% startfrom | html %]" /> >- <input type="hidden" name="resultsperpage" value="[% resultsperpage | html %]" /> >- <button type="submit" class="dropdown-item"><i class="fa fa-trash"></i> Delete</button> >- </form></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> >+ [% UNLESS ( resul.used ) %] >+ <li><form class="form_delete" method="post" action="/cgi-bin/koha/authorities/authorities-home.pl"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="op" value="cud-delete" /> >+ <input type="hidden" name="authid" value="[% resul.authid | html %]" /> >+ <input type="hidden" name="type" value="intranet" /> >+ <input type="hidden" name="authtypecode" value="[% authtypecode | html %]" /> >+ <input type="hidden" name="marclist" value="[% marclist | html %]" /> >+ <input type="hidden" name="and_or" value="[% and_or | html %]" /> >+ <input type="hidden" name="excluding" value="[% excluding | html %]" /> >+ <input type="hidden" name="operator" value="[% operator | html %]" /> >+ <input type="hidden" name="orderby" value="[% orderby | html %]" /> >+ <input type="hidden" name="value" value="[% value | html %]" /> >+ <input type="hidden" name="startfrom" value="[% startfrom | html %]" /> >+ <input type="hidden" name="resultsperpage" value="[% resultsperpage | html %]" /> >+ <button type="submit" class="dropdown-item"><i class="fa fa-trash"></i> Delete</button> >+ </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> >-- >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