diff options
author | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2012-05-13 17:31:09 +0100 |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2012-05-13 17:31:09 +0100 |
commit | 774804d674a36733db51e76ce7da2353f7d5bf2c (patch) | |
tree | 220a7c4e595feba0514ac9e9958249729b8ec592 | |
parent | f73808f23fb87e46d8691e2bed204c0e57dc48dc (diff) | |
download | pykolab-774804d674a36733db51e76ce7da2353f7d5bf2c.tar.gz |
Update set_entry_attributes() to include the capability to delete and replace
-rw-r--r-- | pykolab/auth/ldap/__init__.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py index 6eed427..08b4e66 100644 --- a/pykolab/auth/ldap/__init__.py +++ b/pykolab/auth/ldap/__init__.py @@ -684,6 +684,11 @@ class LDAP(pykolab.base.Base): for attribute in attrs.keys(): if entry.has_key(attribute) and entry[attribute] == None: modlist.append((ldap.MOD_ADD, attribute, attrs[attribute])) + elif entry.has_key(attribute) and not entry[attribute] == None: + if attrs[attribute] == None: + modlist.append((ldap.MOD_DELETE, attribute, entry[attribute])) + else: + modlist.append((ldap.MOD_REPLACE, attribute, attrs[attribute])) dn = entry_dn self.ldap.modify_s(dn, modlist) |