What problem does it solve? Collaborative writing platforms need to control who can read, edit, or delete each project, folder, and text individually. A global role system is not enough when the same user is an editor in one project and a viewer in another, and hiding buttons in the UI alone leaves the API exposed to unauthorized requests. ## Core Features & Use Cases - Granular per-resource roles: Assign ADMIN, OWNER, EDITOR, VIEWER, or GUEST roles per project, folder, or text via a resource_permissions table. - Hierarchical permission inheritance: Permissions propagate from project to folder to text, so a project-level editor automatically gains edit rights on nested content unless a more restrictive rule exists. - Backend authorization middleware: An authorize(action, resourceType) middleware validates every data-modifying API route against a permission matrix, returning 403 for unauthorized actions. - Use Case: When building project sharing (UC-081), folder-level permissions (UC-245), or an admin panel (UC-215), apply this skill so a VIEWER sending a direct PATCH request to the API is blocked with 403 Forbidden. ## Quick Start Implement the RBAC authorization middleware with the permission matrix and hierarchical inheritance for the project sharing endpoints.