06/16 Phase 6 foundation: admin blueprint, audit log, user management

Adds the admin backend foundation: AuditLog + Setting models/migration,
an admin-only dashboard with KPI cards, and user management (search,
ban/suspend/activate, tier override, trust adjust) with audit logging
on every write action. Smoke suite extended to 64 checks.
This commit is contained in:
2026-06-16 11:45:00 -04:00
parent 62b04803ad
commit 2e9025fe55
18 changed files with 680 additions and 1 deletions
+14
View File
@@ -0,0 +1,14 @@
"""Append-only audit trail writer for admin actions."""
from app.extensions import db
from app.models.audit import AuditLog
def log_action(actor, action: str, target_type: str, target_id, meta: dict | None = None):
"""Append an AuditLog row. Caller commits."""
db.session.add(AuditLog(
actor_id=actor.id if actor else None,
action=action,
target_type=target_type,
target_id=target_id,
meta=meta,
))