[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)
This commit is contained in:
parent
9ca3962bf1
commit
fb68147c25
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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…
Reference in New Issue