diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts index e2968ef35..41186756a 100644 --- a/backend/src/ee/services/audit-log/audit-log-types.ts +++ b/backend/src/ee/services/audit-log/audit-log-types.ts @@ -148,7 +148,6 @@ export enum EventType { GET_PKI_ALERT = "get-pki-alert", UPDATE_PKI_ALERT = "update-pki-alert", DELETE_PKI_ALERT = "delete-pki-alert", - // new CREATE_PKI_COLLECTION = "create-pki-collection", GET_PKI_COLLECTION = "get-pki-collection", UPDATE_PKI_COLLECTION = "update-pki-collection", @@ -156,7 +155,6 @@ export enum EventType { GET_PKI_COLLECTION_ITEMS = "get-pki-collection-items", ADD_PKI_COLLECTION_ITEM = "add-pki-collection-item", DELETE_PKI_COLLECTION_ITEM = "delete-pki-collection-item", - // end CREATE_KMS = "create-kms", UPDATE_KMS = "update-kms", DELETE_KMS = "delete-kms", diff --git a/frontend/src/hooks/api/auditLogs/constants.tsx b/frontend/src/hooks/api/auditLogs/constants.tsx index 819c36c20..8aadda2d8 100644 --- a/frontend/src/hooks/api/auditLogs/constants.tsx +++ b/frontend/src/hooks/api/auditLogs/constants.tsx @@ -57,6 +57,17 @@ export const eventToNameMap: { [K in EventType]: string } = { [EventType.DELETE_CERT]: "Delete certificate", [EventType.REVOKE_CERT]: "Revoke certificate", [EventType.GET_CERT_BODY]: "Get certificate body", + [EventType.CREATE_PKI_ALERT]: "Create PKI alert", + [EventType.GET_PKI_ALERT]: "Get PKI alert", + [EventType.UPDATE_PKI_ALERT]: "Update PKI alert", + [EventType.DELETE_PKI_ALERT]: "Delete PKI alert", + [EventType.CREATE_PKI_COLLECTION]: "Create PKI collection", + [EventType.GET_PKI_COLLECTION]: "Get PKI collection", + [EventType.UPDATE_PKI_COLLECTION]: "Update PKI collection", + [EventType.DELETE_PKI_COLLECTION]: "Delete PKI collection", + [EventType.GET_PKI_COLLECTION_ITEMS]: "Get PKI collection items", + [EventType.ADD_PKI_COLLECTION_ITEM]: "Add PKI collection item", + [EventType.DELETE_PKI_COLLECTION_ITEM]: "Delete PKI collection item", [EventType.ORG_ADMIN_ACCESS_PROJECT]: "Org admin accessed project" }; diff --git a/frontend/src/hooks/api/auditLogs/enums.tsx b/frontend/src/hooks/api/auditLogs/enums.tsx index 94963f640..a6a2ada93 100644 --- a/frontend/src/hooks/api/auditLogs/enums.tsx +++ b/frontend/src/hooks/api/auditLogs/enums.tsx @@ -71,5 +71,16 @@ export enum EventType { DELETE_CERT = "delete-cert", REVOKE_CERT = "revoke-cert", GET_CERT_BODY = "get-cert-body", + CREATE_PKI_ALERT = "create-pki-alert", + GET_PKI_ALERT = "get-pki-alert", + UPDATE_PKI_ALERT = "update-pki-alert", + DELETE_PKI_ALERT = "delete-pki-alert", + CREATE_PKI_COLLECTION = "create-pki-collection", + GET_PKI_COLLECTION = "get-pki-collection", + UPDATE_PKI_COLLECTION = "update-pki-collection", + DELETE_PKI_COLLECTION = "delete-pki-collection", + GET_PKI_COLLECTION_ITEMS = "get-pki-collection-items", + ADD_PKI_COLLECTION_ITEM = "add-pki-collection-item", + DELETE_PKI_COLLECTION_ITEM = "delete-pki-collection-item", ORG_ADMIN_ACCESS_PROJECT = "org-admin-accessed-project" } diff --git a/frontend/src/hooks/api/auditLogs/types.tsx b/frontend/src/hooks/api/auditLogs/types.tsx index 1d80d6128..0a34186f6 100644 --- a/frontend/src/hooks/api/auditLogs/types.tsx +++ b/frontend/src/hooks/api/auditLogs/types.tsx @@ -1,5 +1,6 @@ import { CaStatus } from "../ca"; import { IdentityTrustedIp } from "../identities/types"; +import { PkiItemType } from "../pkiCollections/constants"; import { ActorType, EventType, UserAgentType } from "./enums"; interface UserActorMetadata { @@ -579,6 +580,95 @@ interface GetCertBody { }; } +interface CreatePkiAlert { + type: EventType.CREATE_PKI_ALERT; + metadata: { + pkiAlertId: string; + pkiCollectionId: string; + name: string; + alertBeforeDays: number; + recipientEmails: string; + }; +} +interface GetPkiAlert { + type: EventType.GET_PKI_ALERT; + metadata: { + pkiAlertId: string; + }; +} + +interface UpdatePkiAlert { + type: EventType.UPDATE_PKI_ALERT; + metadata: { + pkiAlertId: string; + pkiCollectionId?: string; + name?: string; + alertBeforeDays?: number; + recipientEmails?: string; + }; +} +interface DeletePkiAlert { + type: EventType.DELETE_PKI_ALERT; + metadata: { + pkiAlertId: string; + }; +} + +interface CreatePkiCollection { + type: EventType.CREATE_PKI_COLLECTION; + metadata: { + pkiCollectionId: string; + name: string; + }; +} + +interface GetPkiCollection { + type: EventType.GET_PKI_COLLECTION; + metadata: { + pkiCollectionId: string; + }; +} + +interface UpdatePkiCollection { + type: EventType.UPDATE_PKI_COLLECTION; + metadata: { + pkiCollectionId: string; + name?: string; + }; +} + +interface DeletePkiCollection { + type: EventType.DELETE_PKI_COLLECTION; + metadata: { + pkiCollectionId: string; + }; +} + +interface GetPkiCollectionItems { + type: EventType.GET_PKI_COLLECTION_ITEMS; + metadata: { + pkiCollectionId: string; + }; +} + +interface AddPkiCollectionItem { + type: EventType.ADD_PKI_COLLECTION_ITEM; + metadata: { + pkiCollectionItemId: string; + pkiCollectionId: string; + type: PkiItemType; + itemId: string; + }; +} + +interface DeletePkiCollectionItem { + type: EventType.DELETE_PKI_COLLECTION_ITEM; + metadata: { + pkiCollectionItemId: string; + pkiCollectionId: string; + }; +} + interface OrgAdminAccessProjectEvent { type: EventType.ORG_ADMIN_ACCESS_PROJECT; metadata: { @@ -646,6 +736,17 @@ export type Event = | DeleteCert | RevokeCert | GetCertBody + | CreatePkiAlert + | GetPkiAlert + | UpdatePkiAlert + | DeletePkiAlert + | CreatePkiCollection + | GetPkiCollection + | UpdatePkiCollection + | DeletePkiCollection + | GetPkiCollectionItems + | AddPkiCollectionItem + | DeletePkiCollectionItem | OrgAdminAccessProjectEvent; export type AuditLog = { diff --git a/frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx b/frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx index 668b5e5c6..f5e54ab47 100644 --- a/frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx +++ b/frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx @@ -323,6 +323,65 @@ export const LogsTableRow = ({ auditLog }: Props) => {
{`Email: ${event.metadata.email}`}
); + case EventType.CREATE_PKI_ALERT: + case EventType.UPDATE_PKI_ALERT: + return ( +{`Alert ID: ${event.metadata.pkiAlertId}`}
+{`Name: ${event.metadata.name}`}
+{`Alert Before Days: ${event.metadata.alertBeforeDays}`}
+{`Alert ID: ${event.metadata.pkiAlertId}`}
+{`Collection ID: ${event.metadata.pkiCollectionId}`}
+{`Name: ${event.metadata.name}`}
+{`Collection ID: ${event.metadata.pkiCollectionId}`}
+{`Name: ${event.metadata.name}`}
+{`Collection ID: ${event.metadata.pkiCollectionId}`}
+{`Collection ID: ${event.metadata.pkiCollectionId}`}
+{`Collection ID: ${event.metadata.pkiCollectionId}`}
+{`Collection Item ID: ${event.metadata.pkiCollectionItemId}`}
+{`Type: ${event.metadata.type}`}
+{`Item ID: ${event.metadata.itemId}`}
+{`Collection ID: ${event.metadata.pkiCollectionId}`}
+{`Collection Item ID: ${event.metadata.pkiCollectionItemId}`}
+