ezldap: use only "varnamed" fields in set_attributes_from_formdata (fix #1725)
This commit is contained in:
parent
cb056864a8
commit
5ed9207bef
|
@ -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:
|
||||
|
|
Reference in New Issue