Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions Classes/AttachPermissionsToGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ resources:
tt_content:
fields: "*"
types: ["textpic"]
plugins: ["example_details"]
```

Special options:
Expand Down
Loading