private TermMatcher createUserTermMatcher(final ExplorerNode node) {
        return (queryField, condition, termValue, docRef) -> {
            if (docRef == null) {
                return false;
            }

            final DocumentPermission permission = documentPermissionService
                    .getPermission(
                            node.getDocRef(),
                            UserRef.builder().uuid(docRef.getUuid()).build());

            return switch (condition) {
                case USER_HAS_PERM -> permission != null;
                case USER_HAS_OWNER -> DocumentPermission.OWNER.equals(permission);
                case USER_HAS_DELETE -> DocumentPermission.DELETE.equals(permission);
                case USER_HAS_EDIT -> DocumentPermission.EDIT.equals(permission);
                case USER_HAS_VIEW -> DocumentPermission.VIEW.equals(permission);
                case USER_HAS_USE -> DocumentPermission.USE.equals(permission);
                default -> false;
            };
        };
    }
Create a map of folders and their child items.
stroom-explorer/stroom-explorer-impl/src/main/java/stroom/explorer/impl/ExplorerServiceImpl.java