feat: comprehensive audit log
This commit is contained in:
1 parent
867bd413c8
commit
02e0d672bd
20 files changed
+932
-82
No files matched your search
@@ -9,8 +9,8 @@ use App\Form\Admin\ResourceFormType;
|
||||
use App\Htmx\HxRedirectResponse;
|
||||
use App\Repository\BookingRepository;
|
||||
use App\Security\Role;
|
||||
use App\Service\AuditLogger;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -31,7 +31,7 @@ final class EditController extends AbstractController
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $em,
|
||||
private readonly BookingRepository $bookings,
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly AuditLogger $audit,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -49,13 +49,7 @@ final class EditController extends AbstractController
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$this->em->flush();
|
||||
|
||||
$this->logger->info('Admin edited a resource.', [
|
||||
'admin' => $this->getUser()?->getUserIdentifier(),
|
||||
'resource_id' => $resource->getId(),
|
||||
'label' => $resource->getLabel(),
|
||||
'group' => $resource->getGroup()?->getLabel(),
|
||||
'active' => $resource->isActive(),
|
||||
]);
|
||||
$this->audit->resourceUpdated($resource, $wasActive);
|
||||
|
||||
$remaining = $wasActive && !$resource->isActive()
|
||||
? $this->bookings->countFromDate($resource, new \DateTimeImmutable('today'))
|
||||
|
||||
Reference in new issue
Block a user