feat(store): add totp columns, org totp policy and global scope

Orgs are created inside their own tenant scope, so signup needs no
system scope.

Refs #3

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-21 23:55:23 +01:00
1 parent caff396264
commit 99e9b1e57d
12 files changed
+203 -31

No files matched your search

+5
View File
@@ -18,6 +18,7 @@ type Scope struct {
OrgID uuid.UUID
UserID uuid.UUID
system bool
global bool
}
func Org(org, user uuid.UUID) Scope { return Scope{OrgID: org, UserID: user} }
@@ -26,6 +27,10 @@ func Org(org, user uuid.UUID) Scope { return Scope{OrgID: org, UserID: user} }
// which is what login and the org switcher need before an org is chosen.
func User(user uuid.UUID) Scope { return Scope{UserID: user} }
// Global carries no tenant context: only tables without row-level security,
// such as users, are usable. Login runs here before the user is known.
func Global() Scope { return Scope{global: true} }
// System bypasses tenant isolation. Reserve it for work that is inherently
// cross-tenant, never for request handling.
func System() Scope { return Scope{system: true} }