summaryrefslogtreecommitdiffstats
path: root/ipaserver/plugins
diff options
context:
space:
mode:
authorPavel Zuna <pzuna@redhat.com>2009-10-29 17:14:09 +0100
committerMartin Nagy <mnagy@redhat.com>2009-12-02 13:04:00 +0100
commitf3bd9bfb595cc71184d0aa760b28670e336142ab (patch)
treeb69396b0b1541e879fb788354b67f04518f99ed6 /ipaserver/plugins
parent4348b5f8c4677443f47f3d5c906549825b25ec72 (diff)
downloadfreeipa-f3bd9bfb595cc71184d0aa760b28670e336142ab.tar.gz
freeipa-f3bd9bfb595cc71184d0aa760b28670e336142ab.tar.xz
freeipa-f3bd9bfb595cc71184d0aa760b28670e336142ab.zip
Remove ldap2.convert_attr_synonyms. Turns out python-ldap can replace it.
Diffstat (limited to 'ipaserver/plugins')
-rw-r--r--ipaserver/plugins/ldap2.py31
1 files changed, 1 insertions, 30 deletions
diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py
index 4d1f89695..8203d2d08 100644
--- a/ipaserver/plugins/ldap2.py
+++ b/ipaserver/plugins/ldap2.py
@@ -307,33 +307,6 @@ class ldap2(CrudBackend, Encoder):
rdn = self.make_rdn_from_attr(primary_key, entry_attrs[primary_key])
return self.make_dn_from_rdn(rdn, parent_dn)
- def convert_attr_synonyms(self, entry_attrs, preferred_names=None):
- """
- Convert attribute names in entry_attrs to preferred synonyms.
-
- Keyword arguments:
- preferred_names -- list of preferred synomyms or None for defaults
- (default None)
- """
- global _schema
- if preferred_names:
- for n in preferred_names:
- attr = _schema.get_obj(_ldap.schema.AttributeType, n)
- synonyms = [v.lower() for v in attr.names]
- synonyms.remove(n)
- for s in synonyms:
- if s in entry_attrs:
- entry_attrs[n] = entry_attrs[s]
- del entry_attrs[s]
- else:
- for (k, v) in entry_attrs.items():
- attr = _schema.get_obj(_ldap.schema.AttributeType, k)
- synonyms = [v.lower() for v in attr.names]
- preferred_name = synonyms[0]
- if k in synonyms[1:]:
- entry_attrs[preferred_name] = v
- del entry_attrs[k]
-
@encode_args(1, 2)
def add_entry(self, dn, entry_attrs, normalize=True):
"""Create a new entry."""
@@ -590,13 +563,11 @@ class ldap2(CrudBackend, Encoder):
def _generate_modlist(self, dn, entry_attrs):
# get original entry
- (dn, entry_attrs_old) = self.get_entry(dn, ['*', 'aci'])
+ (dn, entry_attrs_old) = self.get_entry(dn, entry_attrs.keys())
# get_entry returns a decoded entry, encode it back
# we could call search_s directly, but this saves a lot of code at
# the expense of a little bit of performace
entry_attrs_old = self.encode(entry_attrs_old)
- # we also need to make sure that attribute names match
- self.convert_attr_synonyms(entry_attrs_old, entry_attrs.keys())
# generate modlist, we don't want any MOD_REPLACE operations
# to handle simultaneous updates better
modlist = []