mirror of
https://github.com/warmbly/warmbly.git
synced 2026-08-20 00:01:21 +00:00
7de29b0fb0
Add users.ban_scope INT NOT NULL DEFAULT 0 in migration 000045 so admins can describe what a ban concretely stops (login / workspace creation / outbound send) instead of relying on a single boolean banned_at flag that meant "everything". Wire flags in the BanScope enum (kept in sync with the migration) plus a CHECK constraint guaranteeing non-negative values. Existing bans backfill to BanScopeLogin so the historical "you can't log in" semantics is preserved exactly — no behaviour changes silently at deployment. BanUserRequest gains an optional scope field, BanUser threads it through the service to the repo write, and the UserBanDialog grows a checkbox group with one option per flag. Reason still required; at least one scope must be picked. Audit details now include the scope bitmask. Runtime enforcement (refusing login when BanScopeLogin is set, etc.) is intentionally separate from this commit — the existing codebase doesn't yet have an active ban check anywhere, so wiring that lives across the auth middleware, org-create handler, and emailsend service. This slice ships the schema, the audit story, and the UI vocabulary so the enforcement PR can land without database churn.