diff --git a/Classes/Controller/FrontEndEditorController.php b/Classes/Controller/FrontEndEditorController.php
index f71cbbc..e79dd55 100644
--- a/Classes/Controller/FrontEndEditorController.php
+++ b/Classes/Controller/FrontEndEditorController.php
@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace TTN\Tea\Controller;
use Psr\Http\Message\ResponseInterface;
+use TTN\Tea\Domain\Model\Product\Tea;
use TTN\Tea\Domain\Repository\Product\TeaRepository;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
@@ -41,4 +42,32 @@ class FrontEndEditorController extends ActionController
{
return $this->context->getPropertyFromAspect('frontend.user', 'id');
}
+
+ public function editAction(Tea $tea): ResponseInterface
+ {
+ $this->checkIfUserIsOwner($tea);
+
+ $this->view->assign('tea', $tea);
+
+ return $this->htmlResponse();
+ }
+
+ /**
+ * @throws \RuntimeException
+ */
+ private function checkIfUserIsOwner(Tea $tea): void
+ {
+ if ($tea->getOwnerUid() !== $this->getUidOfLoggedInUser()) {
+ throw new \RuntimeException('You do not have the permissions to edit this tea.', 1687363749);
+ }
+ }
+
+ public function updateAction(Tea $tea): ResponseInterface
+ {
+ $this->checkIfUserIsOwner($tea);
+
+ $this->teaRepository->update($tea);
+
+ return $this->redirect('index');
+ }
}
diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf
index 9875a07..5a9716f 100644
--- a/Resources/Private/Language/de.locallang.xlf
+++ b/Resources/Private/Language/de.locallang.xlf
@@ -43,6 +43,30 @@
Titel
+
+
+ Beschreibung
+
+
+
+ Tee bearbeiten
+
+
+
+ Aktionen
+
+
+
+ Bearbeiten
+
+
+
+ Abbrechen
+
+
+
+ Speichern
+