Merge pull request #4498 from swordqiu/hotfix/qj-allow-delete-auto-sync-enabled-cloud-account

fix: allow delete cloudaccount with auto-sync enabled
This commit is contained in:
Zexi Li
2020-01-03 19:05:03 +08:00
committed by GitHub
2 changed files with 9 additions and 7 deletions
+4 -3
View File
@@ -163,9 +163,10 @@ func (self *SCloudaccount) getCloudprovidersInternal(enabled tristate.TriState)
}
func (self *SCloudaccount) ValidateDeleteCondition(ctx context.Context) error {
if self.EnableAutoSync {
return httperrors.NewInvalidStatusError("automatic syncing is enabled")
}
// allow delete cloudaccount if it is disabled
// if self.EnableAutoSync {
// return httperrors.NewInvalidStatusError("automatic syncing is enabled")
// }
if self.Enabled {
return httperrors.NewInvalidStatusError("account is enabled")
}
+5 -4
View File
@@ -109,10 +109,11 @@ func (self *SCloudprovider) AllowDeleteItem(ctx context.Context, userCred mcclie
}
func (self *SCloudprovider) ValidateDeleteCondition(ctx context.Context) error {
account := self.GetCloudaccount()
if account != nil && account.EnableAutoSync {
return httperrors.NewInvalidStatusError("auto syncing is enabled on account")
}
// allow delete cloudprovider if it is disabled
// account := self.GetCloudaccount()
// if account != nil && account.EnableAutoSync {
// return httperrors.NewInvalidStatusError("auto syncing is enabled on account")
// }
if self.Enabled {
return httperrors.NewInvalidStatusError("provider is enabled")
}