Tearleads

organization_roster_entries API Postgres table

Organization roster lifecycle and encrypted profile binding rows.

Declared in packages/api-shared/src/schema/organizations.ts

Description

This table is product state, not access authority. Signed groups and container grants decide access. Roster rows let org-manager keep showing disabled/departed accounts and bind private profile fields to encrypted Loro documents without exposing names, email addresses, titles, or notes to the server.

Columns

  • iduuid
    • primary key
    • not null
    • default gen_random_uuid()

    Roster entry id. An organization has at most one entry per user.

  • organization_iduuid
    • not null

    Organization that owns the roster entry.

  • user_iduuid
    • not null

    Global user identity represented by this roster entry.

  • statustext
    • not null
    • default 'active'

    Lifecycle state. Disabled users may remain visible in the directory even after they are removed from access groups.

  • profile_document_iduuid
    • nullable

    Optional encrypted document containing org-scoped profile/contact fields such as first name, last name, email, and title.

  • joined_attimestamp
    • not null
    • default now()

    When the user first became visible in this organization roster.

  • disabled_attimestamp
    • nullable

    Deactivation audit metadata.

  • disabled_by_user_iduuid
    • nullable

    Deactivation audit metadata.

  • sync_paused_attimestamp
    • nullable

    When the member paused this organization's content syncing to their devices, or null while it syncs. Only the member sets it; deactivation clears it. It never affects access.

  • leave_requesttext
    • nullable

    The member's pending signed request to leave, as JSON, or null. Only the member files or withdraws it; deactivation clears it. Administrators verify its signature before acting on it.

  • two_factor_requiredboolean
    • not null
    • default false

    An administrator requires this member to sign in with two-factor authentication. Enforced only while status is active; the flag survives disable and re-activation, and re-activating a required member revokes their unverified sessions. While active and set, the organization's server routes refuse sessions that did not pass a second factor. It is a server gate, not access authority: keys already wrapped to the member stay usable on their devices.

  • created_attimestamp
    • not null
    • default now()

    Server-side row timestamps.

  • updated_attimestamp
    • not null
    • default now()

    Server-side row timestamps.

Indexes

  • organization_roster_entries_two_factor_user_idx(user_id)
    • partial: where "two_factor_required"

    Sign-in reads a user's requiring organizations; only required rows are indexed, so the index stays as small as the set of such members.

  • organization_roster_entries_org_user_idx(organization_id, user_id)
    • unique
  • organization_roster_entries_org_status_idx(organization_id, status)
    • organization_roster_entries_profile_document_idx(profile_document_id)