Migration modular monolith DDD (0.1 → 3.3) #17

Merged
matthieu merged 99 commits from integration/modular-monolith-0.1-1.3 into develop 2026-06-23 13:50:43 +00:00
Showing only changes of commit a76facbf4c - Show all commits
@@ -50,6 +50,12 @@ final readonly class AbsenceCancelProcessor implements ProcessorInterface
$isAdmin = $this->security->isGranted('ROLE_ADMIN');
$status = $data->getStatus();
// Authorize before mutating the balance: an employee may only cancel
// their own request (admins can cancel any).
if (!$isAdmin && $data->getUser() !== $user) {
throw new AccessDeniedHttpException('You can only cancel your own requests.');
}
if (AbsenceStatus::Pending === $status) {
$this->balanceService->release($data, false);
} elseif (AbsenceStatus::Approved === $status) {
@@ -61,11 +67,6 @@ final readonly class AbsenceCancelProcessor implements ProcessorInterface
throw new ConflictHttpException('This request can no longer be cancelled.');
}
// An employee may only cancel their own request (admins can cancel any).
if (!$isAdmin && $data->getUser() !== $user) {
throw new AccessDeniedHttpException('You can only cancel your own requests.');
}
$data->setStatus(AbsenceStatus::Cancelled);
$this->entityManager->flush();