Bugzilla – Attachment 83416 Details for
Bug 20128
Permission for advanced editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20128: Add permission for advanced cataloging editor
Bug-20128-Add-permission-for-advanced-cataloging-e.patch (text/plain), 6.57 KB, created by
Nick Clemens (kidclamp)
on 2018-12-20 13:44:58 UTC
(
hide
)
Description:
Bug 20128: Add permission for advanced cataloging editor
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-12-20 13:44:58 UTC
Size:
6.57 KB
patch
obsolete
>From 350c44d8d966cf272491fc6949babb900eeed2bf Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 20 Dec 2018 12:50:10 +0000 >Subject: [PATCH] Bug 20128: Add permission for advanced cataloging editor > >To test: >1 - Have a borrower with edit_catalogue permission and one with >editcatalogue top level >2 - Confirm they can both access the advanced editor from the >'Cataloguing' home page or from the basic editor >3 - Apply patch >4 - Update database >5 - Confirm borrower with 'edit_catalogue' has 'advanced_editor' >permission >6 - Confirm borrowers can access advanced editor as above >7 - Remove 'advanced_editor' permission from borrower >8 - Ensure they cannot access the advanced editor >9 - Ensure links to 'Edit record' from search results go to basic editor >--- > cataloguing/addbiblio.pl | 2 +- > cataloguing/editor.pl | 4 +++- > .../bug20128_add_permission_for_advanced_editor.perl | 16 ++++++++++++++++ > koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc | 1 + > .../prog/en/modules/cataloguing/addbiblio.tt | 2 +- > .../prog/en/modules/cataloguing/addbooks.tt | 2 +- > 6 files changed, 23 insertions(+), 4 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug20128_add_permission_for_advanced_editor.perl > >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index c4ed49da87..0719e93c44 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -734,7 +734,7 @@ if ($frameworkcode eq 'FA'){ > 'stickyduedate' => $fa_stickyduedate, > 'duedatespec' => $fa_duedatespec, > ); >-} elsif ( $op ne "delete" && C4::Context->preference('EnableAdvancedCatalogingEditor') && $input->cookie( 'catalogue_editor_' . $loggedinuser ) eq 'advanced' && !$breedingid ) { >+} elsif ( $op ne "delete" && C4::Context->preference('EnableAdvancedCatalogingEditor') && C4::Auth::haspermission($loggedinuser,{'editcatalogue'=>'advanced_editor'}) && $input->cookie( 'catalogue_editor_' . $loggedinuser ) eq 'advanced' && !$breedingid ) { > # Only use the advanced editor for non-fast-cataloging. > # breedingid is not handled because those would only come off a Z39.50 > # search initiated by the basic editor. >diff --git a/cataloguing/editor.pl b/cataloguing/editor.pl >index 42f35b3f47..ae91a87c3e 100755 >--- a/cataloguing/editor.pl >+++ b/cataloguing/editor.pl >@@ -40,7 +40,9 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > query => $input, > type => 'intranet', > authnotrequired => 0, >- flagsrequired => { editcatalogue => 'edit_catalogue' }, >+ flagsrequired => { >+ editcatalogue => ['edit_catalogue','advanced_editor'], >+ } > } > ); > >diff --git a/installer/data/mysql/atomicupdate/bug20128_add_permission_for_advanced_editor.perl b/installer/data/mysql/atomicupdate/bug20128_add_permission_for_advanced_editor.perl >new file mode 100644 >index 0000000000..c383eecb52 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug20128_add_permission_for_advanced_editor.perl >@@ -0,0 +1,16 @@ >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do(q{ >+ INSERT IGNORE permissions (module_bit, code, description) >+ VALUES >+ (9,'advanced_editor','Use the advanced cataloging editor') >+ }); >+ if( C4::Context->preference('EnableAdvancedCatalogingEditor') ){ >+ $dbh->do(q{ >+ INSERT INTO user_permissions (borrowernumber, module_bit, code) >+ SELECT borrowernumber, 9, 'advanced_editor' FROM borrowers WHERE borrowernumber IN (SELECT DISTINCT borrowernumber FROM user_permissions WHERE code = 'edit_catalogue'); >+ }); >+ } >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 20128: Add permission for Advanced Cataloging Editor)\n"; >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >index ff2d8ee3c8..2b0430243b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc >@@ -65,6 +65,7 @@ > [%- CASE 'place_holds' -%]<span>Place holds for patrons</span> > [%- CASE 'delete_all_items' -%]<span>Delete all items at once</span> > [%- CASE 'edit_catalogue' -%]<span>Edit catalog (Modify bibliographic/holdings data)</span> >+ [%- CASE 'advanced_editor' -%]<span>Use the advanced cataloging editor (requires edit_catalogue)</span> > [%- CASE 'edit_items' -%]<span>Edit items</span> > [%- CASE 'edit_items_restricted' -%]<span>Limit item modification to subfields defined in the SubfieldsToAllowForRestrictedEditing preference (please note that edit_item is still required)</span> > [%- CASE 'fast_cataloging' -%]<span>Fast cataloging</span> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >index 4d6a214113..33d4ea5fca 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >@@ -488,7 +488,7 @@ function Changefwk() { > <div class="btn-group"> > <button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cog"></i> Settings <span class="caret"></span></button> > <ul id="settings-menu" class="dropdown-menu"> >- [% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 %] >+ [% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 && CAN_user_editcatalogue_advanced_editor %] > <li><a href="#" id="switcheditor">Switch to advanced editor</a></li> > [% END %] > [% IF marcflavour != 'NORMARC' AND NOT advancedMARCEditor %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >index eef01b8ed8..bb3758163e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbooks.tt >@@ -18,7 +18,7 @@ > > [% IF ( CAN_user_editcatalogue_edit_catalogue ) %] > <div id="toolbar" class="btn-toolbar"> >- [% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 %] >+ [% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 && CAN_user_editcatalogue_advanced_editor %] > <a id="useadvanced" href="/cgi-bin/koha/cataloguing/editor.pl" class="btn btn-default btn-sm"><i class="fa fa-pencil"></i> Advanced editor</a> > [% END %] > <div class="btn-group"> >-- >2.11.0
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 20128
:
83416
|
86198
|
86208
|
86543
|
86706
|
86707
|
86840
|
87738
|
87739
|
87740
|
87741
|
88196
|
88197