access.yaml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. resources:
  2. App\Entity\Access\Access:
  3. - operations:
  4. ApiPlatform\Metadata\GetCollection: ~
  5. ApiPlatform\Metadata\Get:
  6. security: '(is_granted("ROLE_USERS_VIEW") and object.getOrganization().getId() == user.getOrganization().getId()) or (object.getId() == user.getId())'
  7. ApiPlatform\Metadata\Put:
  8. security: 'is_granted("ROLE_USERS") or (object.getId() == user.getId())'
  9. ApiPlatform\Metadata\Delete: ~
  10. - operations:
  11. ApiPlatform\Metadata\GetCollection:
  12. name: 'cget_students'
  13. uriTemplate: '/students'
  14. security: 'is_granted("ROLE_USERS_VIEW")'
  15. - operations:
  16. ApiPlatform\Metadata\GetCollection:
  17. name: 'cget_access_person_ref'
  18. uriTemplate: '/access_people'
  19. normalization_context:
  20. groups: [ 'access_people_ref' ]
  21. - operations:
  22. ApiPlatform\Metadata\Get:
  23. name: 'get_access_address'
  24. uriTemplate: '/access_addresses/{id}'
  25. requirements:
  26. id: '\d+'
  27. normalization_context:
  28. groups: [ 'access_address', 'address' ] ]
  29. security: 'object.getOrganization().getId() == user.getOrganization().getId()'