修正:导入LDAP用户时,如果之前未导入过LDAP用户,会提示参数错误而无法导入。

hotfix/3.2.2-secure-fix
Apex Liu 2019-01-08 16:10:49 +08:00
parent 051c79a053
commit a0e9c689b4
1 changed files with 6 additions and 5 deletions

View File

@ -555,12 +555,13 @@ class DoLdapGetUsersHandler(TPBaseJsonHandler):
if ret != TPE_OK:
return self.write_json(ret, message=err_msg)
exits_users = user.get_users_by_type(TP_USER_TYPE_LDAP)
exists_users = user.get_users_by_type(TP_USER_TYPE_LDAP)
bound_users = []
for u in exits_users:
h = hashlib.sha1()
h.update(u['ldap_dn'].encode())
bound_users.append(h.hexdigest())
if exists_users is not None:
for u in exists_users:
h = hashlib.sha1()
h.update(u['ldap_dn'].encode())
bound_users.append(h.hexdigest())
ret_data = []
for u in data: