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
Implement ApiProperty security attribute #3503
Conversation
2692611
to
6e93c26
Compare
6e93c26
to
676585c
Compare
Thank you very much @fredericbarthelet @GregoireHebert, that's a great addition! Could you add a docs entry too please? |
@dunglas the Doc PR is already prepared api-platform/docs#1000 :) |
$propertyMetadata = $this->propertyMetadataFactory->create($context['resource_class'], $attribute, $options); | ||
$security = $propertyMetadata->getAttribute('security'); | ||
if ($this->resourceAccessChecker && $security) { | ||
return $this->resourceAccessChecker->isGranted($attribute, $security); |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #3966
This PR continues #3227