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

(-)a/Koha/REST/V1/Auth.pm (+2 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
    $c->stash_overrides();
158
157
    my $cookie_auth = 0;
159
    my $cookie_auth = 0;
158
160
159
    my $authorization = $spec->{'x-koha-authorization'};
161
    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 => 3;
20
use Test::More tests => 4;
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 192-197 subtest 'anonymous requests to public API' => sub { Link Here
192
    $schema->storage->txn_rollback;
192
    $schema->storage->txn_rollback;
193
};
193
};
194
194
195
subtest 'x-koha-override stash tests' => sub {
196
197
    plan tests => 3;
198
199
    $schema->storage->txn_begin;
200
201
    my $patron = $builder->build_object({
202
        class => 'Koha::Patrons',
203
        value => { flags => 1 }
204
    });
205
    my $password = 'thePassword123';
206
    $patron->set_password({ password => $password, skip_validation => 1 });
207
    my $userid = $patron->userid;
208
209
    my $item = $builder->build_sample_item();
210
211
    my $hold_data = {
212
        patron_id => $patron->id,
213
        biblio_id => $item->biblionumber,
214
        item_id   => $item->id,
215
        pickup_library_id => $patron->branchcode,
216
    };
217
218
    my $stash;
219
220
    $t->app->hook(after_dispatch => sub {
221
        $stash = shift->stash;
222
    });
223
224
    $t->post_ok( "//$userid:$password@/api/v1/holds" => { 'x-koha-override' => "any" } => json => $hold_data );
225
226
    my $overrides = $stash->{'koha.overrides'};
227
    is( ref($overrides), 'HASH', 'arrayref returned' );
228
    ok( $overrides->{'any'}, "The value 'any' is found" );
229
230
    $schema->storage->txn_rollback;
231
};
232
195
sub create_user_and_session {
233
sub create_user_and_session {
196
234
197
    my $args  = shift;
235
    my $args  = shift;
198
- 

Return to bug 27760