api-platform / api-platform/core

Expose URI variables to Link security expression

Open
#8,307 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
2.6k
Forks
980
Avg merge
2d 5h
Merged PRs (30d)
48

Description

**Description**

Follow-up of https://github.com/api-platform/core/pull/8279

Also allow the current operation's `uriVariables` to all Link metadata class's security expressions.

**Example**

```php
new Get(
uriTemplate: '/foo/{id}/bar/{name}',
uriVariables: [
'id' => new Link(
fromClass: Bar::class,
security: "is_granted('ROLE_USER') and bar.id === user.bar.id and name !== 'admin-bar'",
securityObjectName: 'bar',
provider: ReadLinkParameterProvider::class,
required: true,
),
],
),

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.