nside_wefa.audit.immutability

Immutability guard for auditlog.models.LogEntry.

Audit events should be append-only. Auditlog leaves enforcement to convention — WeFa adds belt-and-suspenders guards that raise loudly on any attempt to update or delete an existing event. The retention purge command (and any future tooling that legitimately needs to delete rows) sets a per-call _wefa_purge flag to bypass the guard.

Operators of regulated deployments are still encouraged to REVOKE UPDATE, DELETE at the database level; this is documented in the README.

Functions

allow_purge()

Context manager used by wefa_audit_purge to permit deletion.

install_guards()

Connect the pre_save / pre_delete handlers.

Exceptions

AuditEventImmutableError

Raised when code attempts to mutate or delete an existing audit event.