mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add audit logging machinery
Summary: Adds machinery to support audit logging in the backend. Logging is currently implemented by streaming events to external HTTP endpoints. All flavors of Grist support a default "grist" payload format, and Grist Enterprise additionally supports an HEC-compatible payload format. Logging of all audit events will be added at a later date. Test Plan: Server tests. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D4331
This commit is contained in:
31
app/common/AuditEvent.ts
Normal file
31
app/common/AuditEvent.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
export interface AuditEvent<Name extends AuditEventName> {
|
||||
event: {
|
||||
/** The event name. */
|
||||
name: Name;
|
||||
/** The user that triggered the event. */
|
||||
user: AuditEventUser | null;
|
||||
/** Additional event details. */
|
||||
details: AuditEventDetails[Name] | null;
|
||||
};
|
||||
/** ISO 8601 timestamp of when the event was logged. */
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export type AuditEventName =
|
||||
| 'createDocument';
|
||||
|
||||
export interface AuditEventUser {
|
||||
/** The user's id. */
|
||||
id: number | null;
|
||||
/** The user's email address. */
|
||||
email: string | null;
|
||||
/** The user's name. */
|
||||
name: string | null;
|
||||
}
|
||||
|
||||
export interface AuditEventDetails {
|
||||
createDocument: {
|
||||
/** The ID of the document. */
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user