mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-04 04:59:47 +08:00
- models.py: add VALID_ROLES + normalize_role as the single source of truth - identity.py: route _canonical_record/_migrate_legacy_users/load_users/set_role through normalize_role - context.py: token payload role mapping via normalize_role - services/auth.py + api/routers/auth.py: set_role guards validate against VALID_ROLES - tests/multi_user/test_role_normalization.py: 16 tests, first set_role coverage in repo Zero behavior change: legal roles pass through; unknown values keep the same least-privilege degrade path; only guard error strings derived from sorted(VALID_ROLES) differ.