QualityDocD enforces access control at two independent layers. The primary .NET MVC application uses ASP.NET Core cookie authentication with five string-based roles stored in the SQL ServerDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/juescoryisus/QualityDocD/llms.txt
Use this file to discover all available pages before exploring further.
Users table. The companion Node.js API uses JWT authentication with a separate six-level role hierarchy and a module-based permission system backed by its own PostgreSQL users table. The two systems are designed for different audiences — the .NET app is used by internal document managers, while the Node.js API serves multi-tenant company integrations — but both must be satisfied for end-to-end document workflows to complete.
Part 1 — .NET MVC App Roles
TheUser model stores the role as a plain string with a database default of "Viewer". There are five valid role values: Admin, Manager, Reviewer, Editor, and Viewer. ASP.NET Core’s [Authorize(Roles = "...")] attribute on controller actions enforces these at the HTTP level before any service method is invoked.
Role Definitions
Admin — Full System Access
Admin — Full System Access
Admins have unrestricted access to all controller actions. In addition to every permission granted to Manager and Reviewer, Admins can:
- Export raw MongoDB metadata via the
MongoJsonendpoint ([Authorize(Roles = "Admin")]) - Access all compliance and audit reports
- Manage users and system configuration
[Authorize(Roles = "Admin")]Manager — Lifecycle and Compliance
Manager — Lifecycle and Compliance
Managers can drive every stage of the document lifecycle short of raw data export. Specific permissions include:
- Approve, reject, and request changes on documents under review
- Mark documents as
Obsolete([Authorize(Roles = "Admin,Manager")]) - Access compliance reports and audit logs
[Authorize(Roles = "Admin,Manager")] for obsolete; [Authorize(Roles = "Admin,Manager,Reviewer")] for approval actionsReviewer — Approval Decisions
Reviewer — Approval Decisions
Reviewers participate in the document approval workflow. They can:
- Approve a document under review (moves document to
Approvedwhen all reviewers agree) - Reject a document (moves document to
Rejected— requires a comment) - Request changes (moves document to
PendingChanges— requires a comment)
[Authorize(Roles = "Admin,Manager,Reviewer")]Editor — Create and Edit Documents
Editor — Create and Edit Documents
Editors can create new documents and edit existing ones, but only when the document is in a state that allows editing. The controller enforces:Editors cannot perform approval actions or mark documents obsolete.
Viewer — Read-Only Access
Viewer — Read-Only Access
The default role assigned to every new user (
Role = "Viewer" in User.cs). Viewers can:- Browse and filter the document index
- Read document details
- Download approved document files via
GET /Documents/Download/{id}
.NET Permission Matrix
| Action | Admin | Manager | Reviewer | Editor | Viewer |
|---|---|---|---|---|---|
| View document list & details | ✅ | ✅ | ✅ | ✅ | ✅ |
| Download document file | ✅ | ✅ | ✅ | ✅ | ✅ |
| Create document | ✅ | ✅ | ✅ | ✅ | ✅ |
Edit document (Draft / PendingChanges) | ✅ | ✅ | ✅ | ✅ | ✅ |
| Submit document for review | ✅ | ✅ | ✅ | ✅ | ✅ |
| Approve document | ✅ | ✅ | ✅ | ❌ | ❌ |
| Reject document | ✅ | ✅ | ✅ | ❌ | ❌ |
| Request changes | ✅ | ✅ | ✅ | ❌ | ❌ |
| Mark document Obsolete | ✅ | ✅ | ❌ | ❌ | ❌ |
| Export raw MongoDB metadata | ✅ | ❌ | ❌ | ❌ | ❌ |
| Compliance reports | ✅ | ✅ | ✅ | ❌ | ❌ |
Controller Authorization Decorators
TheDocumentsController applies [Authorize] at the class level (all authenticated users) and narrows specific actions with role-scoped attributes:
The
[Authorize] attribute on the class-level means every action requires an authenticated session. Unauthenticated requests are redirected to the login page. Only the role-specific attributes on individual actions add stricter role requirements on top of that baseline.Part 2 — Node.js API Roles and Modules
The Node.js API implements a separate multi-tenant RBAC system. Roles are stored in the PostgreSQLusers table managed by Drizzle ORM, and each JWT token carries the user’s role claim. There are six roles arranged in a strict numeric weight hierarchy, and access to each feature is controlled by two orthogonal dimensions: minimum role level and module membership.
Six Roles with Weight Hierarchy
Roles are defined insrc/lib/schemas.ts as a const array and enforced through the ROLE_WEIGHT map:
| Role | Weight | Description |
|---|---|---|
VIEWER | 1 | Read-only access; can only consult approved documents |
COMMENTER | 2 | Read access plus the ability to comment on documents |
CONTRIBUTOR | 3 | Can upload documents, which are created in draft status |
OPERATOR | 4 | Manages documents within their assigned module; can approve/reject |
COMPANY_ADMIN | 5 | Full control within their own company; cannot manage other companies or create users above OPERATOR |
SUPER_ADMIN | 6 | Unrestricted access across all companies and all data |
Three Modules and Their Access Rules
Modules represent feature groups within the API. Read access (MODULE_ACCESS) and write access (MODULE_WRITE_ACCESS) are defined separately, so a role may be able to read a module’s data without being able to modify it.
- MODULE_1 — Gestión de Documentos
- MODULE_2 — Consulta de Documentos
- MODULE_3 — Búsqueda Avanzada
Description: Approval, rejection, and full document lifecycle management.
| Permission | Roles |
|---|---|
Read (canRead) | OPERATOR, COMPANY_ADMIN, SUPER_ADMIN |
Write (canWrite) | OPERATOR, COMPANY_ADMIN, SUPER_ADMIN |
VIEWER, COMMENTER, and CONTRIBUTOR have no access to this module. This is the management surface — actions taken here propagate status changes that the .NET app monitors.Middleware: requireMinRole
The requireMinRole middleware in src/middleware/roles.ts compares the authenticated user’s weight against the required minimum:
403 if the user’s role weight is strictly less than the required minimum. Equal or greater weights pass. For example, requireMinRole("OPERATOR") allows OPERATOR (4), COMPANY_ADMIN (5), and SUPER_ADMIN (6).
Middleware: requireModuleAccess
The requireModuleAccess middleware checks whether the user’s role appears in the explicit allow-list for a given module and access level:
requireMinRole, module access is not purely hierarchical — a role must appear explicitly in the allow-list. This lets the system grant selective access without promoting a role to a higher weight.
Node.js Permission Matrix
| Role | MODULE_1 Read | MODULE_1 Write | MODULE_2 Read | MODULE_2 Write | MODULE_3 Read | MODULE_3 Write |
|---|---|---|---|---|---|---|
VIEWER | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ |
COMMENTER | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ |
CONTRIBUTOR | ❌ | ❌ | ✅ | ❌ | ❌ | ❌ |
OPERATOR | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ |
COMPANY_ADMIN | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
SUPER_ADMIN | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |