Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom attributes and getUsersForGroup #24

Open
magp3 opened this issue Dec 13, 2017 · 1 comment
Open

Custom attributes and getUsersForGroup #24

magp3 opened this issue Dec 13, 2017 · 1 comment

Comments

@magp3
Copy link

magp3 commented Dec 13, 2017

  attributes: {
         user: ['displayName', 'mail', 'sAMAccountName']
     }

The problem seems to be here: line 70 -
getUsersForGroup.js

At this point u.dn is undefined.
In my case this resulted in only one user from a nested group was returned.

I'm thinking one solution could be to make sure the dn attribute is in
included in the search and then later strip it out of the object added
to the users map to not cause any issues with existing code?

@jsumners
Copy link
Owner

I believe you are correct. That's what this is supposed to do:

utils.pickAttributes(member, this.opts.attributes || ad.defaultAttributes.user)

So I think this will need to be modified to add the dn by default:

function getUsersForGroup (opts, groupName, callback) {
let _opts = opts || {}
let _groupName = groupName
let _cb = callback
if (typeof groupName === 'function') {
_cb = groupName
_groupName = opts
_opts = {}
}

And then the actual method can be updated to use pickAttributes within the iteration.

Would you like to send a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants