Skip to main content

Overview

Row-level access control (RLAC) restricts access to individual records based on attributes of the user and the record. Instead of “can read all documents”, it’s “can read documents they own” or “can read documents in their department”.
Several patterns below are not enforced yet. A json-logic condition can only read what the engine puts in the context. Today that is: the acting subject (subject.id, subject.subjectType, subject.meta.*), the resource’s core fields (resource.id, resource.resourceType, resource.ownerScopeId, resource.displayName), the resource’s tags (top-level tags / tagList), the trusted clock (time.*), and any top-level custom context keys. It does not yet expose subject.tags.*, resource.createdBy, resource.ownerId, or resource.meta.*, so patterns using those never grant today (see the roadmap). Two things that work now: for owner-based access use resource ownership (an owns(subject, resource, role) grant) rather than a resource.createdBy condition; for attribute rules use resource tags and subject.meta.*. Also, conditions attach to the role-permission edge (condition), not a permission logic field.

Patterns

Pattern 1: Owner-Based Access

Users can only access resources they own:

Pattern 2: Department-Based Access

Users can access resources in their department:

Pattern 3: Manager Access

Managers can access their reports’ data:

Pattern 4: Project Team Access

Only project team members can access project resources:

Pattern 5: Geographic Restrictions

Access based on region:

Pattern 6: Sensitivity Levels

Access based on clearance:

Combining Conditions

Owner OR Department

Department AND Clearance

Owner OR Manager OR Admin

Implementation Patterns

Pre-Filtering Queries

For list views, pre-filter at the database level:

Post-Filtering Results

For complex conditions, filter after fetching:

Checking Many Resources

There is no bulk evaluate API—call evaluate per resource, in parallel:

Performance Considerations

Cache decisions for the same user/resource/action combinations.
Convert simple conditions to database queries rather than post-filtering.
There is no bulk evaluate API; issue per-resource evaluate calls in parallel and cache decisions for repeated user/resource/action combinations.
Store computed access lists on resources for fast filtering.
Ensure tag assignments are indexed for fast lookups.

Best Practices

Complex nested conditions are hard to debug and slow to evaluate.
Tags are more flexible than hardcoded relationships.
Test with users who have no tags, resources with no tags, etc.
Make it clear to your team how row-level access works.

Next Steps

Conditional Permissions

More JSON Logic patterns

Tag-Based Access

Deep dive into tag-based conditions