ezldap: use only "varnamed" fields in set_attributes_from_formdata (fix #1725)

This commit is contained in:
Thomas NOËL 2012-10-04 22:17:46 +02:00
parent cb056864a8
commit 5ed9207bef
1 changed files with 4 additions and 9 deletions

View File

@ -156,18 +156,13 @@ class EzLdapUser(object):
def set_attributes_from_formdata(self, formdata):
new_entry = self.get_ldap_dict().copy()
for k, v in formdata.items():
attr = k
# if k is an wcs user ID, the ldap attribute is the varname
# for each field, the ldap attribute is the varname
for admin_field in User.get_formdef().fields:
if k == admin_field.id:
attr = admin_field.varname
if isinstance(v, time.struct_time):
v = time.strftime('%Y%m%d%H%M%SZ',v)
new_entry[admin_field.varname] = v or ''
break
if v:
if isinstance(v, time.struct_time):
v = time.strftime('%Y%m%d%H%M%SZ',v)
new_entry[attr] = v
else:
new_entry[attr] = ''
mod_list = ldap.modlist.modifyModlist(self.get_ldap_dict(), new_entry)
if mod_list: