Reduce noisy externalldap debug()s

This commit is contained in:
Johannes Zellner
2021-11-26 09:55:59 +01:00
parent c51a4514f4
commit 63fe75ecd2
2 changed files with 1 additions and 22 deletions
-21
View File
@@ -105,8 +105,6 @@ async function clientSearch(client, dn, searchOptions) {
assert.strictEqual(typeof dn, 'string');
assert.strictEqual(typeof searchOptions, 'object');
debug(`clientSearch: Get objects at ${dn} with options ${JSON.stringify(searchOptions)}`);
// basic validation to not crash
try { ldap.parseDN(dn); } catch (e) { throw new BoxError(BoxError.BAD_FIELD, 'invalid DN'); }
@@ -163,8 +161,6 @@ async function ldapUserSearch(externalLdapConfig, options) {
searchOptions.filter = new ldap.AndFilter({ filters: [ extraFilter, searchOptions.filter ] });
}
debug(`Listing users at ${externalLdapConfig.baseDn} with filter ${searchOptions.filter.toString()}`);
const client = await getClient(externalLdapConfig, { bind: true });
const result = await clientSearch(client, externalLdapConfig.baseDn, searchOptions);
client.unbind();
@@ -187,8 +183,6 @@ async function ldapGroupSearch(externalLdapConfig, options) {
searchOptions.filter = new ldap.AndFilter({ filters: [ extraFilter, searchOptions.filter ] });
}
debug(`Listing groups at ${externalLdapConfig.groupBaseDn} with filter ${searchOptions.filter.toString()}`);
const client = await getClient(externalLdapConfig, { bind: true });
const result = await clientSearch(client, externalLdapConfig.groupBaseDn, searchOptions);
client.unbind();
@@ -239,21 +233,6 @@ async function testConfig(config) {
return null;
}
// eslint-disable-next-line no-unused-vars
async function search(identifier) {
assert.strictEqual(typeof identifier, 'string');
const externalLdapConfig = await settings.getExternalLdapConfig();
if (externalLdapConfig.provider === 'noop') throw new BoxError(BoxError.BAD_STATE, 'not enabled');
const ldapUsers = await ldapUserSearch(externalLdapConfig, { filter: `${externalLdapConfig.usernameField}=${identifier}` });
// translate ldap properties to ours
let users = ldapUsers.map(function (u) { return translateUser(externalLdapConfig, u); });
return users;
}
async function maybeCreateUser(identifier) {
assert.strictEqual(typeof identifier, 'string');