directory server: add eventlog entry
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user