From f25851b2c5790d2ef946937b68163825c8c8c0e3 Mon Sep 17 00:00:00 2001 From: Mathias Brodala Date: Thu, 27 Aug 2026 11:36:33 +0200 Subject: [PATCH] [FEATURE] Manage content plugin types This adds a new option "plugins" next to "types" for the "tt_content" table which can either be "*" or a list of plugin identifiers. --- Classes/AttachPermissionsToGroups.php | 39 +++++++++++++++++++-------- README.md | 1 + 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Classes/AttachPermissionsToGroups.php b/Classes/AttachPermissionsToGroups.php index 6a30649..9a8485b 100644 --- a/Classes/AttachPermissionsToGroups.php +++ b/Classes/AttachPermissionsToGroups.php @@ -146,21 +146,38 @@ private function expandGroupPermissionsWithPermissionSet(array $group, Permissio if (!empty($fieldNames)) { $group['non_exclude_fields'] .= ',' . implode(',', $fieldNames); } - $contentTypeLimitation = $permissionSet->getConfigurationForResource('tt_content'); - if (isset($contentTypeLimitation['types'])) { - $finishedData = []; - if ($contentTypeLimitation['types'] === '*' || $contentTypeLimitation['types'] === ['*']) { - $allowedContentTypes = array_keys($GLOBALS['TCA']['tt_content']['types']); + + $contentLimitation = $permissionSet->getConfigurationForResource('tt_content'); + $allowedContentTypes = []; + + if (isset($contentLimitation['types'])) { + if ($contentLimitation['types'] === '*' || $contentLimitation['types'] === ['*']) { + $contentTypes = array_keys($GLOBALS['TCA']['tt_content']['types']); + } else { + $contentTypes = $contentLimitation['types']; + } + foreach ($contentTypes as $contentType) { + // needs to be like tt_content:CType:foo_bar + $allowedContentTypes[] = 'tt_content:CType:' . $contentType; + } + } + + if (isset($contentLimitation['plugins'])) { + if ($contentLimitation['plugins'] === '*' || $contentLimitation['plugins'] === ['*']) { + $pluginTypes = array_column($GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['items'] ?? [], 'value'); } else { - $allowedContentTypes = $contentTypeLimitation['types']; + $pluginTypes = $contentLimitation['plugins']; } - foreach ($allowedContentTypes as $allowedContentType) { - // needs to be like tt_content:CType:db_content_keyvisual - // @todo: add support for list_type - $finishedData[] = 'tt_content:CType:' . $allowedContentType; + foreach ($pluginTypes as $pluginType) { + // needs to be like tt_content:list_type:foo_bar + $allowedContentTypes[] = 'tt_content:list_type:' . $pluginType; } - $group['explicit_allowdeny'] .= ',' . implode(',', $finishedData); } + + if ($allowedContentTypes) { + $group['explicit_allowdeny'] .= ',' . implode(',', $allowedContentTypes); + } + $languages = $permissionSet->getAllowedLanguages(); if ($languages) { $group['allowed_languages'] .= ',' . implode(',', $this->expandLanguageInstruction($languages)); diff --git a/README.md b/README.md index 08a1c76..67cf5e1 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ resources: tt_content: fields: "*" types: ["textpic"] + plugins: ["example_details"] ``` Special options: