symfony2 fallback route for permission denied
Is there a way to specify a fallback route for a route if the user lacks the required role to access the requested route?
Tor example, a logged in user has access to many pages of my site. When that user requests to use a function on my site that it lacks permission for (ie needs the role ROLE_SUBSCRIBING), I would want to show a page describing the requested function, and display options for payment to become ROLE_SUBSCRIBING. Rediricting to the login form makes no sense here since the user is correctly authenticated.
Checkout http://symfony.com/doc/current/reference/configuration/security.html you want:
# app/config/security.yml security: access_denied_url: /foo/error403
You can also do it per firewall:
# app/config/security.yml security: #... firewalls: somename: #... access_denied_url: /foo/error403