diff options
author | Jan Cholasta <jcholast@redhat.com> | 2013-12-10 11:41:17 +0100 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2014-01-10 14:41:39 +0100 |
commit | 21fab665f482445ebcdcedffad7182acdb02fa28 (patch) | |
tree | 6a12a0d9bfe90216c6254af9d3617db9009fb038 /ipapython | |
parent | 8d67acc02609415aacd2cb16979443d9edc0ee22 (diff) | |
download | freeipa-21fab665f482445ebcdcedffad7182acdb02fa28.tar.gz freeipa-21fab665f482445ebcdcedffad7182acdb02fa28.tar.xz freeipa-21fab665f482445ebcdcedffad7182acdb02fa28.zip |
Use LDAPClient.update_entry for LDAP mods in ldapupdate.
Remove legacy IPAdmin methods generateModList and updateEntry.
https://fedorahosted.org/freeipa/ticket/3488
Diffstat (limited to 'ipapython')
-rw-r--r-- | ipapython/ipaldap.py | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py index 3579935ee..6fcd1228b 100644 --- a/ipapython/ipaldap.py +++ b/ipapython/ipaldap.py @@ -1775,66 +1775,6 @@ class IPAdmin(LDAPClient): self.__bind_with_wait( self.conn.sasl_interactive_bind_s, timeout, None, auth_tokens) - def updateEntry(self,dn,oldentry,newentry): - # FIXME: for backwards compatibility only - """This wraps the mod function. It assumes that the entry is already - populated with all of the desired objectclasses and attributes""" - - assert isinstance(dn, DN) - - modlist = self.generateModList(oldentry, newentry) - - if len(modlist) == 0: - raise errors.EmptyModlist - - with self.error_handler(): - self.modify_s(dn, modlist) - return True - - def generateModList(self, old_entry, new_entry): - # FIXME: for backwards compatibility only - """A mod list generator that computes more precise modification lists - than the python-ldap version. For single-value attributes always - use a REPLACE operation, otherwise use ADD/DEL. - """ - - # Some attributes, like those in cn=config, need to be replaced - # not deleted/added. - FORCE_REPLACE_ON_UPDATE_ATTRS = ('nsslapd-ssl-check-hostname', 'nsslapd-lookthroughlimit', 'nsslapd-idlistscanlimit', 'nsslapd-anonlimitsdn', 'nsslapd-minssf-exclude-rootdse') - modlist = [] - - keys = set(old_entry.keys()) - keys.update(new_entry.keys()) - - for key in keys: - new_values = new_entry.raw.get(key, []) - old_values = old_entry.raw.get(key, []) - - # We used to convert to sets and use difference to calculate - # the changes but this did not preserve order which is important - # particularly for schema - adds = [x for x in new_values if x not in old_values] - removes = [x for x in old_values if x not in new_values] - - if len(adds) == 0 and len(removes) == 0: - continue - - is_single_value = self.get_single_value(key) - force_replace = False - if key in FORCE_REPLACE_ON_UPDATE_ATTRS or is_single_value: - force_replace = True - - if adds: - if force_replace: - modlist.append((ldap.MOD_REPLACE, key, adds)) - else: - modlist.append((ldap.MOD_ADD, key, adds)) - if removes: - if not force_replace or not new_values: - modlist.append((ldap.MOD_DELETE, key, removes)) - - return modlist - def modify_s(self, *args, **kwargs): # FIXME: for backwards compatibility only return self.conn.modify_s(*args, **kwargs) |