From 7173eb06548fde6113e90cc6011d4fa38bdc960f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 23 Jul 2018 19:11:59 -0300 Subject: [PATCH] Bug 15520: Rename permission to manage_circ_rules_from_any_libraries --- admin/smart-rules.pl | 9 +++++---- .../atomicupdate/bug_15520-add_manage_circ_rules_restricted.sql | 2 +- installer/data/mysql/userpermissions.sql | 2 +- koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 3cbcf82b58..f78302c61e 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -62,10 +62,11 @@ unless ( $branch ) { } } -my $uid = Koha::Patrons->find( $loggedinuser )->userid; -my $restricted_to_own_library = $uid && haspermission( $uid, { parameters => 'manage_circ_rules_restricted' }, { no_inherit => 1 } ); -$template->param( restricted_to_own_library => $restricted_to_own_library ); -$branch = C4::Context::mybranch() if $restricted_to_own_library; +my $logged_in_patron = Koha::Patrons->find( $loggedinuser ); + +my $can_edit_from_any_library = $logged_in_patron->has_permission( {parameters => 'manage_circ_rules_from_any_libraries' } ); +$template->param( restricted_to_own_library => not $can_edit_from_any_library ); +$branch = C4::Context::mybranch() unless $can_edit_from_any_library; $branch = '*' if $branch eq 'NO_LIBRARY_SET'; diff --git a/installer/data/mysql/atomicupdate/bug_15520-add_manage_circ_rules_restricted.sql b/installer/data/mysql/atomicupdate/bug_15520-add_manage_circ_rules_restricted.sql index 830f4fb0aa..c7e99ceb3d 100644 --- a/installer/data/mysql/atomicupdate/bug_15520-add_manage_circ_rules_restricted.sql +++ b/installer/data/mysql/atomicupdate/bug_15520-add_manage_circ_rules_restricted.sql @@ -1 +1 @@ -INSERT IGNORE INTO `permissions` (module_bit, code, description) VALUES(3, 'manage_circ_rules_restricted', 'Only manage circ rules for own library'); +INSERT IGNORE INTO `permissions` (module_bit, code, description) VALUES(3, 'manage_circ_rules_from_any_libraries', 'Manage circ rules for any libraries'); diff --git a/installer/data/mysql/userpermissions.sql b/installer/data/mysql/userpermissions.sql index 18fe3f8080..ae45a5731a 100644 --- a/installer/data/mysql/userpermissions.sql +++ b/installer/data/mysql/userpermissions.sql @@ -7,7 +7,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 1, 'manage_checkout_notes', 'Mark checkout notes as seen/not seen'), ( 3, 'parameters_remaining_permissions', 'Remaining system parameters permissions'), ( 3, 'manage_circ_rules', 'Manage circulation rules'), - ( 3, 'manage_circ_rules_restricted', 'Only manage circ rules for own library'), + ( 3, 'manage_circ_rules_restricted', 'Manage circ rules for any libraries'), ( 4, 'edit_borrowers', 'Add, modify and view patron information'), ( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'), ( 6, 'place_holds', 'Place holds for patrons'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc index baf966a0e1..4127bffad8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc @@ -33,7 +33,7 @@ [%- CASE 'override_renewals' -%]Override blocked renewals [%- CASE 'manage_checkout_notes' %]Mark checkout notes as seen/not seen [%- CASE 'manage_circ_rules' -%]manage circulation rules - [%- CASE 'manage_circ_rules_restricted' -%]Limit circulation rules editing to the user's own library (please note that manage_circ_rules is still required) + [%- CASE 'manage_circ_rules_from_any_libraries' -%]Edit circulation rules from any libraries. If not set the logged in user could only edit circulation rules for its the own library (please note that manage_circ_rules is still required) [%- CASE 'parameters_remaining_permissions' -%]Remaining system parameters permissions [%- CASE 'edit_borrowers' -%]Add, modify and view patron information [%- CASE 'view_borrower_infos_from_any_libraries' -%]View patron infos from any libraries. If not set the logged in user could only access patron infos from its own library or group of libraries. -- 2.11.0