Category permission inheritance *appears* to be broken
Users and Roles can not add or edit subcategories unless you permission the top-level category individually. This is true even if the user/role has Edit rights on the Category permission on All Hosts.
Now this may be intentional, but the way the interface works, it looks like it's not.
Example:
-
Login as admin.
-
Grant a user/role
Editrights to theCategorypermission onAll Hosts. -
Select the
Content Types->Categoryscreen and select a top-level category. -
Click on the
Permissionstab.- It shows the user/role is inheriting permissions for the category from
System Host. - It shows that the user/role has
Editrights on the category (checkbox grayed out, but shown as checked).
- It shows the user/role is inheriting permissions for the category from
-
Login as the user/role.
-
Try to add a subcategory or the same top-level category.
- Result: Failure (with the message
Category Cannot be Edited Because User Lacks Permissions.
- Result: Failure (with the message
-
Logout as the user/role.
-
Edit the permissions of the top-level category again.
-
Press the
Permission Individuallybutton.- Note: Don't change any of the permissions - leave them at the inherited defaults.
-
Login as the same user/role as before.
-
Try to add a subcategory of the top-level category again.
- Result: The subcategory is added without problems.
So, even though the permissions for the user/role were not actually changed from the inherited defaults, there is a difference in the actual rights enforced depending on whether those permissions are inherited or set individually on the category.
Again, this may be intentional, but:
- It's not how it appears it should work.
- When permissions are shown as being inherited, it appears that the user/role has the exact same rights as when the inheritance is broken (but they don't).
- It's not how inheritance of permissions works on other objects.
- On other object, just switching from inherited permissions to individual permissions doesn't change the actual rights.
Final Note: I think it would be ideal for categories to be content. This would both make them behave more consistently with everything else, and allow you to do some really useful things with categories (like have different categories for different hosts, assign permissions to add and edit categories based on hosts or folders, handle category push and push dependencies like other content, etc.). Obviously this would be a big change with alot of implications (especially for upgrades), but hopefully at least something to think about.
Note: Assigning a user/role Edit permissions for the Category permission under All Hosts does allow a user to edit subcategories that were already created. But it doesn't allow the user to add new subcategories (either directly or via import), and permissioning a top-level category individually still behaves differently than inheriting the exact same permissions.
For your consideration: https://my.dotcms.com/tickets/detail.dot?id=c02edb78-b0b5-46ee-9298-c48896189fa5
Hi @john-thomas-dotcms,
Thanks for your detailed explanation. I have been addressing this issue, and unfortunately, I have not been able to reproduce it so far with steps provided as part of the ticket. I will connect with you tomorrow to see if we can look at it both together.
After some troubleshooting and understanding/debugging the code, it looks successful creation of Categories is currently governed by following rules:
- Top-level Categories are only meant to be created by users with CMS Administrator role
- Child Categories are able to be created only if the parent category has been individually permissioned. This is NOT currently working.
In trying to understand this issue further, is this ticket proposing any change regarding the rules described above (ie. enhancement over Categories permissioning)?
Another client with problems with this: https://my.dotcms.com/tickets/detail.dot?id=4a8319d7-fb63-47c7-b034-86af3997935b
Update:
Once we try to create children categories, we ask if the current Parent category has the "Add Children" permission, whether this Parent Object:
- Inherits permissions from System Host: For users/roles, "All Children" permission can be added only on "All Sites", not on specific sites/folders.
- It has individual permissions: in this case, Users/Roles DO NOT have the "Add to" box available, so at Category level, a Role cannot get assigned this permission type.
If we select a role and check "Add Children" permission to All Sites, these entries are created for this role
# select * from permission where roleid = '02ae46fa-cb67-4ed8-82d5-f1f9a5e1d744' and inode_id = 'SYSTEM_HOST';
id | permission_type | inode_id | roleid | permission
-------+-----------------------------------------------------+-------------+--------------------------------------+------------
12417 | individual | SYSTEM_HOST | 02ae46fa-cb67-4ed8-82d5-f1f9a5e1d744 | 16
12418 | com.dotmarketing.portlets.categories.model.Category | SYSTEM_HOST | 02ae46fa-cb67-4ed8-82d5-f1f9a5e1d744 | 3
This means that there's an individual permission set with the right permission level (16), however, once a Limited user is trying to create a child category (after setting these permissions), the individual permission is not pulled, and we get only Permission_Type for categories. In this case, required level is 16 but the records pulled from DB/Cache have a lower level (in this case, 3), so it fails.
I believe the issue here is that:
- Permissions are not validated properly from the Global perspective (SYSTEM_HOST).
- Once you create a child category, we should ask for a different permission level for the following scenarios:
- Top level: If it's CMS Admin or if it has "Add Children" Permission.
- Children categories: if it has "Publish" permission, or any Permission Level that can be set directly at User/Role's permission set.
This is a screenshot of how a role's permission was set. See that "Add Children" is set on All Sites, along with Category -> Edit. None of these permissions level allow a limited user to create categories.

PR: https://github.com/dotCMS/core/pull/10673
Hey Guys,
After discussion and development, you will find Pull Request above. As agreed on previous meetings, the expected behavior is like this (which needs to be documented):
- Top-level Categories are only meant to be saved by users with CMS Administrator role
- Child Categories are able to be saved by users granted with "Edit Permissions" permission underneath a Individually Permissioned Category or Categories Globally Permissioned via Role (All Sites). This is what has been fixed.
Furthermore, it was found and fixed general/common issue with permissions at UI side as part of the investigation (potentially fixing un-covered and long-lasting issues when computing the permission bit mask for entities that have certain permissions disabled). This issue was causing the disparity in behavior between (1) Permissionning a Category Individually and (2) Permissionning Categories from Role (All Sites).
Finally, and due to the fix explained in the last paragraph, full QA pass is required over all permissionable Entities -specially the ones with certain types of permissions disabled- in order to ensure that (1) Permissionning a Entity Individually and (2) Permissionning Entities from Role (All Sites) have equivalent behavior.
Thanks, Aníbal
Note to QA: We need to test the same failing scenario described in the issue, which is different behavior between inheriting permissions vs individual, with all other types of assets (containers, templates, content, etc).
http://auth.dotcms.com/docs/latest/category-permissions