netbox-inventory icon indicating copy to clipboard operation
netbox-inventory copied to clipboard

Add audit trails

Open alehaa opened this issue 7 months ago • 0 comments

[!NOTE] This PR is based on #231. The diff and commit history of this PR will (hopefully) be automatically reduced to the actual changes once its dependent PR is merged.

PR #231 implements audit flows to add workflows for auditing objects. This is a follow-up to bringing in audit trails, a way to actually document what objects have been audited and by whom.

Fixes: #200

audit_trails

Models

Two new models are added:

  • Audit Trails document when an object has been verified to be in the specified location.
  • Audit Trail Sources can be used to optionally identify the source of an audit trail. This is useful when importing audit trails from other sources.

Additional features

  • Each row of an AuditFlowPage table now starts with a button to mark an object as seen. Clicking this button creates an AuditTrail in the background. A new bulk control is also provided.
  • A new configuration option named audit_window defines a timeframe for how long this object should be marked as seen, which affects the state of the button (mark seen or unseen). AuditTrail objects aren't deleted automatically. However, this allows implementation without complicated session state handling, and even allows multiple users to work together on auditing if needed.
  • The quick search input field on each AuditFlowPage has been enhanced to speed up this process. It automatically gets input focus when the page loads and behaves like the regular quick search as it is being typed. However, this field can now be submitted (e.g. by hitting [Enter]). If only a single object is found, it will be marked as seen automatically, otherwise the user will get instructions on necessary manual actions. This change allows barcode and QR code scanners to be used for mass auditing.
  • An object's audit trails are displayed as a new tab in the object's detail view. All objects are supported automatically and no additional configuration is required.

Limitations

This PR does not implement reporting for the current audit status of objects due to the complexity of finding a general approach that is suitable for most users. However, instructions on how to use NetBox custom scripts for this purpose, including an example, are provided in the README.

alehaa avatar May 04 '25 17:05 alehaa