What are Resource Hierarchies?
Resource hierarchies allow you to model parent-child relationships between resources. A folder contains documents, a project contains tasks, an order contains line items. These relationships enable hierarchical permission propagation and structured queries.Hierarchy Edge Properties
Cascade Modes
Thecascade property controls how permissions propagate through the hierarchy:
Inherit
A permission patterned to a parent resource can grant access to that resource’s descendants:cascade: "inherit", when a child resource is evaluated and direct RBAC denies, the engine walks up the inherit edges to the child’s ancestors. Access is granted if the subject holds a permission whose resourceType matches the child’s type (or *) and whose resourcePattern is an ancestor’s resource id.
None
No permission inheritance—child resources require explicit access:cascade: "none":
- Parent access does not grant child access
- Each resource requires its own permissions
- Ideal for references, links, dependencies
Creating Resource Hierarchies
Resource Type Hierarchies
Before creating resource hierarchies, define which resource types can contain which:Hierarchical Permission Patterns
Pattern 1: Grant Access to a Folder’s Contents
Grantread on everything beneath a folder by patterning a permission to the folder’s id (typed to the child, or *). The engine applies it automatically when a document inside is evaluated:
Pattern 2: Nested Inheritance
Inheritance walks the full ancestor chain, so a permission patterned to a top-level container reaches everything beneath it (as long as the edges arecascade: "inherit"):
Inheritance is driven by the ancestor resourcePattern, not a condition. There is no
resource.parentId or subject.accessibleFolders in the condition context—don’t model
hierarchy access with a logic condition.Common Hierarchy Patterns
Document Management
Project Management
E-Commerce
Construction
Querying Hierarchies
Relationship Types
UserelationshipType to distinguish different kinds of relationships:
Best Practices
Define type hierarchies first
Define type hierarchies first
Always define resource type hierarchies before creating resource instance hierarchies.
Use meaningful relationship types
Use meaningful relationship types
Choose relationship types that reflect your domain model.
Avoid deep nesting
Avoid deep nesting
Very deep hierarchies can impact query performance. Consider flattening when possible.
Consider permission implications
Consider permission implications
Plan how permissions will propagate through your hierarchy before building it.
Ancestor Traversal
When evaluating permissions withcascade: "inherit", the engine traverses ancestors:
Next Steps
Resource Scope Links
Associate resources with multiple scopes
Resource Policies
Fine-grained access control on resources