Browse Source

[Fix-10080]When the created tenant name is too long, an error message will be prompted (#10081)

* [Fix-10080]When the created tenant name is too long, an error message will be prompted

* [Fix-10080]When the created tenant name is too long, an error message will be prompted

* [Fix-10080]When the created tenant name is too long, an error message will be prompted

Co-authored-by: houshitao <shitaohou@163.com>

(cherry picked from commit 67cf7b2800)
2.0.7-release
hstdream 3 years ago committed by Jiajie Zhong
parent
commit
fb68147c25
  1. 3
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
  2. 7
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java
  3. 5
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java

3
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java

@ -350,7 +350,8 @@ public enum Status {
UPDATE_ENVIRONMENT_WORKER_GROUP_RELATION_ERROR(1200013,"You can't modify the worker group, because the worker group [{0}] and this environment [{1}] already be used in the task [{2}]",
"您不能修改工作组选项,因为该工作组 [{0}] 和 该环境 [{1}] 已经被用在任务 [{2}] 中"),
NOT_ALLOW_TO_DISABLE_OWN_ACCOUNT(130020, "Not allow to disable your own account", "不能停用自己的账号"),
VERIFY_PARAMETER_NAME_FAILED(1300009, "The file name verify failed", "文件命名校验失败");
VERIFY_PARAMETER_NAME_FAILED(1300009, "The file name verify failed", "文件命名校验失败"),
TENANT_FULL_NAME_TOO_LONG_ERROR(1300016, "tenant's fullname is too long error", "租户名过长");
private final int code;

7
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TenantServiceImpl.java

@ -17,6 +17,8 @@
package org.apache.dolphinscheduler.api.service.impl;
import static org.apache.dolphinscheduler.common.Constants.TENANT_FULL_NAME_MAX_LENGTH;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.TenantService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
@ -90,6 +92,11 @@ public class TenantServiceImpl extends BaseServiceImpl implements TenantService
return result;
}
if(StringUtils.length(tenantCode) > TENANT_FULL_NAME_MAX_LENGTH){
putMsg(result, Status.TENANT_FULL_NAME_TOO_LONG_ERROR);
return result;
}
if (!RegexUtils.isValidLinuxUserName(tenantCode)) {
putMsg(result, Status.CHECK_OS_TENANT_CODE_ERROR);
return result;

5
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java

@ -1092,4 +1092,9 @@ public final class Constants {
public static final int DRY_RUN_FLAG_YES = 1;
public static final String CACHE_KEY_VALUE_ALL = "'all'";
/**
* tenant
*/
public static final int TENANT_FULL_NAME_MAX_LENGTH = 30;
}

Loading…
Cancel
Save