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”.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:Bulk Evaluation
Evaluate multiple resources at once:Performance Considerations
Cache permission evaluations
Cache permission evaluations
Cache decisions for the same user/resource/action combinations.
Pre-filter when possible
Pre-filter when possible
Convert simple conditions to database queries rather than post-filtering.
Use bulk evaluation
Use bulk evaluation
Evaluate multiple resources in one call rather than individual calls.
Denormalize for read performance
Denormalize for read performance
Store computed access lists on resources for fast filtering.
Index tag assignments
Index tag assignments
Ensure tag assignments are indexed for fast lookups.
Best Practices
Keep conditions simple
Keep conditions simple
Complex nested conditions are hard to debug and slow to evaluate.
Use tags for flexible classification
Use tags for flexible classification
Test edge cases
Test edge cases
Test with users who have no tags, resources with no tags, etc.
Document your access model
Document your access model
Make it clear to your team how row-level access works.