Answer the question
In order to leave comments, you need to log in
Where to add code once so that it works on a specific namespace for all controllers and their methods?
Such a question, there is a project on symphony, there is a directory in Dashboard controllers with App\Controller\Dashboard namespaces. For all controllers and their methods, you need to add the following code everywhere, which will be supplemented over time:
if($bot->getUser() != $this->getUser()) {
throw $this->createNotFoundException('Access is denied')
}
Answer the question
In order to leave comments, you need to log in
Write your subsriber to kernel.controller .
There you already check for the necessary condition by namespace and change the controller as you like.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question