Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
09. ApiResource access_control
Browse files Browse the repository at this point in the history
  • Loading branch information
atournayre committed Jul 14, 2021
1 parent d9bb324 commit f8f5133
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/Entity/CheeseListing.php
Expand Up @@ -16,12 +16,22 @@

/**
* @ApiResource(
* collectionOperations={"get", "post"},
* collectionOperations={
* "get",
* "post" = {
* "access_control" = "is_granted('ROLE_USER')"
* }
* },
* itemOperations={
* "get"={
* "normalization_context"={"groups"={"cheese_listing:read", "cheese_listing:item:get"}},
* },
* "put"
* "put" = {
* "access_control" = "is_granted('ROLE_USER')"
* },
* "delete" = {
* "access_control" = "is_granted('ROLE_ADMIN')"
* }
* },
* shortName="cheeses",
* normalizationContext={"groups"={"cheese_listing:read"}, "swagger_definition_name"="Read"},
Expand Down

0 comments on commit f8f5133

Please sign in to comment.