Project

General

Profile

Actions

Bug #102015

open

Incorrect behavior of TCEFORM treeConfig.startingPoints

Added by Robert von Hackwitz about 1 year ago. Updated 24 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Start date:
2023-09-22
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.2
Tags:
pagetree
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

When you create a category tree by assigning the category mount to a group of non-privileged users
and at the same time using the TCEFORM treeConfig.startingPoints option, only the parent category is displayed.
In the example (of which I attach screenshots) I created a tree of categories and subcategories,
I assigned a category in the category mount point of the BE user group and in the root page of the site I
used TCEFORM.sys_category.parent.config.treeConfig.startingPoints=2581 option (where 2581 is the Uid of the "Main Root category" category).
When the non-privileged user belonging to the group tries to create a new category in the "parent" tree only "Main Root Category" appears.
If I don't use TCEFORM.sys_category.parent.config.treeConfig.startingPoints=2581 or if the user is a TYPO3 admin then TCEFORM.sys_category.parent.config.treeConfig.startingPoints=2581 works fine


Files

Backend_usergroup_CategoryMounts.png (32.6 KB) Backend_usergroup_CategoryMounts.png Robert von Hackwitz, 2023-09-22 12:07
UnprivilgedUser_CategoryCreation.png (12 KB) UnprivilgedUser_CategoryCreation.png Robert von Hackwitz, 2023-09-22 12:07
patch_102015.patch (1.55 KB) patch_102015.patch Uwe Wiebach, 2024-10-28 14:22

Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #102034: The treeConfig.startingPoints parameter does not work correctly in TYPO3 v 12 (Related to https://forge.typo3.org/issues/102015)New2023-09-25

Actions
Actions #1

Updated by Robert von Hackwitz about 1 year ago

  • Target version changed from next-patchlevel to Candidate for patchlevel
Actions #2

Updated by Andreas Kienast about 1 year ago

  • Related to Bug #102034: The treeConfig.startingPoints parameter does not work correctly in TYPO3 v 12 (Related to https://forge.typo3.org/issues/102015) added
Actions #3

Updated by Robert von Hackwitz about 1 year ago

Hi,
after a bit of investigation I think there is something wrong in
TYPO3\CMS\Backend\Security\CategoryPermissionsAspect around lines 70-86

               foreach ($startingPoints as $startingPoint) {

                        if (!in_array($startingPoint, $categoryMountPoints)) {
                            $shallRepopulateTree = true;
                            break;
                        }
                        $uidsInRootline = $this->findUidsInRootline($startingPoint);
                        if (empty(array_intersect($categoryMountPoints, $uidsInRootline))) {
                            $shallRepopulateTree = true;
                            break;
                        }
                }

With the for loop we check whether startingpoints are present in the user's categorymounts,
but the starting points can be (as in my case) subcategories of a category mount points so the if statement is false, the variable $shallRepopulateTree is set to true and the cycle is interrupted, causing the reconstruction of the tree without the categories corresponding to the starting point

Actions #4

Updated by Uwe Wiebach 6 months ago ยท Edited

It's definitely this part, because if I comment it out, the tree is built up correctly.

So I dug deeper:
If the starting point (or back then the rootUid) is a category mount point before the changes for https://forge.typo3.org/issues/95037 the tree wasn't touched.

                    if (in_array($dataProvider->getRootUid(), $categoryMountPoints)) {
                        return;
                    }

Now its rootline is also checked and that's where it all goes wrong...

I'm sure this needs more testing but in my case this worked:

                foreach ($startingPoints as $startingPoint) {
                    if (in_array($startingPoint, $categoryMountPoints)) {
                        $shallRepopulateTree = false;
                        break;
                    }
                    $uidsInRootline = $this->findUidsInRootline($startingPoint);
                    if (!empty(array_intersect($categoryMountPoints, $uidsInRootline))) {
                        $shallRepopulateTree = false;
                        break;
                    }
                    $shallRepopulateTree = true;
                }

Maybe this $shallRepopulateTree = false; isn't needed as false is the inital value.

EDIT:
This only works if a starting point is set... So I changed it to:

                foreach ($startingPoints as $startingPoint) {
                    if ($startingPoint) {
                        if (in_array($startingPoint, $categoryMountPoints)) {
                            $shallRepopulateTree = false;
                            break;
                        }
                        $uidsInRootline = $this->findUidsInRootline($startingPoint);
                        if (!empty(array_intersect($categoryMountPoints, $uidsInRootline))) {
                            $shallRepopulateTree = false;
                            break;
                        }
                        $shallRepopulateTree = true;
                    }
                }

Actions #5

Updated by Garvin Hicking 6 months ago

  • Tags set to pagetree
Actions #6

Updated by Uwe Wiebach 3 months ago

  • File patch_102015.diff added

Added my changes as a patch...

Actions #7

Updated by Uwe Wiebach 24 days ago

  • File deleted (patch_102015.diff)
Actions #8

Updated by Uwe Wiebach 24 days ago

Unfortunately, I have only just realized that the patch file was faulty. This one should be correct...

Actions

Also available in: Atom PDF