fix: allow delete cloudaccount with auto-sync enabled

This commit is contained in:
Qiu Jian
2020-01-03 16:30:30 +08:00
parent 61f04ff338
commit 3bd4c65e6a
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")
}