Category tree only shows first category in records categories tab if permission category is only checked for first level
How to reproduce :
- Add a category with sub-categories
- Create a backend user group and set 'category_perms' with only first category checked (see capture)
- Add this group to a non-admin user
- Edit a record with 'categories' tab allowed
You should see the selected category and the sub-categories but instead, you only see the selected category (see capture).
If the category checked in the 'category_perms' of the user group is at a second level, it works as expected.
It's because in file CategoryPermissionsAspect::addUserPermissionsToCategoryTreeData() , when method lookUpCategoryMountPointInTreeNodes() is called, it looks only for category mount point in subcategories, first category is ignored and subcategories are never added to tree.