Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ApiProperty security attribute #3503

Conversation

GregoireHebert
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tickets fixes #773
License MIT
Doc PR api-platform/docs#1000

This PR continues #3227

@GregoireHebert GregoireHebert force-pushed the use-api-property-for-attribute-acl-computation branch from 2692611 to 6e93c26 Compare April 20, 2020 12:22
@GregoireHebert GregoireHebert force-pushed the use-api-property-for-attribute-acl-computation branch from 6e93c26 to 676585c Compare April 20, 2020 16:40
@GregoireHebert GregoireHebert marked this pull request as ready for review April 21, 2020 08:37
@dunglas dunglas merged commit 6e3a259 into api-platform:master Apr 21, 2020
@dunglas
Copy link
Member

dunglas commented Apr 21, 2020

Thank you very much @fredericbarthelet @GregoireHebert, that's a great addition! Could you add a docs entry too please?

@fredericbarthelet
Copy link
Contributor

@dunglas the Doc PR is already prepared api-platform/docs#1000 :)

@GregoireHebert GregoireHebert deleted the use-api-property-for-attribute-acl-computation branch April 21, 2020 10:05
$propertyMetadata = $this->propertyMetadataFactory->create($context['resource_class'], $attribute, $options);
$security = $propertyMetadata->getAttribute('security');
if ($this->resourceAccessChecker && $security) {
return $this->resourceAccessChecker->isGranted($attribute, $security);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be $context['resource_class'] instead of $attribute as first parameter and why don't we pass object as $extraVariables like in the DenyAccessListener?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #3966

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants