With Symfony (I learn from Symfony 4), I want allow access to a custom controller depending of the role of the connected user.
In the annotations , I see I can manage the role access with :
/**
* @Security("has_role('ROLE_ADMIN')")
*/
public function hello($name)
{
...
Is it possible to call a function in the annotation like this ?
/**
* @Security("my_verification_function")
*/
public function hello($name)
{
...
}
...
private function verification_function(){
//some process
if (...)
return true; // the user can access to the page
else ...
return false; // the user can't access to the page
}