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 | 1x 1x 1x 1x 1x | const _ = require('underscore');
const includeGroupMembershipFor = require('./service.includeGroupMembershipFor');
const shouldIncludeAllAttributes = require('./service.shouldIncludeAllAttributes');
/**
* Gets the required ldap attributes for user related queries in order to
* do recursive queries, etc.
*
* @private
* @params {Object} [opts] Optional LDAP query string parameters to execute. { scope: '', filter: '', attributes: [ '', '', ... ], sizeLimit: 0, timelimit: 0 }
*/
const getRequiredLdapAttributesForUser = opts => {
if (shouldIncludeAllAttributes((opts || {}).attributes)) {
return ([]);
}
return (_.union(['dn', 'cn'],
includeGroupMembershipFor(opts, 'user') ? ['member'] : []));
}
module.exports = getRequiredLdapAttributesForUser; |