noirello / bonsai

Simple Python 3 module for LDAP, using libldap2 and winldap C libraries.
MIT License
116 stars 32 forks source link

How to get operational attributes #46

Closed leophys closed 3 years ago

leophys commented 3 years ago

Hi again :relaxed: Sorry for bothering. I am looking for a way to retrieve also operational attributes from a search. I specifically need for a way to obtain the values for memberOf associated to an entry that belongs to some groupOfNames.

Is there any way to do that easily?

Thanks again for this nice library!

leophys commented 3 years ago

As usual, a simple try:

LDAPConnection.search("dn_of_the_entry", attrlist=["memberOf"])

This returns (if the entry exists):

[{'dn': <LDAPDN dn_of_the_entry>, 'memberOf': <list_of_dn_of_the_groups>}]

Thanks again :)