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'); const log = require('./service.log'); const re = require('../../configs/config.re'); /** * Checks to see if the LDAP result describes a user entry. * @param {Object} item The LDAP result to inspect. * @returns {Boolean} */ function isUserResult(item) { log.trace('isUserResult(%j)', item); if (!item) return (false); if (item.userPrincipalName) return (true); if (item.objectCategory) { re.isUserResult.lastIndex = 0; // Reset the regular expression return (re.isUserResult.test(item.objectCategory)); } if ((item.objectClass) && (item.objectClass.length > 0)) { return (_.any(item.objectClass, function (c) { return (c.toLowerCase() === 'user'); })); } return (false); } module.exports = isUserResult; |