Browse Source

Merge pull request #110 from samz406/master

TENANT_NAME_EXIST 这里实际验证的是租户编码,不是租户名称是否唯一。
pull/2/head
easyscheduler 6 years ago committed by GitHub
parent
commit
49fdee0cc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      escheduler-api/src/main/java/cn/escheduler/api/enums/Status.java
  2. 5
      escheduler-api/src/main/java/cn/escheduler/api/service/UsersService.java

2
escheduler-api/src/main/java/cn/escheduler/api/enums/Status.java

@ -31,7 +31,7 @@ public enum Status {
HDFS_OPERATION_ERROR(10006, "hdfs operation error"), HDFS_OPERATION_ERROR(10006, "hdfs operation error"),
UPDATE_FAILED(10007, "updateProcessInstance failed"), UPDATE_FAILED(10007, "updateProcessInstance failed"),
TASK_INSTANCE_HOST_NOT_FOUND(10008, "task instance does not set host"), TASK_INSTANCE_HOST_NOT_FOUND(10008, "task instance does not set host"),
TENANT_NAME_EXIST(10009, "tenant name already exists"), TENANT_NAME_EXIST(10009, "tenant code already exists"),
USER_NOT_EXIST(10010, "user {0} not exists"), USER_NOT_EXIST(10010, "user {0} not exists"),
ALERT_GROUP_NOT_EXIST(10011, "alarm group not found"), ALERT_GROUP_NOT_EXIST(10011, "alarm group not found"),
ALERT_GROUP_EXIST(10012, "alarm group already exists"), ALERT_GROUP_EXIST(10012, "alarm group already exists"),

5
escheduler-api/src/main/java/cn/escheduler/api/service/UsersService.java

@ -216,6 +216,11 @@ public class UsersService extends BaseService {
Date now = new Date(); Date now = new Date();
if (StringUtils.isNotEmpty(userName)) { if (StringUtils.isNotEmpty(userName)) {
User tempUser = userMapper.queryByUserName(userName);
if (tempUser != null && tempUser.getId() != userId) {
putMsg(result, Status.USER_NAME_EXIST);
return result;
}
user.setUserName(userName); user.setUserName(userName);
} }

Loading…
Cancel
Save