Skip to content
Snippets Groups Projects
Commit 7c5c26eb authored by Christoph Lehmann's avatar Christoph Lehmann Committed by Oliver Hader
Browse files

[BUGFIX] Make category tree filterable for editors with category mounts

TCEFORM.pages.categories.config.treeConfig.rootUid should filter
the category tree. Non-Admin users with category mounts currently
need every child category of rootUid in their category mounts
since the rootline of rootUid is not checked against the category
mounts.

Resolves: #78274
Releases: master,8.7,7.6
Change-Id: Id02ae69111df7397207939a034ed05797eb160ad
Reviewed-on: https://review.typo3.org/54138


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarOliver Hader <oliver.hader@typo3.org>
Tested-by: default avatarOliver Hader <oliver.hader@typo3.org>
parent f8ecea00
Branches
Tags
No related merge requests found
...@@ -65,6 +65,15 @@ class CategoryPermissionsAspect ...@@ -65,6 +65,15 @@ class CategoryPermissionsAspect
if (!empty($categoryMountPoints) && !empty($treeNodeCollection)) { if (!empty($categoryMountPoints) && !empty($treeNodeCollection)) {
// Check the rootline against categoryMountPoints when tree was filtered
if ($dataProvider->getRootUid() !== null) {
$uidsInRootline = $this->findUidsInRootline($dataProvider->getRootUid());
if (!empty(array_intersect($categoryMountPoints, $uidsInRootline))) {
// One of the parents was found in categoryMountPoints so all children are secure
return;
}
}
// First, remove all child nodes which must be analysed to be considered as "secure". // First, remove all child nodes which must be analysed to be considered as "secure".
// The nodes were backed up in variable $treeNodeCollection beforehand. // The nodes were backed up in variable $treeNodeCollection beforehand.
$treeData->removeChildNodes(); $treeData->removeChildNodes();
...@@ -118,4 +127,20 @@ class CategoryPermissionsAspect ...@@ -118,4 +127,20 @@ class CategoryPermissionsAspect
} }
return $result; return $result;
} }
/**
* Find parent uids in rootline
*
* @param integer $uid
* @return array
*/
protected function findUidsInRootline($uid) {
$row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('parent', $this->categoryTableName, 'uid=' . (int)$uid);
$parentUids = [];
if ($row['parent'] > 0) {
$parentUids = $this->findUidsInRootline($row['parent']);
$parentUids[] = $row['parent'];
}
return $parentUids;
}
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment