Skip to main content

Crate tablo_audit

Crate tablo_audit 

Source
Expand description

The audit log for Tablo panels: an AuditEntry for each record every write of a panel names, stored inside the write’s transaction, and the read-only AuditLog resource that lists them.

It is built on Tablo’s public API alone: a CommitHook stores the writes, an AuthHook stores what auth does, and AuditLog is an ordinary Resource. PanelAuditExt registers them on a Panel:

use tablo_audit::PanelAuditExt;

Panel::new("admin").audit_log(|log| log.policy(when(is_admin)));

The Db registers AuditEntry: list it in the app’s models!, as tablo::models!(Post, tablo::audit::AuditEntry).

Structs§

AuditChange
One field an AuditEntry changed: its name, its label in the writer’s locale, and its spelling before and after, None where it held nothing.
AuditEntry
Shipped record of one thing a panel user did: who, on which panel and for which tenant, to which resource and record, and which fields it changed.
AuditEvent
The app’s own event for the audit log of a panel with audit_trail: a sign-in, an export, a payment, beside what the panel’s writes record.
AuditLog
The read-only resource listing the AuditEntry rows of its panel, newest first, at {prefix}/audit-log, or under the area that places it. audit_log registers it.

Enums§

ImpersonationEvent
A start or a stop of acting as a user, as AuditEntry::impersonation reads it. The entry’s actor is who acted; this names whom they acted as.

Traits§

PanelAuditExt
The audit log’s registrations on a Panel.

Functions§

forget_actor
Keeps what the user user_id did, but no longer who did it, for an account being erased: each entry they acted in names a deleted user, the tablo-audit-deleted-user message, in their place, and each auth entry done to their account, a sign-in or an impersonation of them, no longer holds their name. The entries’ events, records and fields stay, as does the account’s id, which names no one once the account is gone. A refused sign-in names no account and keeps the login it typed until prune deletes it. Run it through the transaction that deletes the account.
forget_tenant
Deletes the entries filed under tenant, for a tenant being erased, but those recording an impersonation: a start is filed under the actor’s tenant, and stays as the record of who reached which account until prune deletes it. Entries of panels that act for no tenant name none, and stay.
impersonations
The entries that record an impersonation, started or stopped, for a resource’s query or a filter:
prune
Deletes the AuditEntry rows of panel older than age. Nothing else deletes them but forget_tenant; a job calls it on the schedule the app keeps its audit trail for.