Company
Date Published
Author
Gavin Ray
Word count
1014
Language
English
Hacker News points
None

Summary

Implementing a hierarchical authorization system similar to Google Drive within Hasura involves utilizing a role and permissions model that supports both hierarchical roles and dynamic access controls. The system is designed for complex scenarios where users, organized into teams, work on projects with assigned folder access, allowing permissions to be inherited through a parent-child relationship unless overridden by specific rules. A database schema featuring tables for users, folders, teams, and permissions is employed to structure the data, with SQL views dynamically generating a flattened view of the folder-user-access level relationships to accommodate unknown relationship depths. Hasura's permission clauses are then configured using JSON structures to allow or restrict user actions based on their access type and user ID, effectively managing hierarchical and individual folder access permissions.