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

(-)a/Koha/REST/V1/Auth.pm (-1 / +7 lines)
Lines 154-159 sub authenticate_api_request { Link Here
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
    $c->stash_embed({ spec => $spec });
156
    $c->stash_embed({ spec => $spec });
157
    my $cookie_auth = 0;
157
158
158
    my $authorization = $spec->{'x-koha-authorization'};
159
    my $authorization = $spec->{'x-koha-authorization'};
159
160
Lines 222-227 sub authenticate_api_request { Link Here
222
            $user = Koha::Patrons->find( $session->param('number') )
223
            $user = Koha::Patrons->find( $session->param('number') )
223
              unless $session->param('sessiontype')
224
              unless $session->param('sessiontype')
224
                 and $session->param('sessiontype') eq 'anon';
225
                 and $session->param('sessiontype') eq 'anon';
226
            $cookie_auth = 1;
225
        }
227
        }
226
        elsif ($status eq "maintenance") {
228
        elsif ($status eq "maintenance") {
227
            Koha::Exceptions::UnderMaintenance->throw(
229
            Koha::Exceptions::UnderMaintenance->throw(
Lines 247-252 sub authenticate_api_request { Link Here
247
249
248
    $c->stash('koha.user' => $user);
250
    $c->stash('koha.user' => $user);
249
251
252
    if ( $user and !$cookie_auth ) { # cookie-auth sets this and more, don't mess with that
253
        C4::Context->_new_userenv( $user->borrowernumber );
254
        C4::Context->set_userenv( $user->borrowernumber );
255
    }
256
250
    if ( !$authorization and
257
    if ( !$authorization and
251
         ( $params->{is_public} and
258
         ( $params->{is_public} and
252
          ( C4::Context->preference('RESTPublicAnonymousRequests') or
259
          ( C4::Context->preference('RESTPublicAnonymousRequests') or
253
- 

Return to bug 24003