In my security.yml
I added the role ROLE_PUBLISHER
. I set it up so that ROLE_USER
inherits the ROLE_PUBLISHER
:
security:
role_hierarchy:
ROLE_USER: ROLE_PUBLISHER
Controller code as follows.
/**
* @Route("/{id}", requirements={"id" = "\d+"}, name="note_update", options={"expose"=true})
* @Method("PUT")
* @Secure(roles="ROLE_PUBLISHER")
*
* @param $id
*
* @return Response|JsonResponse
*/
public function updateAction($id)
{
// Some code...
}
But when I login as ROLE_PUBLISHER
, I will also have access to ROLE_USER
actions. How can I avoid this?