From 5b0962028763c4e36bc6d05fd07513b0f10754bd Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Sun, 24 Oct 2021 19:54:24 -0300 Subject: [PATCH] Bug 29272: (QA follow-up) Category setup overrides syspref This patch removes an early short-circuit we had, which wasn't correct regarding the OpacPasswordChange syspref. If a patron category is allowed to change password, it overrides the syspref. To test: 1. Tests still pass. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- Koha/REST/V1/Patrons/Password.pm | 8 -------- t/db_dependent/api/v1/patrons_password.t | 3 +-- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/Koha/REST/V1/Patrons/Password.pm b/Koha/REST/V1/Patrons/Password.pm index 5aaaa6b659..35379edf18 100644 --- a/Koha/REST/V1/Patrons/Password.pm +++ b/Koha/REST/V1/Patrons/Password.pm @@ -90,14 +90,6 @@ sub set_public { my $body = $c->validation->param('body'); my $patron_id = $c->validation->param('patron_id'); - # short-circuit early - unless ( C4::Context->preference('OpacPasswordChange') ) { - return $c->render( - status => 403, - openapi => { error => "Configuration prevents password changes by unprivileged users" } - ); - } - my $user = $c->stash('koha.user'); unless ( $user->borrowernumber == $patron_id ) { diff --git a/t/db_dependent/api/v1/patrons_password.t b/t/db_dependent/api/v1/patrons_password.t index 95f8e5fca9..8f79a4b81b 100755 --- a/t/db_dependent/api/v1/patrons_password.t +++ b/t/db_dependent/api/v1/patrons_password.t @@ -158,8 +158,7 @@ subtest 'set_public() (unprivileged user tests)' => sub { } )->status_is(403)->json_is( { - error => - 'Configuration prevents password changes by unprivileged users' + error => 'Changing password is forbidden' } );