Answer the question
In order to leave comments, you need to log in
How to check if a user is NOT authorized in Symfony?
All examples describe cases when you need to check for some access rights to the page (via Voter), but I need the opposite - so that only unauthorized users have access to the page.
You can, of course, check for ROLE_USER (if there is, do a redirect from the page), which, as it were, all users have. But what if a user without this role somehow appears later?
It's better to just check if the user is logged in or not. But how to do it (in the controller)?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question