1

I'm quite new to Sonata Admin Bundle and I'm trying to make the User bundle work, however what I really need is just to limit acces to the admin area to a single administrator so it may be a bit of an overhead. Is it feasibile with all the symfony dynamic routing to secure the access with something as simple as an .htaccess rule or sth similar?

konrad
  • 1,664
  • 2
  • 17
  • 36

1 Answers1

3

I'd recommend restricting access to /admin path to a role (e.g. ROLE_ADMIN) and assigning the role only to the user, that should have said access:

# app/config/security.yml
security:
    # ...
    access_control:
        # require ROLE_ADMIN for /admin*
        - { path: ^/admin, roles: ROLE_ADMIN }

For more info on Access Controll see documentation.

tomas.pecserke
  • 3,260
  • 25
  • 26
  • Thanks! I must have missed that part of documentation [blush]. I'll check this out and see if it answers my question, i.e. is easier to setup than Sonata User Bundle and accept the answer then. – konrad Mar 25 '15 at 14:23
  • You're welcome. If you are satified with the answer, please accept it as correct. It helps others to find correct answers and helps us to identify questions, that still need attention. – tomas.pecserke Mar 25 '15 at 17:05