externalldap: add eventlog
This commit is contained in:
+5
-1
@@ -19,6 +19,7 @@ const assert = require('assert'),
|
||||
BoxError = require('./boxerror.js'),
|
||||
constants = require('./constants.js'),
|
||||
debug = require('debug')('box:externalldap'),
|
||||
eventlog = require('./eventlog.js'),
|
||||
groups = require('./groups.js'),
|
||||
ldap = require('ldapjs'),
|
||||
once = require('./once.js'),
|
||||
@@ -68,8 +69,9 @@ async function getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
async function setConfig(newConfig) {
|
||||
async function setConfig(newConfig, auditSource) {
|
||||
assert.strictEqual(typeof newConfig, 'object');
|
||||
assert(auditSource && typeof auditSource === 'object');
|
||||
|
||||
if (constants.DEMO) throw new BoxError(BoxError.BAD_FIELD, 'Not allowed in demo mode');
|
||||
|
||||
@@ -83,6 +85,8 @@ async function setConfig(newConfig) {
|
||||
await settings.setJson(settings.EXTERNAL_LDAP_KEY, newConfig);
|
||||
|
||||
if (newConfig.provider === 'noop') await users.resetSource(); // otherwise, the owner could be 'ldap' source and lock themselves out
|
||||
|
||||
await eventlog.add(eventlog.ACTION_EXTERNAL_LDAP_CONFIGURE, auditSource, { oldConfig: removePrivateFields(currentConfig), config: removePrivateFields(newConfig) });
|
||||
}
|
||||
|
||||
// performs service bind if required
|
||||
|
||||
Reference in New Issue
Block a user