简体   繁体   中英

Using python ldap3, getting memberof by userid

Can someone help me out with a search for memberof by cn = 'userid' ?

this is what I have so far:

c.search( search_base='DC=ms,DC=ds,DC=company,DC=com',
            search_filter='(CN=userid)',
            search_scope='SUBTREE',
            attributes=['memberOf']) 
c.search(search_base='DC=ms,DC=ds,DC=company,DC=com',
         search_filter=('(sAMAccountName={0})').format(usrname),
         search_scope=SUBTREE,
         attributes=['cn', 'displayName', 'mail','member'])

The above worked for me.

Also you can refer this url as well. Good luck.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM