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

(-)a/Koha/REST/Plugin/Query.pm (-3 / +17 lines)
Lines 228-234 Merges parameters from $q_params into $filtered_params. Link Here
228
228
229
=head3 stash_embed
229
=head3 stash_embed
230
230
231
    $c->stash_embed();
231
    $c->stash_embed( { spec => $op_spec } );
232
232
233
Unwraps and stashes the x-koha-embed headers for use later query construction
233
Unwraps and stashes the x-koha-embed headers for use later query construction
234
234
Lines 237-250 Unwraps and stashes the x-koha-embed headers for use later query construction Link Here
237
    $app->helper(
237
    $app->helper(
238
        'stash_embed' => sub {
238
        'stash_embed' => sub {
239
239
240
            my ( $c ) = @_;
240
            my ( $c, $args ) = @_;
241
241
            my $embed_header = $c->req->headers->header('x-koha-embed');
242
            my $embed_header = $c->req->headers->header('x-koha-embed');
243
            return $c unless $embed_header;
244
245
            my $spec = $args->{spec} // {};
246
            my $embed_spec;
247
            for my $param ( @{ $spec->{parameters} } ) {
248
                next unless $param->{name} eq 'x-koha-embed';
249
                $embed_spec = $param->{items}->{enum};
250
            }
251
            Koha::Exceptions::BadParameter->throw(
252
                "Embedding objects is not allowed on this endpoint.")
253
              unless defined($embed_spec);
254
242
            if ($embed_header) {
255
            if ($embed_header) {
243
                my $THE_embed = {};
256
                my $THE_embed = {};
244
                foreach my $embed_req ( split /\s*,\s*/, $embed_header ) {
257
                foreach my $embed_req ( split /\s*,\s*/, $embed_header ) {
245
                    if ( $embed_req eq '+strings' ) {    # special case
258
                    if ( $embed_req eq '+strings' ) {    # special case
246
                        $c->stash( 'koha.strings' => 1 );
259
                        $c->stash( 'koha.strings' => 1 );
247
                    } else {
260
                    }
261
                    else {
248
                        _merge_embed( _parse_embed($embed_req), $THE_embed );
262
                        _merge_embed( _parse_embed($embed_req), $THE_embed );
249
                    }
263
                    }
250
                }
264
                }
(-)a/Koha/REST/V1/Auth.pm (-2 / +1 lines)
Lines 157-163 sub authenticate_api_request { Link Here
157
    # TODO: remove the latter 'openapi.op_spec' if minimum version is bumped to at least 1.17.
157
    # TODO: remove the latter 'openapi.op_spec' if minimum version is bumped to at least 1.17.
158
    my $spec = $c->openapi->spec || $c->match->endpoint->pattern->defaults->{'openapi.op_spec'};
158
    my $spec = $c->openapi->spec || $c->match->endpoint->pattern->defaults->{'openapi.op_spec'};
159
159
160
    $c->stash_embed();
160
    $c->stash_embed( { spec => $spec } );
161
    $c->stash_overrides();
161
    $c->stash_overrides();
162
162
163
    my $cookie_auth = 0;
163
    my $cookie_auth = 0;
164
- 

Return to bug 32713