admin

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootstrapPlatformAdmin added in v0.8.0

func BootstrapPlatformAdmin(ctx context.Context, pool *pgxpool.Pool, email string, log *slog.Logger) error

BootstrapPlatformAdmin covers the zero-to-one platform-admin bootstrap: when no platform admin exists yet, it promotes the user identified by email (case-insensitive). The caller (product main.go) reads the env var and passes the address in — the framework function never touches the environment.

Semantics (deliberately narrow):

  • empty/blank email → info-skip (feature off);
  • any platform admin already exists → info-skip (only ever 0→1: a post-compromise env flip cannot mint a second admin, and nothing here ever demotes);
  • email not registered yet → warn-skip, not an error (deploy-before- register is a legal order; the next boot retries);
  • no audit record: no principal exists at boot, the startup log is the trail. Ongoing grants/revokes keep going through PATCH /api/admin/users/{id}/admin.

Idempotent on every boot; call once after migrations have run.

Types

type Hooks

type Hooks struct {
	OnImpersonation func(ctx context.Context, adminUserID, targetUserID string) error
}

Directories

Path Synopsis
adapters

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL