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

(-)a/Koha/REST/V1/Auth.pm (+2 lines)
Lines 155-160 sub authenticate_api_request { Link Here
155
    my $spec = $c->openapi->spec || $c->match->endpoint->pattern->defaults->{'openapi.op_spec'};
155
    my $spec = $c->openapi->spec || $c->match->endpoint->pattern->defaults->{'openapi.op_spec'};
156
156
157
    $c->stash_embed({ spec => $spec });
157
    $c->stash_embed({ spec => $spec });
158
    $c->stash_overrides();
159
158
    my $cookie_auth = 0;
160
    my $cookie_auth = 0;
159
161
160
    my $authorization = $spec->{'x-koha-authorization'};
162
    my $authorization = $spec->{'x-koha-authorization'};
(-)a/t/db_dependent/api/v1/auth_authenticate_api_request.t (-2 / +39 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 4;
20
use Test::More tests => 5;
21
use Test::Mojo;
21
use Test::Mojo;
22
22
23
use Module::Load::Conditional qw(can_load);
23
use Module::Load::Conditional qw(can_load);
Lines 258-263 subtest 'x-koha-library tests' => sub { Link Here
258
    $schema->storage->txn_rollback;
258
    $schema->storage->txn_rollback;
259
};
259
};
260
260
261
subtest 'x-koha-override stash tests' => sub {
262
263
    plan tests => 3;
264
265
    $schema->storage->txn_begin;
266
267
    my $patron = $builder->build_object({
268
        class => 'Koha::Patrons',
269
        value => { flags => 1 }
270
    });
271
    my $password = 'thePassword123';
272
    $patron->set_password({ password => $password, skip_validation => 1 });
273
    my $userid = $patron->userid;
274
275
    my $item = $builder->build_sample_item();
276
277
    my $hold_data = {
278
        patron_id => $patron->id,
279
        biblio_id => $item->biblionumber,
280
        item_id   => $item->id,
281
        pickup_library_id => $patron->branchcode,
282
    };
283
284
    my $stash;
285
286
    $t->app->hook(after_dispatch => sub {
287
        $stash = shift->stash;
288
    });
289
290
    $t->post_ok( "//$userid:$password@/api/v1/holds" => { 'x-koha-override' => "any" } => json => $hold_data );
291
292
    my $overrides = $stash->{'koha.overrides'};
293
    is( ref($overrides), 'HASH', 'arrayref returned' );
294
    ok( $overrides->{'any'}, "The value 'any' is found" );
295
296
    $schema->storage->txn_rollback;
297
};
298
261
sub create_user_and_session {
299
sub create_user_and_session {
262
300
263
    my $args  = shift;
301
    my $args  = shift;
264
- 

Return to bug 27760