Skip to content

feat(organizations): org switch endpoint (new JWT + new abilities) #3223

@PierreBrisorgueil

Description

@PierreBrisorgueil

Description

Endpoint to switch the user's current organization, issuing a new JWT and fresh abilities.

Details

  • POST /api/organizations/:organizationId/switch
  • Verifies user has a membership on target organization
  • Issues a new JWT with updated organizationId
  • Returns new abilities for the target organization
  • Updates user.currentOrganization in DB

Security

  • Must verify membership before switching
  • Old JWT remains valid until expiration (acceptable, resolved properly in phase 6 with short-lived tokens)

Acceptance criteria

  • Endpoint switches current organization
  • New JWT issued with correct organizationId
  • New abilities returned for target organization
  • 403 if user is not a member of target organization

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Nice to have — can waitphase:2-orgsPhase 2: Multi-tenancy & Organizations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions