directory server: add eventlog entry

This commit is contained in:
Girish Ramakrishnan
2024-01-13 12:18:14 +01:00
parent 40c82b3e48
commit a389b863f9
5 changed files with 20 additions and 2 deletions

View File

@@ -86,11 +86,14 @@ async function applyConfig(config) {
if (!gServer) await start();
}
async function setConfig(directoryServerConfig) {
async function setConfig(directoryServerConfig, auditSource) {
assert.strictEqual(typeof directoryServerConfig, 'object');
assert(auditSource && typeof auditSource === 'object');
if (constants.DEMO) throw new BoxError(BoxError.BAD_FIELD, 'Not allowed in demo mode');
const oldConfig = await getConfig();
const config = {
enabled: directoryServerConfig.enabled,
secret: directoryServerConfig.secret,
@@ -101,6 +104,8 @@ async function setConfig(directoryServerConfig) {
await validateConfig(config);
await settings.setJson(settings.DIRECTORY_SERVER_KEY, config);
await applyConfig(config);
await eventlog.add(eventlog.ACTION_DIRECTORY_SERVER_CONFIGURE, auditSource, { fromEnabled: oldConfig.enabled, toEnabled: config.enabled });
}
// helper function to deal with pagination