Skip to content

Fix Content Drive folder tree hiding readable folders from non-admin users #37749

Description

@Neehakethi
Screen.Recording.2026-09-25.at.12.07.06.PM.mov

Problem Statement

The Content Drive folder tree (left sidebar) hides folders from non-admin users who have READ on them. The same folders appear for the same user in the classic Site Browser. Users with the CMS Administrator role are not affected. The missing folders come back as soon as something checks them one at a time, so the symptom looks intermittent, and it hits every non-admin user at once.

The endpoint response is already missing the folders; the front end is not involved.

Cause. Since #36638 the tree loads each level from GET /api/v1/folder/search. FolderAPIImpl.searchFolders filters READ with the batch overload PermissionAPI.filterCollection(Collection, int, User, boolean) (FolderAPIImpl.java#L818), which resolves permissions through PermissionBitFactoryImpl.getPermittedIds (PermissionBitAPIImpl.java#L1415-L1461). That query (PermissionBitFactoryImpl.java#L2749-L2762) grants READ in only two ways:

  1. a permission_reference row for the folder, joined to the permissions of the parent it inherits from, or
  2. individual permissions on the folder itself.

permission_reference is a lazily built cache. The per-object path (doesUserHavePermission → loadPermissions) writes a row only after walking up to the parent permissionable (PermissionBitFactoryImpl.java#L1715-L1747, async by default via PERMISSION_REFERENCES_UPDATE_ASYNC), and rows are deleted when permissions change on an ancestor. A folder that inherits its permissions and has no row yet matches neither branch and is dropped; the batch path never falls back to the parent walk-up. The Site Browser uses the per-object check, so it is unaffected, and using it back-fills the rows, after which Content Drive shows the folders.

CMS Administrators skip the filter entirely (PermissionBitAPIImpl.java#L1432-L1436), which is why they never see the problem.

Steps to Reproduce

Reproduced on demo.dotcms.com (26.09.24-01) as the stock non-admin backend user Joe Contributor, who has Content Drive access. No permission was changed between steps.

  1. As the non-admin user, call the endpoint the tree uses for one level:
    GET /api/v1/folder/search?siteId=48190c8c-42c4-46af-8d1a-0cd5db894797&path=/application/&recursive=false&orderby=name&direction=ASC&includePermissions=true&page=1&per_page=40
    Result: 5 folders. Opening Content Drive and expanding application in the tree shows the same 5: apivtl, containers, templates, themes, vtl.
  2. As the same user, list the same level through the per-object permission check (the deprecated endpoint the tree used before [BUG] Content Drive: Folder tree caps each level at 40 folders (folders beyond 40 are inaccessible) #36638):
    POST /api/v1/folder/byPath with body {"path":"//demo.dotcms.com/application/"}
    Result: 7 folders, adding block-editor and wysiwyg.
  3. Repeat step 1. Result: 7 folders. Reload Content Drive and expand application: all 7 are shown.

The same happened at the site root: path=/ returned 10 folders, byPath on the root returned 12 (adding events and search), and path=/ then returned 12.

Also observed on an Evergreen Cloud customer instance (build dated 2026-09-02): a recursive folder/search over the whole site returned 61 folders for a non-admin user. After the per-object check ran on each level, the same call returned 90, with all 27 previously missing folders restored.

Not separately verified: a controlled trigger. From the code, any permission change on a site or parent folder should delete the reference rows below it and hide inheriting subfolders from Content Drive until each one is checked individually.

Acceptance Criteria

  • GET /api/v1/folder/search returns every folder a non-admin user can READ according to PermissionAPI.doesUserHavePermission, including folders that inherit permissions and have no permission_reference row.
  • Immediately after a permission change on a site or parent folder, a non-admin user sees the same folders in the Content Drive tree as in the Site Browser, without anyone opening the Site Browser first.
  • Folders that already have a reference row or individual permissions still resolve in one batch query (no per-folder N+1; see Batch folder permission resolution into a single round-trip per page #36940).
  • The EDIT / PUBLISH / EDIT_PERMISSIONS / CAN_ADD_CHILDREN sets built in resolvePagePermissions are correct for the same folders.
  • Other callers of the batch filterCollection(Collection, int, User, boolean) overload are checked for the same gap.
  • Integration test: a subfolder inheriting READ from its parent, with no permission_reference row, is returned by folder/search for a non-admin user.

dotCMS Version

Severity

Medium - Some functionality impacted

Links

Activity

  1. added theissue type on Sep 25, 2026
  2. zJaaal commented on Sep 30, 2026

    @zJaaal
    Member

    It also happens after duplicating a folder in Content Drive (the new bulk folder duplicate, PR #37761), and there it reproduces every time rather than intermittently.

    A duplicate is a brand-new folder that inherits its permissions and has none of its own, so it has no permission_reference row when the run completes. For a non-admin, the folder search behind the tree drops it until a per-object check writes that row.

    Reproduced on a scout test environment, as a non-admin backend user with READ and add-children on the parent folder:

    1. Right-click a folder in Content Drive and choose Duplicate.
    2. When the run completes, the tree reloads that level through GET /api/v1/folder/search. The response leaves out the copy: 4 folders instead of 5.
    3. The Content Drive listing, reloaded a moment later, does show the copy.
    4. Seconds later the same folder search returns all 5, but the tree stays stale until something reloads it.

    A CMS Administrator never sees it, as described above: the copy appears in the tree at once.

    So a fix here also fixes the tree after a duplicate. Nothing needs to change in the duplicate itself: the tree reloads at the right moment, and the endpoint's answer is what's missing the folder.

    Comment written by Claude (Claude Code) on behalf of @zJaaal.

  3. self-assigned this
    on Oct 15, 2026
  4. moved this from Next Sprint to In Progress in dotCMS - Product Planningon Oct 16, 2026
  5. removed their assignment
    on Nov 5, 2026
  6. moved this from In Progress to QA in dotCMS - Product Planningon Nov 5, 2026
  7. moved this from QA to In Progress in dotCMS - Product Planningon Nov 9, 2026
  8. moved this from In Progress to Current Sprint Backlog in dotCMS - Product Planningon Nov 9, 2026
  9. self-assigned this
    on Nov 23, 2026
  10. moved this from Current Sprint Backlog to In Progress in dotCMS - Product Planningon Nov 23, 2026
  11. removed their assignment
    on Nov 24, 2026
  12. moved this from In Progress to QA in dotCMS - Product Planningon Nov 24, 2026
  13. self-assigned this
    on Nov 24, 2026
  14. zJaaal commented on Nov 24, 2026

    @zJaaal
    Member

    QA Passed

    Screen.Recording.2026-11-24.at.10.28.04.AM.mov
  15. removed their assignment
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions