Bugzilla – Attachment 177209 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: Adding new subpermission merge_delete_authorities
Bug-35871-Adding-new-subpermission-mergedeleteauth.patch (text/plain), 11.05 KB, created by
Wainui Witika-Park
on 2025-01-28 05:28:07 UTC
(
hide
)
Description:
Bug 35871: Adding new subpermission merge_delete_authorities
Filename:
MIME Type:
Creator:
Wainui Witika-Park
Created:
2025-01-28 05:28:07 UTC
Size:
11.05 KB
patch
obsolete
>From c5f0f588585154efb948b1c8401caf9ff37624c1 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: Adding new subpermission merge_delete_authorities > >Test plan: >- apply patch from Bug 35870 >- apply patch >- login to staff client with your personal user >- make a new test user >- set the new test user's permissions to catalogue so they can access the staff client >- also set the new test user's permissions to subpermission edit_authorities, but not merge_delete_auhtorities >- logout and log back in to the staff client as the new test user >- go to Authorities >- do a search >- notice there is an 'Actions' drop down next to each authority search result >- notice that the drop down does not give you the option to choose Merge >or Delete >- logout and log back in to the staff client as your personal user >- edit the new test user - add subpermission merge_delete_authorities >- logout and log back in to the staff client as the test user >- go to Authorities >- do a search >- notice how you there is an 'Actions' dropdown next to each of the authority search results >- click the Action dropdown and notice you can merge >- check you can merge results >- also check you can delete a result that has 0 records > >Sponsored-by: Education Services Australia SCIS >--- > authorities/merge.pl | 2 +- > ...add_merge_delete_authorities_subpermission | 22 +++++++++++ > .../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, 61 insertions(+), 21 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_35871_add_merge_delete_authorities_subpermission > >diff --git a/authorities/merge.pl b/authorities/merge.pl >index d3208a8fa2b..0b8d41b9c4c 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_add_merge_delete_authorities_subpermission b/installer/data/mysql/atomicupdate/bug_35871_add_merge_delete_authorities_subpermission >new file mode 100755 >index 00000000000..563f1452019 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_35871_add_merge_delete_authorities_subpermission >@@ -0,0 +1,22 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "35871", >+ description => "Adding a merge_delete_authorities subpermission for editauthorities", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ # Do you stuffs here >+ $DBversion = 'XXX'; >+ if( CheckVersion( $DBversion ) ) { >+ $dbh->do(q{INSERT IGNORE INTO permissions (module_bit, code, description) VALUES ('14','merge_delete_authorities','Merge and delete authority records')}); >+ >+ NewVersion( $DBversion, undef, "Bug 35871: Add merge_delete_authorities user subpermission" ); >+ } >+ >+ # Print useful stuff here >+ # permissions >+ say $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 fa69af66343..af8612e021b 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 c54ab4216ed..b2a33aba480 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 1db9170eae7..f5eefe1c010 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 eb1b8909289..a50d61a9e2f 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