Skip to content

Fix typo on subresourceOperations.access_control #632

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

Merged
merged 1 commit into from
Oct 25, 2018

Conversation

vincentchalamon
Copy link
Contributor

Given, the following entities:

/**
 * @ApiResource(subresourceOperations={
 *     "quizzes_get_subresource"={
 *         "access_control"="is_granted('ROLE_ADMIN')"
 *     }
 * })
 */
class User
{
    // ...
    /**
     * @ApiSubresource
     */
    private $quizzes;
}
/**
 * @ApiResource
 */
class UserQuiz

Requesting /users/{id}/quizzes should be restricted to ROLE_ADMIN users, but anybody can access it. After some searches, the access_control option must be declared in the subresourceOperations key in the subresource.

@dunglas
Copy link
Member

dunglas commented Oct 25, 2018

Wow, good catch! Thanks @vincentchalamon

@dunglas dunglas merged commit 0b9a518 into api-platform:master Oct 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants