Closed sd65 closed 8 years ago
I had to revert this merge because it appears the logic is off
old line
this._ad = new ActiveDirectory(options.ldap)
your new code
if (typeof this._ad !== 'function') { this._ad = options.ldap }
else { this._ad = new ActiveDirectory(options.ldap) }
case 1 would always be true since we haven't set this._ad yet
the line should look like
this._ad = (typeof options.ldap === 'function') ? options.ldap : new ActiveDirectory(options.ldap)
i will add this.
My bad, I had to commit with the web interface and made a mistake.
Anyway, thanks for the quick merge ! :+1:
np, just going to update the docs and will publish a build soon.
v1.0.2 published to npm
Hi, I just came back from holidays and this is not usable, there is an error. (This time, I tested my code)
The problem is that both the config an the ActiveDirectory instance are objects. So our condition is not correct.
The good (and more elegant) way is :
this._ad = (options.ldap instanceof ActiveDirectory) ? options.ldap : new ActiveDirectory(options.ldap);
What do you think ?
Ah yes you are correct. I'll publish a fix some time today with your solution. Thanks!
If you already have an ActiveDirectory instance, use it instead of creating a new one.
Exemple :
If you provide an config object, a new instance will be created. Else, the existing one is used.