Merge pull request #11199 from ioito/automated-cherry-pick-of-#11198-upstream-release-3.7

Automated cherry pick of #11198: fix(region): restrict account project mapping
This commit is contained in:
Zexi Li
2021-05-24 18:16:42 +08:00
committed by GitHub
2 changed files with 4 additions and 0 deletions
+1
View File
@@ -480,5 +480,6 @@ type CloudaccountEnableAutoSyncInput struct {
type CloudaccountProjectMappingInput struct {
// 同步策略Id, 若不传此参数则解绑
// 绑定同步策略要求当前云账号此刻未绑定其他同步策略
ProjectMappingId string `json:"project_mapping_id"`
}
+3
View File
@@ -2870,6 +2870,9 @@ func (self *SCloudaccount) PerformProjectMapping(ctx context.Context, userCred m
if err != nil {
return nil, err
}
if len(self.ProjectMappingId) > 0 && self.ProjectMappingId != input.ProjectMappingId {
return nil, httperrors.NewInputParameterError("account %s has aleady bind project mapping %s", self.Name, self.ProjectMappingId)
}
}
// no changes
if self.ProjectMappingId == input.ProjectMappingId {