misc: implemented secret approval request and project audit logs

This commit is contained in:
Sheen Capadngan
2024-09-04 01:48:08 +08:00
parent 604b0467f9
commit 8c03c160a9
11 changed files with 106 additions and 54 deletions
+1 -1
View File
@@ -881,7 +881,7 @@ export const registerRoutes = async (
projectEnvDAL,
userDAL,
licenseService,
slackIntegrationDAL
projectSlackConfigDAL
});
const secretService = secretServiceFactory({
@@ -8,6 +8,7 @@ import {
UserEncryptionKeysSchema,
UsersSchema
} from "@app/db/schemas";
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
import { PROJECTS } from "@app/lib/api-docs";
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
@@ -575,6 +576,17 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
projectId: req.params.workspaceId
});
await server.services.auditLog.createAuditLog({
...req.auditLogInfo,
projectId: req.params.workspaceId,
event: {
type: EventType.GET_PROJECT_SLACK_CONFIG,
metadata: {
id: slackConfig.id
}
}
});
return slackConfig;
}
});
@@ -618,6 +630,22 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
...req.body
});
await server.services.auditLog.createAuditLog({
...req.auditLogInfo,
projectId: req.params.workspaceId,
event: {
type: EventType.UPDATE_PROJECT_SLACK_CONFIG,
metadata: {
id: slackConfig.id,
slackIntegrationId: slackConfig.slackIntegrationId,
isAccessRequestNotificationEnabled: slackConfig.isAccessRequestNotificationEnabled,
accessRequestChannels: slackConfig.accessRequestChannels,
isSecretRequestNotificationEnabled: slackConfig.isSecretRequestNotificationEnabled,
secretRequestChannels: slackConfig.secretRequestChannels
}
}
});
return slackConfig;
}
});