{"id":831,"date":"2015-08-03T11:17:53","date_gmt":"2015-08-03T11:17:53","guid":{"rendered":"http:\/\/timony.com\/mickzblog\/?p=831"},"modified":"2018-10-03T23:29:42","modified_gmt":"2018-10-03T23:29:42","slug":"python-ldap-list-the-group-membership-of-a-user","status":"publish","type":"post","link":"http:\/\/timony.com\/mickzblog\/2015\/08\/03\/python-ldap-list-the-group-membership-of-a-user\/","title":{"rendered":"Python-LDAP: List the Group Membership of a  User"},"content":{"rendered":"<p>Unless your an LDAP expert it&#8217;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.<\/p>\n<p>This code makes a lot of assumptions and also assumes that a user&#8217;s UID is named &#8216;uid&#8217;.<\/p>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/mick-t\/85fc40d1acaf5e98cad9.js\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/mick-t\/85fc40d1acaf5e98cad9\">Gist<\/a>.<\/noscript><\/div>\n<p>If there&#8217;s a better way to do this, let me know.<\/p>\n<p><strong>References:<\/strong><br \/>\nThis thread on the Python-LDAP mailing list was quite useful:<\/p>\n<ul>\n<li><a href=\"http:\/\/sourceforge.net\/p\/python-ldap\/mailman\/message\/19636166\/\" target=\"_blank\" rel=\"noopener\">http:\/\/sourceforge.net\/p\/python-ldap\/mailman\/message\/19636166\/<\/a><\/li>\n<li>Photo is one I took in 2007 at <a href=\"https:\/\/www.flickr.com\/photos\/timony\/1845113184\/in\/photolist-5tk9DM-3P3FSh\" target=\"_blank\" rel=\"noopener\">Fort Point in Boston.<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Unless your an LDAP expert it&#8217;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&#8217;s UID is named &#8216;uid&#8217;. View the code on Gist. If there&#8217;s a &hellip; <a href=\"http:\/\/timony.com\/mickzblog\/2015\/08\/03\/python-ldap-list-the-group-membership-of-a-user\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Python-LDAP: List the Group Membership of a  User<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":844,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[33,665],"tags":[669,670,710],"class_list":["post-831","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming","category-python","tag-ldap","tag-python","tag-uid"],"_links":{"self":[{"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/posts\/831","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/comments?post=831"}],"version-history":[{"count":10,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/posts\/831\/revisions"}],"predecessor-version":[{"id":934,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/posts\/831\/revisions\/934"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/media\/844"}],"wp:attachment":[{"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/media?parent=831"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/categories?post=831"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/timony.com\/mickzblog\/wp-json\/wp\/v2\/tags?post=831"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}