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

(-)a/Koha/REST/V1/Auth.pm (-4 / +13 lines)
Lines 207-213 sub authenticate_api_request { Link Here
207
                                                { remote_addr => $remote_addr });
207
                                                { remote_addr => $remote_addr });
208
        if ($status eq "ok") {
208
        if ($status eq "ok") {
209
            my $session = get_session($sessionID);
209
            my $session = get_session($sessionID);
210
            $user = Koha::Patrons->find($session->param('number'));
210
            $user = Koha::Patrons->find( $session->param('number') )
211
              unless $session->param('sessiontype')
212
                 and $session->param('sessiontype') eq 'anon';
211
        }
213
        }
212
        elsif ($status eq "maintenance") {
214
        elsif ($status eq "maintenance") {
213
            Koha::Exceptions::UnderMaintenance->throw(
215
            Koha::Exceptions::UnderMaintenance->throw(
Lines 233-244 sub authenticate_api_request { Link Here
233
235
234
    $c->stash('koha.user' => $user);
236
    $c->stash('koha.user' => $user);
235
237
236
    # We do not need any authorization
238
    if ( !$authorization ) {
237
    unless ($authorization) {
239
        # We do not need any authorization
238
        # Check the parameters
240
        # Check the parameters
239
        validate_query_parameters( $c, $spec );
241
        validate_query_parameters( $c, $spec );
240
        return 1;
242
        return 1;
241
    }
243
    }
244
    else {
245
        # We are required authorizarion, there needs
246
        # to be an identified user
247
        Koha::Exceptions::Authentication::Required->throw(
248
            error => 'Authentication failure.' )
249
          unless $user;
250
    }
251
242
252
243
    my $permissions = $authorization->{'permissions'};
253
    my $permissions = $authorization->{'permissions'};
244
    # Check if the user is authorized
254
    # Check if the user is authorized
245
- 

Return to bug 24862