fix(05-06): add Collection and Remittance CASL subjects, update routes

- Add Collection and Remittance to AppSubjects union type
- Grant OFFICE_STAFF manage:Collection and manage:Remittance
- Grant COLLECTOR create/read:Collection and create/read:Remittance
- Update all 8 collection/remittance route handlers from Subscriber to
  their dedicated CASL subjects (Collection or Remittance)
- Update JSDoc comments in route files to reflect new subject names

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
kevin-asprec
2026-03-05 18:28:07 +08:00
parent a0ea504af3
commit a59a246fdc
8 changed files with 27 additions and 16 deletions

View File

@@ -66,6 +66,9 @@ export function definePermissionsFor(
can("manage", "Expense");
// Vendor management (CRUD)
can("manage", "Vendor");
// Collection and remittance management
can("manage", "Collection");
can("manage", "Remittance");
// Job type rates (read-only for office staff — admin configures rates)
can("read", "JobTypeRate");
// View financial reports (read-only)
@@ -88,6 +91,12 @@ export function definePermissionsFor(
can("create", "Payment");
// View payment history
can("read", "Payment");
// Can create and view collections
can("create", "Collection");
can("read", "Collection");
// Can create and view remittances
can("create", "Remittance");
can("read", "Remittance");
// NOTE: No explicit cannot() needed — Collector simply has no rules for
// Invoice, User management, or Reports. Absence of a rule = no access.
break;