autorizacao-rbac-por-recurso

Implements role-based access control with per-resource permission checks and hierarchical inheritance.

Updated Jul 19, 2026
One-click install
npx skills add https://github.com/Ryanzucchi/Eldritch_Lich --skill autorizacao-rbac-por-recurso-ryanzucchi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: autorizacao-rbac-por-recurso
Source: https://github.com/Ryanzucchi/Eldritch_Lich/tree/main/.agents/skills/autorizacao-rbac-por-recurso
Command: npx skills add https://github.com/Ryanzucchi/Eldritch_Lich --skill autorizacao-rbac-por-recurso-ryanzucchi

SYSTEM DOCUMENTATION & REQUIREMENTS

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.

Frequently Asked Questions about autorizacao-rbac-por-recurso

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement role-based access control per resource in an API?▼

Create a resource_permissions table storing user_id, resource_type, resource_id, and role, then add an authorize(action, resourceType) middleware to every route. The middleware looks up the user's role and checks it against an immutable permission matrix before allowing the operation.

How does hierarchical permission inheritance work for nested resources?▼

Permissions propagate from project to folder to text. If no direct permission record exists for a resource, the system checks the parent folder, then the parent project, and applies the role found there unless a more restrictive explicit permission exists on the child.

Is hiding edit buttons in the frontend enough for authorization security?▼

No. Hiding UI elements is only a usability measure, not a security control. Authorization must be enforced in backend middleware on every data-modifying route, otherwise users can send direct API requests to modify resources they should not access.

What roles should a collaborative editing platform support?▼

This design uses five roles: ADMIN and OWNER with full read, write, delete, and member management; EDITOR with read and write; and VIEWER and GUEST with read-only access. The creator of a project defaults to OWNER and invited users default to VIEWER.

When should I use per-resource RBAC instead of tenant-level isolation?▼

Use per-resource RBAC when the same user needs different roles across resources within one tenant, such as editor in one project and viewer in another. For isolating data between different tenants, use database row-level security instead.