Browse Source

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 <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.11.x
Tomás Cohen Arazi 3 years ago
committed by Jonathan Druart
parent
commit
5b09620287
  1. 8
      Koha/REST/V1/Patrons/Password.pm
  2. 3
      t/db_dependent/api/v1/patrons_password.t

8
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 ) {

3
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'
}
);

Loading…
Cancel
Save