diff --git a/src/externalldap.js b/src/externalldap.js index c236ea8ed..10e6c95a4 100644 --- a/src/externalldap.js +++ b/src/externalldap.js @@ -85,7 +85,10 @@ async function setConfig(newConfig, auditSource) { 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 + if (newConfig.provider === 'noop') { + await users.resetSource(); // otherwise, the owner could be 'ldap' source and lock themselves out + await groups.resetSource(); + } await eventlog.add(eventlog.ACTION_EXTERNAL_LDAP_CONFIGURE, auditSource, { oldConfig: removePrivateFields(currentConfig), config: removePrivateFields(newConfig) }); diff --git a/src/groups.js b/src/groups.js index e79d074ae..cac1a1d6c 100644 --- a/src/groups.js +++ b/src/groups.js @@ -18,6 +18,8 @@ exports = module.exports = { setMembership, getMembership, + + resetSource }; const assert = require('assert'), @@ -236,3 +238,8 @@ async function update(id, data) { if (updateError) throw updateError; if (result.affectedRows !== 1) throw new BoxError(BoxError.NOT_FOUND, 'Group not found'); } + + +async function resetSource() { + await database.query('UPDATE userGroups SET source = ?', [ '' ]); +}