76883b569c
- backend/src/permissions/registry.js: single source of truth (PERMISSIONS map) with all 24 keys (16 teacher + 8 student, student keys also cover free_student). Exports isKnown(), listKeys(), byRole(), buildDefaultsMap(). - auth.js: PERM_DEFAULTS now sourced from registry.buildDefaultsMap(); new perm() helper validates key at registration time (crashes early on typos). requirePermission() unchanged — backward compat preserved. - permissionsController.js: ALL_PERMISSIONS now built from registry.byRole(); inline 24-entry array removed. API response shape unchanged. - check-route-auth.js: validates every requirePermission/perm call key against registry; lists unknown keys as errors before exit. perm() added to GUARDS list so it counts as route protection. Discrepancy noted: auth.js had free_student with same 8 keys as student; permissionsController never seeded free_student rows. Registry documents this via roles:[] array; buildDefaultsMap() correctly covers free_student. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>