I have a certain notification popup I want to trigger if the Security denies access for ROLE_USER
to use the path Admin_Only
, I successfully configured this , which works perfectly, on my :
security.yml
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/Admin_Only, role: ROLE_ADMIN }
access_denied_url: /home
and I have a JQuery Function on my Twig file to which I am rendering my /home
Action let's call it accessDeniedJQ
.
The question is How do I check and where ( Action in the Controller or on twig ) that a redirection has happened and the access was denied , in other words how do I check if this exception was raised so the JQ function starts.