From 19853732243aa45697836f1e863510c95b28d3f8 Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Fri, 27 Mar 2020 02:27:41 +0000 Subject: [PATCH] Bug 15522: (follow-up) Fix 400 errors in circ_rules.t Commit "Bug 15522: Fix permission name manage_circ_rules_from_any_libraries" renames a permission by one that negates the previous. However the commit above incorrectly negates more than is supposed to. The test wants to check whether unauthorized and restricted user can store circulation rules. The libriarian is restricted (to their homebranch) when they are circ rules authorized (by "manage_circ_rules" permission) but do not have permission "manage_circ_rules_from_any_libraries". To test: 1. prove t/db_dependent/api/v1/circ_rules.t --- t/db_dependent/api/v1/circ_rules.t | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/api/v1/circ_rules.t b/t/db_dependent/api/v1/circ_rules.t index 47b5317f44..20f608193a 100644 --- a/t/db_dependent/api/v1/circ_rules.t +++ b/t/db_dependent/api/v1/circ_rules.t @@ -253,11 +253,13 @@ sub create_user_and_session { $session->param( 'lasttime', time() ); $session->flush; - if ( $args->{permissions} ne 'authorized_restricted' ) { + # Allow circulation rules management for librarian's homebranch, but not + # other branches + if ( $args->{permissions} eq 'authorized_restricted' ) { $dbh->do( q{ INSERT INTO user_permissions (borrowernumber,module_bit,code) - VALUES (?,3,'manage_circ_rules_from_any_libraries'), (?,3,'manage_circ_rules')}, + VALUES (?,3,'manage_circ_rules')}, undef, $user->{borrowernumber}, $user->{borrowernumber} ); } -- 2.17.1