From 9bd3a44944e6a0cb7920c3c53a88c11a8986b146 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 13 Sep 2013 14:45:50 -0400 Subject: [PATCH] Bug 10888: Don't hide authorities module from users who lack permission to edit authorities It should be possible for staff client users to search and view authority records even if they don't have permission to edit them. To test, apply the patch and view the staff client as a user with and without "editauthorities" permission. With "editauthorities" permission, authority search results should show both an edit and delete link. Viewing the details of an authority record, one should see a toolbar with edit/delete/new options. The detail view has been altered to use the term "record" in place of "biblio" ("Used in X record(s)). Without "editauthorities" permission, authority search results should show no edit or delete link. Viewing the details of an authority, the only option shown in the toolbar should be "Save." On the staff client home page and in the header's "More" menu the link to the authorities module should now appear with and without permission to edit authorities. This patch also corrects the permissions in the authority export script to allow saving of authority records by users who do not have permission to edit. Signed-off-by: Paola Rossi Signed-off-by: Jonathan Druart Signed-off-by: Galen Charlton --- authorities/export.pl | 2 +- .../prog/en/includes/authorities-toolbar.inc | 17 +++++++++++++---- .../intranet-tmpl/prog/en/includes/header.inc | 2 -- .../modules/authorities/searchresultlist.tt | 19 ++++++++++++------- .../prog/en/modules/intranet-main.tt | 2 -- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/authorities/export.pl b/authorities/export.pl index 9c8ae17b8d..dc886c05c3 100755 --- a/authorities/export.pl +++ b/authorities/export.pl @@ -15,7 +15,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( query => $query, type => "intranet", authnotrequired => 0, - flagsrequired => { editauthorities => 1 }, + flagsrequired => { catalogue => 1 }, debug => 1, } ); 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 633560ae66..b376ce541e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc @@ -9,14 +9,19 @@ //]]> + +[% IF ( authid || CAN_user_editauthorities) %] +
[% IF ( authid ) %] - - [% UNLESS ( count ) %] - + [% IF ( CAN_user_editauthorities ) %] + + + [% UNLESS ( count ) %] + + [% END %] [% END %] - [% END %] +[% IF ( CAN_user_editauthorities ) %] +[% END %]
+ +[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc index 58f721fea5..b6bc66035e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc @@ -18,9 +18,7 @@ [% IF ( CAN_user_acquisition ) %]
  • Acquisitions
  • [% END %] - [% IF ( CAN_user_editauthorities ) %]
  • Authorities
  • - [% END %] [% IF ( CAN_user_serials ) %]
  • Serials
  • [% END %] 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 445b541900..ea16505594 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt @@ -67,7 +67,9 @@ function searchauthority() { [% UNLESS ( isEDITORS ) %] Used in [% END %] - Delete + [% IF ( CAN_user_editauthorities ) %] +   + [% END %] [% FOREACH resul IN result %] [% UNLESS ( loop.odd ) %] @@ -79,14 +81,17 @@ function searchauthority() { Details [% UNLESS ( resul.isEDITORS ) %] - [% resul.used %] biblio(s) + [% resul.used %] records(s) [% END %] - - [% UNLESS ( resul.used ) %] - Delete - [% END %] - + [% IF ( CAN_user_editauthorities ) %] + + Edit + [% UNLESS ( resul.used ) %] + | Delete + [% END %] + + [% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt index 1a43357df8..8fc64fcdf1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt @@ -54,11 +54,9 @@ [% END %] - [% IF ( CAN_user_editauthorities ) %]
  • Authorities
  • - [% END %] -- 2.39.5