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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -