Weird issue here.
I have a 403 error when I try to access a endpoint of my API whereas the users's role is correct.
Here's my route's annotation (I'm using FosRestBundle)
/**
* @Rest\Get("home/{id}/versions", requirements={"id"="\d+"})
* @Security("has_role('ROLE_ADMIN_HOME_VIEW')")
* @Rest\View()
*/
The Symfony Profiler tells me that the route is correctly matched and that I have the requested role, here's the list of inherited roles But an AccessDeniedHttpException exception is thrown.
Obviously, if I remove the @Security line from my annotation, everything is fine.
But the most frustrating part is that I have another similar route in the same controller that is working, with same security requirements, here is its annotation.
/**
* @Rest\Get("/home/{locale}/{version}", requirements={"version"="\d+", "locale"="[a-z]{2}"} , defaults={"version" = null})")
* @Security("has_role('ROLE_ADMIN_HOME_VIEW')")
* @Rest\View()
*/
The problem is my role_hierarchy list syntax.
Here the faulty one :
Here the correct one :
To bad no error were thrown about it though.