summaryrefslogtreecommitdiff
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-04 15:17:04 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-04 15:17:04 (GMT)
commit4fa4da38d3d8ecdc0aee090605aaa5ea0e0de0bc (patch)
tree1a9757132117d72b6ba4c0647c712c3de145a89b /pykolab
parent193061bb0bbdfdac9fa537371f5fd395cf9cf5a4 (diff)
downloadpykolab-4fa4da38d3d8ecdc0aee090605aaa5ea0e0de0bc.tar.gz
Actually set entry attributes
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/auth/ldap/__init__.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 98acb0c..5f9bab5 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -654,10 +654,25 @@ class LDAP(pykolab.base.Base):
entry_dn = self.entry_dn(entry_id)
+ entry = self.get_entry_attributes(entry_dn, ['*'])
+
attrs = {}
for attribute in attributes.keys():
attrs[attribute.lower()] = attributes[attribute]
+ modlist = []
+
+ for attribute in attrs.keys():
+ if not entry.has_key(attribute):
+ entry[attribute] = self.get_entry_attribute(entry_id, attribute)
+
+ for attribute in attrs.keys():
+ if entry.has_key(attribute) and entry[attribute] == None:
+ modlist.append((ldap.MOD_ADD, attribute, attrs[attribute]))
+
+ dn = entry_dn
+ self.ldap.modify_s(dn, modlist)
+
def synchronize(self):
"""
Synchronize with LDAP