Deliver forum posting entitlements through managed group membership with identity linkage, periodic reconciliation, webhook handling, and an operator mapping surface. Include fake and live test environments, setup documentation, migrations, and end-to-end coverage.
25 lines
1.1 KiB
SQL
25 lines
1.1 KiB
SQL
-- name: GetPersonIdentity :one
|
|
-- Identity attributes linkage resolves against: the OIDC subject (oidc /
|
|
-- discourseconnect modes) and the verified primary email (email mode).
|
|
-- Reads core via the stream's core_reader grant.
|
|
SELECT p.person_id, p.display_name, p.primary_email, p.primary_email_verified, u.oidc_subject
|
|
FROM core.persons p
|
|
JOIN core.users u ON u.user_id = p.user_id
|
|
WHERE p.person_id = $1;
|
|
|
|
-- name: FindPersonByVerifiedEmail :one
|
|
-- Reverse resolution for email-mode webhook linking: which person owns this
|
|
-- verified primary email. Case-insensitive to match Discourse's own
|
|
-- email comparison semantics.
|
|
SELECT p.person_id, p.display_name, p.primary_email, p.primary_email_verified, u.oidc_subject
|
|
FROM core.persons p
|
|
JOIN core.users u ON u.user_id = p.user_id
|
|
WHERE lower(p.primary_email) = lower($1) AND p.primary_email_verified = TRUE;
|
|
|
|
-- name: FindPersonByOIDCSubject :one
|
|
-- Reverse resolution for oidc/discourseconnect-mode webhook linking.
|
|
SELECT p.person_id, p.display_name, p.primary_email, p.primary_email_verified, u.oidc_subject
|
|
FROM core.persons p
|
|
JOIN core.users u ON u.user_id = p.user_id
|
|
WHERE u.oidc_subject = $1;
|