mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-04 21:19:52 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a483732635
@ -10,6 +10,8 @@ MeterSphere 是一站式的开源企业级持续测试平台,涵盖测试跟
|
||||
- 性能测试: 兼容 JMeter,支持 Kubernetes 和云环境,轻松支持高并发、分布式的性能测试;
|
||||
- 团队协作: 两级租户体系,天然支持团队协作。
|
||||
|
||||
![产品定位](https://metersphere.io/images/icon/ct-devops.png)
|
||||
|
||||
UI 展示:
|
||||
|
||||
![UI](https://metersphere.io/images/screenshot/ss07.png)
|
||||
|
@ -293,7 +293,7 @@
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.41</version>
|
||||
<version>8.0.16</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.itfsw</groupId>
|
||||
|
@ -1,5 +1,5 @@
|
||||
package io.metersphere.commons.constants;
|
||||
|
||||
public enum UserSource {
|
||||
Local, Ldap
|
||||
LOCAL, LDAP
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ public class LdapController {
|
||||
user.setName(username);
|
||||
user.setEmail(email);
|
||||
user.setPassword(password);
|
||||
user.setSource(UserSource.Ldap.name());
|
||||
userService.createUser(user);
|
||||
user.setSource(UserSource.LDAP.name());
|
||||
userService.addLdapUser(user);
|
||||
} else {
|
||||
request.setUsername(u.getId());
|
||||
request.setPassword(u.getPassword());
|
||||
|
@ -138,17 +138,29 @@ public class UserService {
|
||||
user.setUpdateTime(System.currentTimeMillis());
|
||||
// 默认1:启用状态
|
||||
user.setStatus(UserStatus.NORMAL);
|
||||
user.setSource(UserSource.Local.name());
|
||||
user.setSource(UserSource.LOCAL.name());
|
||||
// 密码使用 MD5
|
||||
user.setPassword(CodingUtil.md5(user.getPassword()));
|
||||
checkEmailIsExist(user.getEmail());
|
||||
userMapper.insertSelective(user);
|
||||
}
|
||||
|
||||
public void addLdapUser(User user) {
|
||||
user.setCreateTime(System.currentTimeMillis());
|
||||
user.setUpdateTime(System.currentTimeMillis());
|
||||
user.setStatus(UserStatus.NORMAL);
|
||||
checkEmailIsExist(user.getEmail());
|
||||
userMapper.insertSelective(user);
|
||||
}
|
||||
|
||||
private void checkEmailIsExist(String email) {
|
||||
UserExample userExample = new UserExample();
|
||||
UserExample.Criteria criteria = userExample.createCriteria();
|
||||
criteria.andEmailEqualTo(user.getEmail());
|
||||
criteria.andEmailEqualTo(email);
|
||||
List<User> userList = userMapper.selectByExample(userExample);
|
||||
if (!CollectionUtils.isEmpty(userList)) {
|
||||
MSException.throwException(Translator.get("user_email_already_exists"));
|
||||
}
|
||||
userMapper.insertSelective(user);
|
||||
}
|
||||
|
||||
public UserDTO getUserDTO(String userId) {
|
||||
|
@ -1,3 +1,3 @@
|
||||
alter table user add source varchar(50) null;
|
||||
|
||||
update user set source = 'Local' where source is null;
|
||||
update user set source = 'LOCAL' where source is null;
|
Loading…
Reference in New Issue
Block a user