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()); DataEaseException.throwException(validateResult.getMsg());
} }
XpackLdapUserEntity ldapUserEntity = validateResult.getData(); XpackLdapUserEntity ldapUserEntity = validateResult.getData();
LdapAddRequest ldapAddRequest = new LdapAddRequest(); SysUserEntity user = authUserService.getUserByName(username);
ldapAddRequest.setUsers(new ArrayList<XpackLdapUserEntity>(){{add(ldapUserEntity);}}); if(ObjectUtils.isEmpty(user) || ObjectUtils.isEmpty(user.getUserId())) {
ldapAddRequest.setEnabled(1L); LdapAddRequest ldapAddRequest = new LdapAddRequest();
ldapAddRequest.setDeptId(1L); ldapAddRequest.setUsers(new ArrayList<XpackLdapUserEntity>(){{add(ldapUserEntity);}});
ldapAddRequest.setRoleIds(new ArrayList<Long>(){{add(2L);}}); ldapAddRequest.setEnabled(1L);
sysUserService.saveLdapUsers(ldapAddRequest); ldapAddRequest.setDeptId(1L);
ldapAddRequest.setRoleIds(new ArrayList<Long>(){{add(2L);}});
sysUserService.saveLdapUsers(ldapAddRequest);
}
username = validateResult.getData().getUserName(); username = validateResult.getData().getUserName();
} }
// 增加ldap登录方式 // 增加ldap登录方式