proxysetting: forbid deletion of DIRECT setting

This commit is contained in:
Yousong Zhou
2020-04-01 17:16:13 +08:00
parent 5bcc2a4298
commit 2718d7bf4e
+3
View File
@@ -74,6 +74,9 @@ func (ps *SProxySetting) HttpTransportProxyFunc() httputils.TransportProxyFunc {
}
func (ps *SProxySetting) ValidateDeleteCondition(ctx context.Context) error {
if ps.Id == proxyapi.ProxySettingId_DIRECT {
return httperrors.NewConflictError("DIRECT setting cannot be deleted")
}
for _, man := range referrersMen {
t := man.TableSpec().Instance()
n, err := t.Query().