[#NUMERO_TICKET] TITRE TICKET #2

Merged
malio merged 302 commits from develop into main 2026-03-18 13:16:19 +00:00
Showing only changes of commit 6d7e6f5f48 - Show all commits

View File

@@ -35,17 +35,20 @@ final readonly class ClientTicketNumberProcessor implements ProcessorInterface
$user = $this->security->getUser();
assert($user instanceof User);
if (null === $user->getClient()) {
throw new AccessDeniedHttpException('Only client users can create tickets.');
}
$project = $data->getProject();
if (null === $project) {
throw new BadRequestHttpException('Project is required.');
}
if (!$user->getAllowedProjects()->contains($project)) {
throw new AccessDeniedHttpException('You do not have access to this project.');
// Admins can create tickets on any project; clients only on allowed projects
if (!$this->security->isGranted('ROLE_ADMIN')) {
if (null === $user->getClient()) {
throw new AccessDeniedHttpException('Only client users can create tickets.');
}
if (!$user->getAllowedProjects()->contains($project)) {
throw new AccessDeniedHttpException('You do not have access to this project.');
}
}
$nextNumber = $this->clientTicketRepository->findNextNumberForProject($project);