This commit is contained in:
2025-07-07 21:48:40 +02:00
parent f7de5f8f9c
commit 4a97dad74f
5 changed files with 159 additions and 38 deletions

View File

@ -2,7 +2,9 @@
namespace App\Controller;
use App\Entity\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
@ -12,7 +14,11 @@ class HomeController extends AbstractController
#[Route('/', name: 'app_home')]
public function home(Request $request): Response
{
$projects = $this->getUser()->getProjects();
$user = $this->getUser();
if (!$user instanceof User) {
throw new AccessDeniedException('Vous n\'avez pas accès à cette ressource.');
}
$projects = $user->getProjects();
return $this->render('home/home.html.twig', [
'usemenu' => true,