1
votes

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?

1

1 Answers

3
votes

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.