Last active
December 19, 2019 16:45
-
-
Save witsch/7580331 to your computer and use it in GitHub Desktop.
Patch for "posixGroup" support in `Products.LDAPUserFolder` 2.26 based on http://davidjb.com/blog/2010/06/plonezope-using-ldapuserfolder-with-posixgroups/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[buildout] | |
... | |
parts = | |
... | |
patches | |
... | |
[patches] | |
recipe = collective.recipe.patch | |
egg = Products.LDAPUserFolder | |
patches = ldap-posixGroup-support.patch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Products/LDAPUserFolder/LDAPUserFolder.py b/Products/LDAPUserFolder/LDAPUserFolder.py | |
index c570679..19daae2 100644 | |
--- Products/LDAPUserFolder/LDAPUserFolder.py | |
+++ Products/LDAPUserFolder/LDAPUserFolder.py | |
@@ -963,6 +963,8 @@ class LDAPUserFolder(BasicUserFolder): | |
for dn in all_dns.keys(): | |
try: | |
+ if 'uid=' not in dn: | |
+ dn = 'uid=%s,%s' % (dn, self.users_base) | |
user = self.getUserByDN(to_utf8(dn)) | |
except: | |
user = None | |
@@ -1228,6 +1230,8 @@ class LDAPUserFolder(BasicUserFolder): | |
f_template = '(&(objectClass=%s)(%s=%s))' | |
group_filter = '(|' | |
+ dn = dn.replace('uid=', '').replace(',' + self.users_base, '') | |
+ | |
for g_name, m_name in GROUP_MEMBER_MAP.items(): | |
fltr = filter_format(f_template, (g_name, m_name, dn)) | |
group_filter += fltr | |
diff --git a/Products/LDAPUserFolder/utils.py b/Products/LDAPUserFolder/utils.py | |
index 83d6f95..f6de93f 100644 | |
--- Products/LDAPUserFolder/utils.py | |
+++ Products/LDAPUserFolder/utils.py | |
@@ -47,6 +47,7 @@ GROUP_MEMBER_MAP = { 'groupOfUniqueNames' : 'uniqueMember' | |
, 'accessGroup' : 'member' | |
, 'group' : 'member' | |
, 'univentionGroup' : 'uniqueMember' | |
+ , 'posixGroup' : 'memberUid' | |
} | |
GROUP_MEMBER_ATTRIBUTES = Set(list(GROUP_MEMBER_MAP.values())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment