Python-LDAP: List the Group Membership of a User

Unless your an LDAP expert it’s not obvious how to find the groups a user is a member of, and that also describes how you need to tackle this problem.

This code makes a lot of assumptions and also assumes that a user’s UID is named ‘uid’.

If there’s a better way to do this, let me know.

References:
This thread on the Python-LDAP mailing list was quite useful:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.