From 2689f93683af90eb4c7edb4a4431b2e9b4452053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 25 Oct 2023 16:04:44 +0200 Subject: [PATCH] Feat: Add document delete functionality for admins --- .../Admin/Document/DeleteController.php | 37 +++++++++++++++++++ templates/admin/document/index.html.twig | 12 ++++++ 2 files changed, 49 insertions(+) create mode 100644 src/Controller/Admin/Document/DeleteController.php diff --git a/src/Controller/Admin/Document/DeleteController.php b/src/Controller/Admin/Document/DeleteController.php new file mode 100644 index 0000000..d404452 --- /dev/null +++ b/src/Controller/Admin/Document/DeleteController.php @@ -0,0 +1,37 @@ +entityManager->remove($document); + $this->entityManager->flush(); + + $this->addFlash('success', 'Das Dokument wurde gelöscht'); + $this->logger->info('Delete document', [ + 'document_filename' => $document->getOriginalFilename(), + 'owner' => $document->getOwner()->getFullName(), + ]); + + return $this->redirectToRoute('app_admin_document_index'); + } +} \ No newline at end of file diff --git a/templates/admin/document/index.html.twig b/templates/admin/document/index.html.twig index cc3cd10..da25f3e 100644 --- a/templates/admin/document/index.html.twig +++ b/templates/admin/document/index.html.twig @@ -66,6 +66,18 @@
+ {% if is_granted('DELETE', upload) %} + + {% endif %} {% if is_granted('CHECK', upload) %}