Skip to content
rw3iss Auth

KNOWN\_BASE\_ROLE\_LABELS

KNOWN_BASE_ROLE_LABELS

const KNOWN_BASE_ROLE_LABELS: Record<string, string>

Defined in: constants/roles.ts:68

UI-facing labels for the seeded base roles. The DB’s roles.name column also carries a label (“System Administrator”, etc.), but the compact form here is the one we want for dense UIs — table columns, checkbox lists, dropdowns — where a four-word label would wrap.

Source of truth for the codes is still the migration; this map is purely for display. If a code is missing from the map (a new seeded role or a per-org custom role), roleLabel() falls back to title-casing the code itself.

Adding / overriding labels:

  • Seeded base roles → append a [CODE]: 'Label' entry below.
  • Per-app or per-org custom roles → pass the dynamic role record (with a .name field) to roleLabel(); the function prefers the record’s own name over the static map.
  • At a call-site, supply roleLabel(code, { overrides: { code: 'Foo' } }) to override a label for one render without touching the global map.