mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #9091 from tb365/bugfix/tb-bugfix-1130
fix(region): reserved name checking while create redis account
This commit is contained in:
@@ -2333,8 +2333,46 @@ func (self *SManagedVirtualizationRegionDriver) RequestElasticcacheUpdateBackupP
|
||||
}
|
||||
|
||||
func (self *SManagedVirtualizationRegionDriver) ValidateCreateElasticcacheAccountData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error) {
|
||||
if name, _ := data.GetString("name"); name == "root" {
|
||||
return nil, httperrors.NewConflictError("account name 'root' is not allowed")
|
||||
reservedNames := []string{
|
||||
"add", "admin", "all", "alter", "analyze", "and", "as", "asc",
|
||||
"asensitive", "aurora", "before", "between", "bigint", "binary",
|
||||
"blob", "both", "by", "call", "cascade", "case", "change",
|
||||
"char", "character", "check", "collate", "column", "condition",
|
||||
"connection", "constraint", "continue", "convert", "create",
|
||||
"cross", "current_date", "current_time", "current_timestamp",
|
||||
"current_user", "cursor", " database", "databases", "day_hour",
|
||||
"day_microsecond", "day_minute", "day_second", "dec", "decimal",
|
||||
"declare", "default", "delayed", "delete", "desc", "describe",
|
||||
"deterministic", "distinct", "distinctrow", "div", "double",
|
||||
"drc_rds", "drop", "dual", "each", "eagleye", "else", "elseif",
|
||||
"enclosed", "escaped", "exists", "exit", "explain", "false",
|
||||
"fetch", "float", "float4", "float8", "for", "force", "foreign",
|
||||
"from", "fulltext", " goto", "grant", "group", "guest", "having",
|
||||
"high_priority", "hour_microsecond", "hour_minute", "hour_second",
|
||||
"if", "ignore", "in", "index", "infile", "information_schema", "inner",
|
||||
"inout", "insensitive", "insert", "int", "int1", "int2", "int3", "int4",
|
||||
"int8", "integer", "interval", "into", "is", "iterate", "join", "key", "keys",
|
||||
"kill", "label", "leading", "leave", "left", "like", "limit", "linear", "lines",
|
||||
"load", "localtime", "localtimestamp", "lock", "long", "longblob", "longtext",
|
||||
"loop", "low_priority", " match", "mediumblob", "mediumint", "mediumtext",
|
||||
"middleint", "minute_microsecond", "minute_second", "mod", "modifies",
|
||||
"mysql", "natural", "no_write_to_binlog", "not", "null", "numeric",
|
||||
"on", "optimize", "option", "optionally", "or", "order", "out", "outer",
|
||||
"outfile", "precision", "primary", "procedure", "purge",
|
||||
"raid0", "range", "read", "reads", "real",
|
||||
"references", "regexp", "release", "rename", "repeat",
|
||||
"replace", "replicator", "require", "restrict", "return", "revoke", "right",
|
||||
"rlike", "root", "schema", "schemas", "second_microsecond", "select", "sensitive",
|
||||
"separator", "set", "show", "smallint", "spatial", "specific", "sql", "sql_big_result",
|
||||
"sql_calc_found_rows", "sql_small_result", "sqlexception", "sqlstate", "sqlwarning",
|
||||
"ssl", "starting", "straight_join", "table", "terminated", "test", "then", "tinyblob",
|
||||
"tinyint", "tinytext", "to", "trailing", "trigger", "true", "undo",
|
||||
"union", "unique", "unlock", "unsigned", "update", "usage", "use", "using",
|
||||
"utc_date", "utc_time", "utc_timestamp", "values", "varbinary", "varchar",
|
||||
"varcharacter", "varying", "when", "where", "while", "with", "write", "x509",
|
||||
"xor", "xtrabak", "year_month", "zerofill"}
|
||||
if name, _ := data.GetString("name"); utils.IsInStringArray(name, reservedNames) {
|
||||
return nil, httperrors.NewConflictError("account name '%s' is not allowed", name)
|
||||
}
|
||||
|
||||
return data, nil
|
||||
|
||||
Reference in New Issue
Block a user