feat(webui): add a member by provider subject or email

POST /api/orgs/{id}/members binds a person by subject, or by email as a
placeholder. The first sign-in whose provider vouches for that email
claims it: the State Store moves the binding onto the provider's subject
in one statement, so a second account with the same address finds
nothing to claim and later sign-ins rest on the subject alone.
This commit is contained in:
sam committed 2026-10-11 03:54:49 +11:00
1 parent 9e1a40ce99
commit 37cbf2ef47
17 files changed
+2085 -1505

No files matched your search

@@ -39,6 +39,13 @@ SELECT i.id, i.kind, i.display_name, i.lifecycle, i.version, i.created_at, i.upd
FROM identities i JOIN identity_subjects b ON b.identity_id = i.id
WHERE b.issuer = $1 AND b.subject = $2;
-- name: ClaimIdentitySubject :one
-- Moves a placeholder binding onto the subject the provider asserts, in one
-- statement, so only the first claimant gets it.
UPDATE identity_subjects SET subject = @subject, bound_at = @bound_at
WHERE issuer = @issuer AND subject = @placeholder
RETURNING identity_id;
-- name: UpsertIdentitySubject :exec
INSERT INTO identity_subjects (issuer, subject, identity_id, bound_at)
VALUES ($1, $2, $3, $4)