feat(audit): tenant-scoped CSV export endpoint (PMS-455) #333
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
psa-systems/mokosh-server!333
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-455-audit-log-csv-export"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
GET /api/v1/audit-log/export.csvstreams the same admin-gated, tenant-scoped audit-log feedGET /audit-logalready exposes, but as a CSV download instead of a paginated JSON page. SameAuditLogFilterenvelope (date range / action / entity-type / actor) so an operator can scope the export to whatever they were reviewing in the SPA. Hard cap of 50k rows per request keeps a runaway filter from holding a connection; the SPA narrows by date range when the cap clips.Response carries
Content-Type: text/csv; charset=utf-8andContent-Disposition: attachment; filename="audit-log.csv"so the browser triggers a download. Column order matches what an operator typically pivots on in a spreadsheet review: when -> who -> what -> target -> network metadata (timestamp / actor / actor_id / action / entity_type / entity_id / entity_name / ip_address / user_agent). RFC-4180 quoting on any field containing a comma, quote, or newline. System-issued rows render the actor asSystemto match the SPA's table convention.This closes the audit / export half of PMS-455. The existing
/audit-logJSON list + theAuditCtxhelper writes from every privileged-action handler were already in place; this PR adds the export verb the original ticket called for. The client-side "Download CSV" button on/admin/audit-loglands in a sibling PR on mokosh-apps.#PMS-455