How to find all the groups the user is a member? (LDAP)

Rodolfo

I am trying to get all the groups that a certain user is a member of.

I have the following structures in ldap:

o=myOrganization
     ou=unit1
         cn=admin
         cn=guess

and

ou=users
    cn=ann
    cn=bob
    cn=carla
  • myOrganization is an instance of Organization
  • unit1 is an instance of OrganizationUnit
  • admin and guess are both GroupOfNames and have everyone as a member
  • ann, bob, and carla are instances of Person

Currently, I am using the ldap module on python and this is what I have:

import ldap
l = ldap.initialize("ldap://my_host")
l.simple_bind_s("[my_dn]", "[my_pass]")
ldap_result = l.search("[BASE_DN]", ldap.SCOPE_SUBTREE, "(&(objectClass=Person)(cn=ann))", None)
res_type, data = l.result(ldap_result, 0)
print(data)

And I am able to get the user ann; but, how do I go about getting the groups Ann belongs to?

I tried, the following from this page:

search_filter='(|(&(objectClass=*)(member=cn=ann)))'
results = l.search_s([BASE_DN], ldap.SCOPE_SUBTREE, search_filter, ['cn',])

しかし、私は空のリストを手に入れました。クエリのさまざまな組み合わせも試しましたが、すべて空になります。

PS:LinuxマシンでOpenLDAPを使用しています

ジョンゴードン

member=cn=ann十分ではありません。アンの完全なDNを使用する必要があります。おそらく次のようなものです。

member=cn=ann,ou=users,dc=company,dc=com

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How to get Ldap user changed attributes instead of all user attributes

分類Dev

How to iterate through user's group membership and return user if they are a member of a list of groups

分類Dev

How to redirect the user according to their user groups in Joomla

分類Dev

How to find the object that a member belongs to

分類Dev

list all the groups to which a user belongs. Using macOS and CentOS

分類Dev

AWS CLI Find All Security Groups which Contain a Rule Allowing All Traffic from All Sources

分類Dev

How to get all security groups that are inbound to All traffic to 0.0.0.0

分類Dev

Find all files Added by git user

分類Dev

How to find all file owned by one user and copy them to another directory in RHEL 8?

分類Dev

LDAP user/group operations

分類Dev

How to drop all user tables?

分類Dev

How to get all groups that a mail-contact belongs to?

分類Dev

How to find all assets of a type?

分類Dev

How to find all the links to a directory

分類Dev

SignalR get groups user is in

分類Dev

mongo .find return specific field only for all user

分類Dev

How to find total login times for a user?

分類Dev

Retrieve user groups in google for work

分類Dev

How to find all equivalent vertices in graph?

分類Dev

How to find all tables that contain columnA and columnB

分類Dev

How to find the location for all repeated elements in array?

分類Dev

how to find all if the array is empty, mongodb

分類Dev

How to find all the ranges in an array of numbers

分類Dev

How to find all maven system properties

分類Dev

How to find *all* startup programs on Windows 10?

分類Dev

How to find all elements that correspond to a vector of keys?

分類Dev

How to `find` all files and folders with 0** permissions?

分類Dev

Join 2 Mysql Tables to list all posts and find users followed by a particular user(Logged INN User)

分類Dev

SonarQube 5.6 LDAP (FreeIPA) authenticated users have no groups

Related 関連記事

  1. 1

    How to get Ldap user changed attributes instead of all user attributes

  2. 2

    How to iterate through user's group membership and return user if they are a member of a list of groups

  3. 3

    How to redirect the user according to their user groups in Joomla

  4. 4

    How to find the object that a member belongs to

  5. 5

    list all the groups to which a user belongs. Using macOS and CentOS

  6. 6

    AWS CLI Find All Security Groups which Contain a Rule Allowing All Traffic from All Sources

  7. 7

    How to get all security groups that are inbound to All traffic to 0.0.0.0

  8. 8

    Find all files Added by git user

  9. 9

    How to find all file owned by one user and copy them to another directory in RHEL 8?

  10. 10

    LDAP user/group operations

  11. 11

    How to drop all user tables?

  12. 12

    How to get all groups that a mail-contact belongs to?

  13. 13

    How to find all assets of a type?

  14. 14

    How to find all the links to a directory

  15. 15

    SignalR get groups user is in

  16. 16

    mongo .find return specific field only for all user

  17. 17

    How to find total login times for a user?

  18. 18

    Retrieve user groups in google for work

  19. 19

    How to find all equivalent vertices in graph?

  20. 20

    How to find all tables that contain columnA and columnB

  21. 21

    How to find the location for all repeated elements in array?

  22. 22

    how to find all if the array is empty, mongodb

  23. 23

    How to find all the ranges in an array of numbers

  24. 24

    How to find all maven system properties

  25. 25

    How to find *all* startup programs on Windows 10?

  26. 26

    How to find all elements that correspond to a vector of keys?

  27. 27

    How to `find` all files and folders with 0** permissions?

  28. 28

    Join 2 Mysql Tables to list all posts and find users followed by a particular user(Logged INN User)

  29. 29

    SonarQube 5.6 LDAP (FreeIPA) authenticated users have no groups

ホットタグ

アーカイブ