fix(region): redis create account add name validate

公有云redis不允许创建名为root的账号

#6398
This commit is contained in:
TangBin
2020-11-20 14:24:34 +08:00
parent 4e811240e4
commit 0bbba6d3f8
3 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -1370,7 +1370,7 @@ func (self *SAliyunRegionDriver) ValidateCreateElasticcacheAccountData(ctx conte
accountPrivilegeV.Value)
}
return data, nil
return self.SManagedVirtualizationRegionDriver.ValidateCreateElasticcacheAccountData(ctx, userCred, ownerId, data)
}
func (self *SAliyunRegionDriver) RequestCreateElasticcacheAccount(ctx context.Context, userCred mcclient.TokenCredential, ea *models.SElasticcacheAccount, task taskman.ITask) error {
+5 -1
View File
@@ -2289,7 +2289,11 @@ func (self *SManagedVirtualizationRegionDriver) RequestElasticcacheUpdateBackupP
}
func (self *SManagedVirtualizationRegionDriver) ValidateCreateElasticcacheAccountData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error) {
return nil, nil
if name, _ := data.GetString("name");name == "root" {
return nil, httperrors.NewConflictError("account name 'root' is not allowed")
}
return data, nil
}
func (self *SManagedVirtualizationRegionDriver) ValidateCreateElasticcacheAclData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error) {
+1 -1
View File
@@ -1701,7 +1701,7 @@ func (self *SQcloudRegionDriver) ValidateCreateElasticcacheAccountData(ctx conte
return nil, httperrors.NewWeakPasswordError()
}
return data, nil
return self.SManagedVirtualizationRegionDriver.ValidateCreateElasticcacheAccountData(ctx, userCred, ownerId, data)
}
func (self *SQcloudRegionDriver) RequestCreateElasticcacheAccount(ctx context.Context, userCred mcclient.TokenCredential, ea *models.SElasticcacheAccount, task taskman.ITask) error {