|
@@ -17,8 +17,8 @@ import (
|
|
|
type AidedWebService interface {
|
|
|
// 验证相关
|
|
|
ValidateAddRequest(ctx context.Context, req *v1.WebForwardingRequest, require RequireResponse) error
|
|
|
- ValidateEditRequest(ctx context.Context, req *v1.WebForwardingRequest, require RequireResponse, oldData *model.WebForwarding) error
|
|
|
- ValidateDeletePermission(oldData *model.WebForwarding, hostId int) error
|
|
|
+ ValidateEditRequest(ctx context.Context, req *v1.WebForwardingRequest) error
|
|
|
+ ValidateDeletePermission(oldHostId int, hostId int) error
|
|
|
|
|
|
// CDN网站管理
|
|
|
CreateCdnWebsite(ctx context.Context, formData v1.Website) (int64, error)
|
|
@@ -562,7 +562,7 @@ func (s *aidedWebService) ValidateAddRequest(ctx context.Context, req *v1.WebFor
|
|
|
}
|
|
|
|
|
|
// ValidateEditRequest 验证编辑请求
|
|
|
-func (s *aidedWebService) ValidateEditRequest(ctx context.Context, req *v1.WebForwardingRequest, require RequireResponse, oldData *model.WebForwarding) error {
|
|
|
+func (s *aidedWebService) ValidateEditRequest(ctx context.Context, req *v1.WebForwardingRequest) error {
|
|
|
if err := s.wafformatter.validateWafDomainCount(ctx, v1.GlobalRequire{
|
|
|
HostId: req.HostId,
|
|
|
Domain: req.WebForwardingData.Domain,
|
|
@@ -573,7 +573,7 @@ func (s *aidedWebService) ValidateEditRequest(ctx context.Context, req *v1.WebFo
|
|
|
}
|
|
|
|
|
|
protocol := s.GetProtocolType(req.WebForwardingData.IsHttps)
|
|
|
- if err := s.wafformatter.VerifyPort(ctx, protocol, int64(req.WebForwardingData.Id), req.WebForwardingData.Port, int64(require.HostId), req.WebForwardingData.Domain); err != nil {
|
|
|
+ if err := s.wafformatter.VerifyPort(ctx, protocol, int64(req.WebForwardingData.Id), req.WebForwardingData.Port, int64(req.HostId), req.WebForwardingData.Domain); err != nil {
|
|
|
return fmt.Errorf("端口 %d 验证失败: %w", req.WebForwardingData.Port, err)
|
|
|
}
|
|
|
|
|
@@ -581,8 +581,8 @@ func (s *aidedWebService) ValidateEditRequest(ctx context.Context, req *v1.WebFo
|
|
|
}
|
|
|
|
|
|
// ValidateDeletePermission 验证删除权限
|
|
|
-func (s *aidedWebService) ValidateDeletePermission(oldData *model.WebForwarding, hostId int) error {
|
|
|
- if oldData.HostId != hostId {
|
|
|
+func (s *aidedWebService) ValidateDeletePermission(oldHostId int, hostId int) error {
|
|
|
+ if oldHostId != hostId {
|
|
|
return fmt.Errorf("用户权限不足")
|
|
|
}
|
|
|
return nil
|