fix : allow admin users to create client tickets on any project
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user