-4

I need to create an admin backend where I will be able to access all my CRUD routes.

For now here's the controllers I have :

  • MainController (For all my public routes)
  • AdminController
  • WordController (/word CRUD routes)
  • TypeController (/type CRUD routes)

For my backend I need somes routes like :

  • /admin/ (this will be something like a dashboard)
  • /admin/word/
  • /admin/word/new
  • /admin/type/new

How can I verify if the user is logged in for every route that begin with /admin ? What is the best approach for this ?

Rémi Leblanc
  • 33
  • 1
  • 3

1 Answers1

3

In your security.yaml file add:

access_control:
    - { path: ^/admin, roles: ROLE_ADMIN }
COil
  • 7,201
  • 2
  • 50
  • 98