From 1f31a3a33fe00d62b226a68d09b65dfaa654ff88 Mon Sep 17 00:00:00 2001 From: matthieu Date: Sun, 15 Mar 2026 21:37:18 +0100 Subject: [PATCH] fix(portal) : embed project id/name in /me response for client users Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/pages/portal/index.vue | 9 ++++----- src/Entity/Project.php | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/frontend/pages/portal/index.vue b/frontend/pages/portal/index.vue index f9e4e01..ee2ac1a 100644 --- a/frontend/pages/portal/index.vue +++ b/frontend/pages/portal/index.vue @@ -68,13 +68,12 @@ async function loadData() { isLoading.value = true try { if (auth.user?.roles?.includes('ROLE_ADMIN')) { - // Admin sees all projects - const allProjects = await projectService.getAll({ archived: false }) - projects.value = allProjects + projects.value = await projectService.getAll({ archived: false }) } else { - // Client sees allowed projects - projects.value = auth.user?.allowedProjects ?? [] + // allowedProjects are embedded objects from /api/me (with me:read group) + projects.value = (auth.user?.allowedProjects ?? []) as Project[] } + tickets.value = await clientTicketService.getAll() } finally { isLoading.value = false diff --git a/src/Entity/Project.php b/src/Entity/Project.php index ec19473..74e5fa8 100644 --- a/src/Entity/Project.php +++ b/src/Entity/Project.php @@ -41,7 +41,7 @@ class Project #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] - #[Groups(['project:read', 'time_entry:read', 'task:read'])] + #[Groups(['project:read', 'time_entry:read', 'task:read', 'me:read'])] private ?int $id = null; #[ORM\Column(length: 10, unique: true)] @@ -51,7 +51,7 @@ class Project private ?string $code = null; #[ORM\Column(length: 255)] - #[Groups(['project:read', 'project:write', 'time_entry:read', 'task:read'])] + #[Groups(['project:read', 'project:write', 'time_entry:read', 'task:read', 'me:read'])] private ?string $name = null; #[ORM\Column(type: 'text', nullable: true)]