fix: 修复重复ldap用户

This commit is contained in:
fit2cloud-chenyw 2021-09-23 18:57:10 +08:00
parent 97a4c8bd72
commit 2e1ec00ad4

View File

@ -70,12 +70,16 @@ public class AuthServer implements AuthApi {
DataEaseException.throwException(validateResult.getMsg());
}
XpackLdapUserEntity ldapUserEntity = validateResult.getData();
SysUserEntity user = authUserService.getUserByName(username);
if(ObjectUtils.isEmpty(user) || ObjectUtils.isEmpty(user.getUserId())) {
LdapAddRequest ldapAddRequest = new LdapAddRequest();
ldapAddRequest.setUsers(new ArrayList<XpackLdapUserEntity>(){{add(ldapUserEntity);}});
ldapAddRequest.setEnabled(1L);
ldapAddRequest.setDeptId(1L);
ldapAddRequest.setRoleIds(new ArrayList<Long>(){{add(2L);}});
sysUserService.saveLdapUsers(ldapAddRequest);
}
username = validateResult.getData().getUserName();
}
// 增加ldap登录方式