diff --git a/contao/templates/backend/wk_sync/inbox.html.twig b/contao/templates/backend/wk_sync/inbox.html.twig
index 6bda421..90f2376 100644
--- a/contao/templates/backend/wk_sync/inbox.html.twig
+++ b/contao/templates/backend/wk_sync/inbox.html.twig
@@ -60,7 +60,9 @@
{% for line in item.dataLines %}{{ line|nl2br }}{% if not loop.last %}
{% endif %}{% endfor %}
- {{ 'MSC.wk_sync.inbox.edit'|trans }}
+ {% if row.edit_url %}
+ {{ 'MSC.wk_sync.inbox.edit'|trans }}
+ {% endif %}
{% for target in row.targets %}
{% endfor %}
diff --git a/src/Backend/WkSyncBackend.php b/src/Backend/WkSyncBackend.php
index 2c26901..3cc83ed 100644
--- a/src/Backend/WkSyncBackend.php
+++ b/src/Backend/WkSyncBackend.php
@@ -13,6 +13,7 @@ use Contao\CoreBundle\Exception\RedirectResponseException;
use Contao\CoreBundle\Exception\ResponseException;
use Contao\CoreBundle\Framework\Adapter;
use Contao\CoreBundle\Framework\ContaoFramework;
+use Contao\CoreBundle\Security\ContaoCorePermissions;
use Contao\Date;
use Contao\Message;
use Contao\StringUtil;
@@ -223,12 +224,18 @@ class WkSyncBackend
$items = $this->inbox->findByState($state, $state->isFinal() ? 300 : 0);
$referer = (string) $request->attributes->get('_contao_referer_id', '');
+ // „Bearbeiten“ führt in die Module Anmeldungen/Kontaktanfragen; ohne Zugriff darauf gäbe es einen 403, also kein Button
+ $canEdit = [
+ true => $this->security->isGranted(ContaoCorePermissions::USER_CAN_ACCESS_MODULE, self::MODULE_BOOKINGS),
+ false => $this->security->isGranted(ContaoCorePermissions::USER_CAN_ACCESS_MODULE, self::MODULE_INQUIRIES),
+ ];
+
$decorated = [];
foreach ($items as $item) {
$decorated[] = [
'item' => $item,
- 'edit_url' => $this->editUrl($item, $referer),
+ 'edit_url' => $canEdit[$item->isBooking()] ? $this->editUrl($item, $referer) : '',
'targets' => $state->moveTargets(),
];
}
|