From d937b39727b4b88884a2ed05ba8615f2f4092a13 Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Fri, 8 Nov 2019 15:19:32 +0000 Subject: [PATCH] Bug 24003: Create new userenv for REST basic authentication To test: 1. prove t/db_dependent/api/v1/auth_basic.t 2. Observe success --- Koha/REST/V1/Auth.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/REST/V1/Auth.pm b/Koha/REST/V1/Auth.pm index 8bffc977da..ef9133acd9 100644 --- a/Koha/REST/V1/Auth.pm +++ b/Koha/REST/V1/Auth.pm @@ -447,6 +447,7 @@ sub _basic_auth { my ( $user_id, $password ) = split( /:/, $decoded_credentials, 2 ); my $dbh = C4::Context->dbh; + C4::Context->_new_userenv($user_id) unless defined C4::Context->userenv; unless ( checkpw_internal($dbh, $user_id, $password ) ) { Koha::Exceptions::Authorization::Unauthorized->throw( error => 'Invalid password' ); } -- 2.17.1