This commit is contained in:
chenjianxing 2020-05-27 16:30:33 +08:00
commit 48eafa2be0
8 changed files with 23 additions and 14 deletions

View File

@ -69,6 +69,12 @@ public class UserController {
userService.updateUserRole(user); userService.updateUserRole(user);
} }
@PostMapping("/special/update_status")
@RequiresRoles(RoleConstants.ADMIN)
public void updateStatus(@RequestBody User user) {
userService.updateUser(user);
}
@PostMapping("/special/ws/member/list/{goPage}/{pageSize}") @PostMapping("/special/ws/member/list/{goPage}/{pageSize}")
@RequiresRoles(RoleConstants.ADMIN) @RequiresRoles(RoleConstants.ADMIN)
public Pager<List<User>> getMemberListByAdmin(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryMemberRequest request) { public Pager<List<User>> getMemberListByAdmin(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryMemberRequest request) {
@ -120,7 +126,7 @@ public class UserController {
} }
@GetMapping("/list") @GetMapping("/list")
@RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN}, logical = Logical.OR) @RequiresRoles(value = {RoleConstants.ADMIN, RoleConstants.ORG_ADMIN, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
public List<User> getUserList() { public List<User> getUserList() {
return userService.getUserList(); return userService.getUserList();
} }

View File

@ -241,9 +241,7 @@ public class UserService {
userRoleExample.createCriteria().andUserIdEqualTo(userId).andSourceIdEqualTo(request.getWorkspaceId()); userRoleExample.createCriteria().andUserIdEqualTo(userId).andSourceIdEqualTo(request.getWorkspaceId());
List<UserRole> userRoles = userRoleMapper.selectByExample(userRoleExample); List<UserRole> userRoles = userRoleMapper.selectByExample(userRoleExample);
if (userRoles.size() > 0) { if (userRoles.size() > 0) {
User user = userMapper.selectByPrimaryKey(userId); MSException.throwException(Translator.get("user_already_exists"));
String username = user.getName();
MSException.throwException("The user [" + username + "] already exists in the current workspace");
} else { } else {
for (String roleId : request.getRoleIds()) { for (String roleId : request.getRoleIds()) {
UserRole userRole = new UserRole(); UserRole userRole = new UserRole();
@ -274,9 +272,7 @@ public class UserService {
userRoleExample.createCriteria().andUserIdEqualTo(userId).andSourceIdEqualTo(request.getOrganizationId()); userRoleExample.createCriteria().andUserIdEqualTo(userId).andSourceIdEqualTo(request.getOrganizationId());
List<UserRole> userRoles = userRoleMapper.selectByExample(userRoleExample); List<UserRole> userRoles = userRoleMapper.selectByExample(userRoleExample);
if (userRoles.size() > 0) { if (userRoles.size() > 0) {
User user = userMapper.selectByPrimaryKey(userId); MSException.throwException(Translator.get("user_already_exists"));
String username = user.getName();
MSException.throwException("The user [" + username + "] already exists in the current organization");
} else { } else {
for (String roleId : request.getRoleIds()) { for (String roleId : request.getRoleIds()) {
UserRole userRole = new UserRole(); UserRole userRole = new UserRole();

View File

@ -14,6 +14,7 @@ password_is_null=Password cannot be null
user_id_already_exists=User ID already exists user_id_already_exists=User ID already exists
password_modification_failed=Password modification failed password_modification_failed=Password modification failed
cannot_delete_current_user=Cannot delete the user currently logged in cannot_delete_current_user=Cannot delete the user currently logged in
user_already_exists=The user already exists in the current member list
#load test #load test
edit_load_test_not_found=Cannot edit test, test not found= edit_load_test_not_found=Cannot edit test, test not found=
run_load_test_not_found=Cannot run test, test not found= run_load_test_not_found=Cannot run test, test not found=

View File

@ -14,6 +14,7 @@ user_id_already_exists=用户id已存在
password_modification_failed=密码修改失败 password_modification_failed=密码修改失败
cannot_delete_current_user=无法删除当前登录用户 cannot_delete_current_user=无法删除当前登录用户
connection_failed=连接失败 connection_failed=连接失败
user_already_exists=该用户已存在于当前成员列表中
#load test #load test
edit_load_test_not_found=无法编辑测试,未找到测试: edit_load_test_not_found=无法编辑测试,未找到测试:
run_load_test_not_found=无法运行测试,未找到测试: run_load_test_not_found=无法运行测试,未找到测试:

View File

@ -14,6 +14,7 @@ password_is_null=密碼不能為空
user_id_already_exists=用戶id已存在 user_id_already_exists=用戶id已存在
password_modification_failed=密碼修改失敗 password_modification_failed=密碼修改失敗
cannot_delete_current_user=無法刪除當前登錄用戶 cannot_delete_current_user=無法刪除當前登錄用戶
user_already_exists=該用戶已存在於當前成員列表中
#load test #load test
edit_load_test_not_found=無法編輯測試,未找到測試: edit_load_test_not_found=無法編輯測試,未找到測試:
run_load_test_not_found=無法運行測試,未找到測試: run_load_test_not_found=無法運行測試,未找到測試:

View File

@ -212,7 +212,7 @@
} }
this.form = {}; this.form = {};
this.createVisible = true; this.createVisible = true;
this.result = this.$get('/user/besideorg/list/' + this.currentUser().lastOrganizationId, response => { this.result = this.$get('/user/list/', response => {
this.userList = response.data; this.userList = response.data;
}); });
this.result = this.$get('/role/list/org', response => { this.result = this.$get('/role/list/org', response => {

View File

@ -489,7 +489,7 @@
this.btnAddRole = false; this.btnAddRole = false;
}, },
changeSwitch(row) { changeSwitch(row) {
this.$post(this.updatePath, row, () => { this.$post('/user/special/update_status', row, () => {
this.$success(this.$t('commons.modify_success')); this.$success(this.$t('commons.modify_success'));
}) })
}, },

View File

@ -214,16 +214,20 @@
}, },
create() { create() {
this.form = {}; this.form = {};
let param = { // let param = {
name: this.condition.name, // name: this.condition.name,
organizationId: this.currentUser().lastOrganizationId // organizationId: this.currentUser().lastOrganizationId
}; // };
let wsId = this.currentUser().lastWorkspaceId; let wsId = this.currentUser().lastWorkspaceId;
if (typeof wsId == "undefined" || wsId == null || wsId == "") { if (typeof wsId == "undefined" || wsId == null || wsId == "") {
this.$warning(this.$t('workspace.please_select_a_workspace_first')); this.$warning(this.$t('workspace.please_select_a_workspace_first'));
return false; return false;
} }
this.$post('/user/org/member/list/all', param, response => { // this.$post('/user/org/member/list/all', param, response => {
// this.createVisible = true;
// this.userList = response.data;
// })
this.$get('/user/list/', response => {
this.createVisible = true; this.createVisible = true;
this.userList = response.data; this.userList = response.data;
}) })