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:
@@ -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,
|
||||
))
|
||||
Reference in New Issue
Block a user