Add v1 audit log backend models and wiring to push secrets

This commit is contained in:
Tuan Dang
2022-12-27 12:12:39 -05:00
parent 019e90dc77
commit 9497a26eb2
26 changed files with 459 additions and 272 deletions
+47
View File
@@ -0,0 +1,47 @@
import {
Action,
IAction
} from '../models';
import {
createLogHelper
} from '../helpers/log';
import EELicenseService from './EELicenseService';
/**
* Class to handle Enterprise Edition log actions
*/
class EELogService {
/**
* Create an (audit) log
* @param {Object} obj
* @param {String} obj.userId - id of user associated with the log
* @param {String} obj.workspaceId - id of workspace associated with the log
* @param {Action} obj.actions - actions to include in log
* @param {String} obj.channel - channel (web/cli/auto) associated with the log
* @param {String} obj.ipAddress - ip address associated with the log
*/
static async createLog({
userId,
workspaceId,
actions,
channel,
ipAddress
}: {
userId: string;
workspaceId: string;
actions: IAction[];
channel: string;
ipAddress: string;
}) {
if (!EELicenseService.isLicenseValid) return;
return await createLogHelper({
userId,
workspaceId,
actions,
channel,
ipAddress
})
}
}
export default EELogService;
+3 -1
View File
@@ -1,7 +1,9 @@
import EELicenseService from "./EELicenseService";
import EESecretService from "./EESecretService";
import EELogService from "./EELogService";
export {
EELicenseService,
EESecretService
EESecretService,
EELogService
}