From c8c29f9560447da59b173e2ea4e6f921d2e1ba72 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 5 Jun 2020 09:47:47 -0300 Subject: [PATCH] [19.11.x] 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 --- 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 e5a41a8efa6..3e1405afb9b 100644 --- a/Koha/REST/V1/Auth.pm +++ b/Koha/REST/V1/Auth.pm @@ -181,7 +181,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 @@ -198,7 +197,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 @@ -247,6 +245,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