Admin Users: show each user's org and move a user into yours

A viewer whose first login ran self-serve signup got an empty org of
their own (org_role owner), so they saw no incidents or calls, and the
earlier fix deliberately never moved a user who already had an org.
PATCH /admin/users/{uid} now moves a user when org_id is passed
explicitly (claims + org_members, audited with left_org_id; the old org
is not deleted). The user list returns org_id/org_role, and the admin
user panel shows the org and a 'Move to my organization' button when it
isn't yours.

Verified: c2-core pytest 496 passed; frontend tsc --noEmit clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Logan Cusano
2026-09-27 18:52:55 -04:00
co-authored by Claude Opus 5.5
parent fa41b9a30c
commit 2b42e5ee9a
5 changed files with 70 additions and 5 deletions
+3
View File
@@ -14,6 +14,9 @@ export interface UserRecord {
discord_linked: boolean;
discord_username: string | null;
discord_user_id: string | null;
/** The org whose data this user can read; null = none (sees nothing). */
org_id?: string | null;
org_role?: "owner" | "member" | null;
// only present on GET /admin/users/{uid}
sessions?: UserSession[];
// only present on POST /admin/users response