feat(store): add roles, role assignments, api tokens and invitations

Built-in roles are seeded with fixed ids and are read-only for every org.
Existing non-owner members receive the Viewer role.

Refs #6, #7, #8, #9

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 00:49:35 +01:00
1 parent 15932db98a
commit ee09c497de
15 files changed
+1063 -13

No files matched your search

+3 -2
View File
@@ -2,8 +2,8 @@
SELECT coalesce(org_id_by_slug(sqlc.arg(slug)::citext), '00000000-0000-0000-0000-000000000000')::uuid AS id;
-- name: CreateSSOProvider :one
INSERT INTO sso_providers (id, org_id, name, issuer, client_id, client_secret, scopes, allowed_domains, auto_provision, enabled)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
INSERT INTO sso_providers (id, org_id, name, issuer, client_id, client_secret, scopes, allowed_domains, auto_provision, enabled, default_role_id)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
RETURNING *;
-- name: UpdateSSOProvider :one
@@ -16,6 +16,7 @@ UPDATE sso_providers SET
allowed_domains = $6,
auto_provision = $7,
enabled = $8,
default_role_id = $9,
updated_at = now()
WHERE id = $1
RETURNING *;