Symfony 5, Access accpeted with only a new role doesn’t work in a controller

  annotations, controller, php, symfony

In my database, I create a new role called ‘D’, many users have this role.

I want in my page /designer, only those have the role ‘ROLE_D’ may access to this page.

In my controller I wrote that

 * @Route("/designer", name="designer", methods={"GET"})
 * @IsGranted("ROLE_D")

But it doesn’t work

I also tried


but nothing works

Is it possible to secure with a role other than ‘ROLE_ADMIN’ and ‘ROLE_USER’ in a controller?

Source: Symfony Questions