ad-promise
Version:
This is a fork of the gheeres node-activedirectory. It fixes some issues with timeouts with very large AD-Groups as well as returning also promises so you won't have to use callbacks
20 lines (17 loc) • 726 B
JavaScript
let log = require('./service.log');
/**
* Gets a properly formatted LDAP compound filter. This is a very simple approach to ensure that the LDAP
* compound filter is wrapped with an enclosing () if necessary. It does not handle parsing of an existing
* compound ldap filter.
* @param {String} filter The LDAP filter to inspect.
* @returns {String}
*/
function getCompoundFilter(filter) {
log.trace('getCompoundFilter(%s)', filter);
if (!filter) return (false);
if ((filter.charAt(0) === '(') && (filter.charAt(filter.length - 1) === ')')) {
return (filter);
}
return ('(' + filter + ')');
}
module.exports = getCompoundFilter;