userdirectory: add eventlog entry
This commit is contained in:
@@ -9,6 +9,7 @@ const assert = require('assert'),
|
||||
BoxError = require('./boxerror.js'),
|
||||
constants = require('./constants.js'),
|
||||
debug = require('debug')('box:user-directory'),
|
||||
eventlog = require('./eventlog.js'),
|
||||
oidc = require('./oidc.js'),
|
||||
settings = require('./settings.js'),
|
||||
tokens = require('./tokens.js'),
|
||||
@@ -19,14 +20,17 @@ async function getProfileConfig() {
|
||||
return value || { lockUserProfiles: false, mandatory2FA: false };
|
||||
}
|
||||
|
||||
async function setProfileConfig(profileConfig) {
|
||||
async function setProfileConfig(profileConfig, auditSource) {
|
||||
assert.strictEqual(typeof profileConfig, 'object');
|
||||
assert(auditSource && typeof auditSource === 'object');
|
||||
|
||||
if (constants.DEMO) throw new BoxError(BoxError.BAD_STATE, 'Not allowed in demo mode');
|
||||
|
||||
const oldConfig = await getProfileConfig();
|
||||
await settings.setJson(settings.PROFILE_CONFIG_KEY, profileConfig);
|
||||
|
||||
await eventlog.add(eventlog.ACTION_USER_DIRECTORY_PROFILE_CONFIG_UPDATE, auditSource, { oldConfig, config: profileConfig });
|
||||
|
||||
if (profileConfig.mandatory2FA && !oldConfig.mandatory2FA) {
|
||||
debug('setProfileConfig: logging out non-2FA users to enforce 2FA');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user