Expand description
Append-only audit trail of every change to product data and users (only
the optional retention, purge_older_than, removes old entries – and
records that it did).
Structs§
- Audit
Filter - Mentions
- Items and change orders the text of an entry (or notification) names besides its subject. A reader must be allowed to see all of them; otherwise the entry is redacted for that reader.
Constants§
- EXPORT_
MAX - Most entries in one export (
export); narrow the filter for more.
Functions§
- export
- The audit log as an export (#152 step 8): the entries of
listwith the same filter, visibility and redaction, newest first, at mostEXPORT_MAX. Returns the entries and whether more matched. - for_
entities - History of a set of entities (e.g. an item and all of its revisions) the caller already checked. Entries that name an item the actor may not see are redacted.
- list
- Lists audit entries, newest first. Returns the page and the total count.
Administrators only (
/admin/audit): every entry except those about items, changes, requests or groups the administrator’s need-to-know policy hides (seevisible_clause); entries that name such items are redacted. - purge_
older_ than - Removes the audit entries older than
retention_days(housekeeping,TEAMCRAFT_AUDIT_RETENTION_DAYS; the caller skips it for 0 = keep for ever) and records the removal as oneaudit.purgeentry with the count and the time span removed – in one transaction, so entries never vanish without that record. Returns the number of entries removed. - recent
- Most recent activity the actor may see: entries about items, revisions, changes, requests and groups it may read; user, webhook and assistant entries only for admins (and the user’s own).
- record
- Writes an audit entry. Call it inside the transaction of the change it documents, so that both are committed (or rolled back) together.
- record_
mentioning - Like
recordfor an entry whose summary or details name other items or change orders (labels of a change’s revisions, flagged dependents, a linked change): redacted for readers who may not see all of them. - record_
related - Like
recordfor an entry that also talks about a second item (BOM child, reference target, basis item, item added to a change, …): the entry is redacted for readers who may not see that item. - to_csv
- An export as CSV:
id,at,username,action,entity_type,entity_id,summary,details(details as JSON).