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
23 lines (20 loc) • 865 B
JavaScript
const parseDistinguishedName = require('./service.parseDistinguishedName');
const isDistinguishedName = require('./service.isDistinguishedName');
let log = require('./service.log');
/**
* Gets the ActiveDirectory LDAP query string for a group search.
*
* @private
* @param {String} groupName The name of the group
* @returns {String}
*/
function getGroupQueryFilter(groupName) {
log.trace('getGroupQueryFilter(%s)', groupName);
var self = this;
if (!groupName) return ('(objectCategory=Group)');
if (isDistinguishedName.call(self, groupName)) {
return ('(&(objectCategory=Group)(distinguishedName=' + parseDistinguishedName(groupName) + '))');
}
return ('(&(objectCategory=Group)(cn=' + groupName + '))');
}
module.exports = getGroupQueryFilter;