security - User roles in route settings -


to check if user have access controller depending on role in top of controller:

$this->denyaccessunlessgranted('role_admin'); 

or use annotation:

/** * @security("has_role('role_admin')") */ 

and protected controllers have such check.

is possible put check in route settings, e. g. way or somehow similar:

protected_route:   path: /top_secret   defaults: { _controller: '...', roles: [role_admin] } 

?

yes should @ page:

http://symfony.com/doc/current/book/security.html#securing-url-patterns-access-control

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

Comments

Popular posts from this blog

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -