gheeres / node-activedirectory

ActiveDirectory is an Node.js ldapjs client for authN (authentication) and authZ (authorization) for Microsoft Active Directory with range retrieval support for large Active Directory installations.
MIT License
534 stars 147 forks source link

Promises? #188

Open cope opened 6 years ago

cope commented 6 years ago

Do you plan to replace callbacks with (or just add) promises?

Or do you know any promisifying solutions that work with node-activedirectory?

I tried util.promisify on the getUsersForGroup method, but that throws the self.findGroup is not a function error :(

relief-melone commented 6 years ago

See issue 189 (https://github.com/gheeres/node-activedirectory/issues/189). Forked it and started on rebuilding it a little bit. Looks like it would solve some problems.

relief-melone commented 6 years ago

Allright. Back from vacation.

Voila. Still a work in progress. But should at least work with code that is implemented with the original module and promises are in it too. If you find any issues it woudl be great if you reported them https://www.npmjs.com/package/ad-promise

yoavke commented 2 years ago

I'm not sure how they implemented util.promisify but it won't work with node-activedirectory. The callback has the correct structure for util.promisify (err, res) but it loses the config, hence you lose the communication with the AD. What you can do in the meanwhile is wrapping the methods you need from node-activedirectory with a promise.