Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
q4speed 2020-05-20 15:25:55 +08:00
commit 41bdc4e3f2
3 changed files with 0 additions and 36 deletions

View File

@ -13,7 +13,6 @@ import io.metersphere.controller.request.UserRequest;
import io.metersphere.controller.request.member.AddMemberRequest;
import io.metersphere.controller.request.member.EditPassWordRequest;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.controller.request.member.SetAdminRequest;
import io.metersphere.controller.request.organization.AddOrgMemberRequest;
import io.metersphere.controller.request.organization.QueryOrgMemberRequest;
import io.metersphere.dto.UserDTO;
@ -270,10 +269,4 @@ public class UserController {
return userService.updateUserPassword(request);
}
@PostMapping("/set/admin")
@RequiresRoles(RoleConstants.ADMIN)
public void setAdmin(@RequestBody SetAdminRequest request) {
userService.setAdmin(request);
}
}

View File

@ -1,10 +0,0 @@
package io.metersphere.controller.request.member;
import lombok.Data;
@Data
public class SetAdminRequest {
private String id;
private String adminId;
private String password;
}

View File

@ -4,7 +4,6 @@ import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtUserMapper;
import io.metersphere.base.mapper.ext.ExtUserRoleMapper;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.CodingUtil;
@ -13,7 +12,6 @@ import io.metersphere.controller.request.UserRequest;
import io.metersphere.controller.request.member.AddMemberRequest;
import io.metersphere.controller.request.member.EditPassWordRequest;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.controller.request.member.SetAdminRequest;
import io.metersphere.controller.request.organization.AddOrgMemberRequest;
import io.metersphere.controller.request.organization.QueryOrgMemberRequest;
import io.metersphere.dto.UserDTO;
@ -336,23 +334,6 @@ public class UserService {
return extUserMapper.updatePassword(user);
}
public void setAdmin(SetAdminRequest request) {
String adminId = request.getAdminId();
String password = request.getPassword();
if (!checkUserPassword(adminId, password)) {
MSException.throwException("verification failed");
}
UserRole userRole = new UserRole();
userRole.setId(UUID.randomUUID().toString());
userRole.setUserId(request.getId());
// TODO 修改admin sourceId
userRole.setSourceId("adminSourceId");
userRole.setRoleId(RoleConstants.ADMIN);
userRole.setCreateTime(System.currentTimeMillis());
userRole.setUpdateTime(System.currentTimeMillis());
userRoleMapper.insertSelective(userRole);
}
public String getDefaultLanguage() {
final String key = "default.language";
return extUserMapper.getDefaultLanguage(key);