Given the following code in my index.js, I want to be able to return the
array entries. But it comes back [] what may I be doing wrong? entry.object
is fully populated hence r does have data in it.
Thanks!
function getDistributinGroups(req, res, next) {
var sAMAccountName = res.locals.ntlm.UserName;
var groups = 'OU=Fee,OU=Figh,DC=Fo,DC=lan';
const client = ldapjs.createClient(ldapOptions);
var opts = {
scope: 'sub',
filter: '&(mail=*@*)(managedBy=*)',
attributes: ['dn', 'sn', 'cn','managedBy','mail']
};
client.bind(
ldapconfig.username,
ldapconfig.password, function(err) {
assert.ifError(err);
});
let entries = [];
client.search(groups, opts, function(err, res) {
assert.ifError(err);
res.on('searchEntry', function(entry) {
var r = entry.object;
entries.push(r);
});
res.on('searchReference', function(referral) {
console.log('referral: ' + referral.uris.join());
});
res.on('error', function(err) {
console.error('error: ' + err.message);
});
res.on('end', function(result) {
console.log('status: ' + result.status);
});
});
console.log(entries);
res.send(entries)
}
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.