Symfony - Setting new user Role

268 views Asked by At

I defined new role in security.yml

ROLE_NEW: ROLE_NEW

and then set up the path

 - { path: ^/admin/staff, role: ROLE_STAFF } into access control.

I wrote a function that will return a user with that exact role on specific page after login

/** 
  * @Route("/staff", name="staff") 
  * @return \Symfony\Component\HttpFoundation\Response 
  * @Security("is_granted('ROLE_STAFF')") 
  */
public function getNewDashboard()
{
    return $this->render('@AdminTemplates/admin/new_dashboard.html.twig');
}

but after login it redirect on the same dashboard as other users. What am I doing wrong?

0

There are 0 answers