txstate-etc / ldap-async

A wrapper around ldapjs to provide promises, pooling, config by environment, and other conveniences.
MIT License
11 stars 5 forks source link

Question: How to clear or delete an attribute? #6

Closed tfrancois closed 2 years ago

tfrancois commented 2 years ago

I am trying to figure out how to clear or delete an attribute using this library and don't think you have an explicit method to do so. I am looking to completely delete (set to which basically removes the attribute completely. I can confirm this is needed because when I use AD Explorer, I can see delete native attributes without issue.

Basically, need a method that does this in this library while benefitting from the pooled connection as opposed to having to use LDAPJS directly (and using a separate connection): https://stackoverflow.com/questions/43759952/ldapjs-how-to-delete-attribute

Thanks!

wickning1 commented 2 years ago

You can use setAttribute() with undefined as the value. There's an automated test that ensures this works as you'd expect.

tfrancois commented 2 years ago

Thank you!