Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 1x 1x 1x 1x | const _ = require('underscore');
let log = require('./service.log');
const re = require('../../configs/config.re');
/**
* Checks to see if the LDAP result describes a group entry.
* @param {Object} item The LDAP result to inspect.
* @returns {Boolean}
*/
function isGroupResult(item) {
log.trace('isGroupResult(%j)', item);
if (!item) return (false);
if (item.groupType) return (true);
if (item.objectCategory) {
re.isGroupResult.lastIndex = 0; // Reset the regular expression
return (re.isGroupResult.test(item.objectCategory));
}
if ((item.objectClass) && (item.objectClass.length > 0)) {
return (_.any(item.objectClass, function (c) { return (c.toLowerCase() === 'group'); }));
}
return (false);
}
module.exports = isGroupResult; |