fix(portal) : embed project id/name in /me response for client users
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -68,13 +68,12 @@ async function loadData() {
|
|||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
try {
|
try {
|
||||||
if (auth.user?.roles?.includes('ROLE_ADMIN')) {
|
if (auth.user?.roles?.includes('ROLE_ADMIN')) {
|
||||||
// Admin sees all projects
|
projects.value = await projectService.getAll({ archived: false })
|
||||||
const allProjects = await projectService.getAll({ archived: false })
|
|
||||||
projects.value = allProjects
|
|
||||||
} else {
|
} else {
|
||||||
// Client sees allowed projects
|
// allowedProjects are embedded objects from /api/me (with me:read group)
|
||||||
projects.value = auth.user?.allowedProjects ?? []
|
projects.value = (auth.user?.allowedProjects ?? []) as Project[]
|
||||||
}
|
}
|
||||||
|
|
||||||
tickets.value = await clientTicketService.getAll()
|
tickets.value = await clientTicketService.getAll()
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Project
|
|||||||
#[ORM\Id]
|
#[ORM\Id]
|
||||||
#[ORM\GeneratedValue]
|
#[ORM\GeneratedValue]
|
||||||
#[ORM\Column]
|
#[ORM\Column]
|
||||||
#[Groups(['project:read', 'time_entry:read', 'task:read'])]
|
#[Groups(['project:read', 'time_entry:read', 'task:read', 'me:read'])]
|
||||||
private ?int $id = null;
|
private ?int $id = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 10, unique: true)]
|
#[ORM\Column(length: 10, unique: true)]
|
||||||
@@ -51,7 +51,7 @@ class Project
|
|||||||
private ?string $code = null;
|
private ?string $code = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 255)]
|
#[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;
|
private ?string $name = null;
|
||||||
|
|
||||||
#[ORM\Column(type: 'text', nullable: true)]
|
#[ORM\Column(type: 'text', nullable: true)]
|
||||||
|
|||||||
Reference in New Issue
Block a user