From a1e914dafbc946b90988f2aa24f9ffe7109c4f4c 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 --- 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 b0966868b9f..8e9336a9e0a 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.27.0