View | Details | Raw Unified | Return to bug 24003
Collapse All | Expand All

(-)a/Koha/REST/V1/Auth.pm (-1 / +8 lines)
Lines 153-158 sub authenticate_api_request { Link Here
153
    # TODO: remove the latter 'openapi.op_spec' if minimum version is bumped to at least 1.17.
153
    # TODO: remove the latter 'openapi.op_spec' if minimum version is bumped to at least 1.17.
154
    my $spec = $c->openapi->spec || $c->match->endpoint->pattern->defaults->{'openapi.op_spec'};
154
    my $spec = $c->openapi->spec || $c->match->endpoint->pattern->defaults->{'openapi.op_spec'};
155
155
156
    my $cookie_auth = 0;
157
156
    my $authorization = $spec->{'x-koha-authorization'};
158
    my $authorization = $spec->{'x-koha-authorization'};
157
159
158
    my $authorization_header = $c->req->headers->authorization;
160
    my $authorization_header = $c->req->headers->authorization;
Lines 220-225 sub authenticate_api_request { Link Here
220
            $user = Koha::Patrons->find( $session->param('number') )
222
            $user = Koha::Patrons->find( $session->param('number') )
221
              unless $session->param('sessiontype')
223
              unless $session->param('sessiontype')
222
                 and $session->param('sessiontype') eq 'anon';
224
                 and $session->param('sessiontype') eq 'anon';
225
            $cookie_auth = 1;
223
        }
226
        }
224
        elsif ($status eq "maintenance") {
227
        elsif ($status eq "maintenance") {
225
            Koha::Exceptions::UnderMaintenance->throw(
228
            Koha::Exceptions::UnderMaintenance->throw(
Lines 245-250 sub authenticate_api_request { Link Here
245
248
246
    $c->stash('koha.user' => $user);
249
    $c->stash('koha.user' => $user);
247
250
251
    if ( $user and !$cookie_auth ) { # cookie-auth sets this and more, don't mess with that
252
        C4::Context->_new_userenv( $user->borrowernumber );
253
        C4::Context->set_userenv( $user->borrowernumber );
254
    }
255
248
    if ( !$authorization and
256
    if ( !$authorization and
249
         ( $params->{is_public} and
257
         ( $params->{is_public} and
250
          ( C4::Context->preference('RESTPublicAnonymousRequests') or
258
          ( C4::Context->preference('RESTPublicAnonymousRequests') or
251
- 

Return to bug 24003