From 06c246a067ae55ccc14ef054983553ea006b3e97 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 5 Jun 2020 09:47:47 -0300 Subject: [PATCH] Bug 24003: (follow-up) Move interface setting to a more readable place Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart (cherry picked from commit 6b2d8b6779df37fa6be58f0313f4c128b183e4f6) Signed-off-by: Lucas Gass --- Koha/REST/V1/Auth.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Koha/REST/V1/Auth.pm b/Koha/REST/V1/Auth.pm index b0966868b9..8e9336a9e0 100644 --- a/Koha/REST/V1/Auth.pm +++ b/Koha/REST/V1/Auth.pm @@ -182,7 +182,6 @@ sub authenticate_api_request { if ($valid_token) { my $patron_id = Koha::ApiKeys->find( $valid_token->{client_id} )->patron_id; $user = Koha::Patrons->find($patron_id); - C4::Context->interface('api'); } else { # If we have "Authorization: Bearer" header and oauth authentication @@ -199,7 +198,6 @@ sub authenticate_api_request { ); } $user = $c->_basic_auth( $authorization_header ); - C4::Context->interface('api'); unless ( $user ) { # If we have "Authorization: Basic" header and authentication # failed, do not try other authentication means @@ -248,6 +246,7 @@ sub authenticate_api_request { } $c->stash('koha.user' => $user); + C4::Context->interface('api'); if ( $user and !$cookie_auth ) { # cookie-auth sets this and more, don't mess with that C4::Context->_new_userenv( $user->borrowernumber ); -- 2.39.5