|
@@ -18,23 +18,23 @@ type AllowAndDenyIpService interface {
|
|
|
func NewAllowAndDenyIpService(
|
|
|
service *Service,
|
|
|
allowAndDenyIpRepository repository.AllowAndDenyIpRepository,
|
|
|
- gatewayGroupIp GateWayGroupIpService,
|
|
|
wafformatter WafFormatterService,
|
|
|
+ gatewayIpRep repository.GatewayipRepository,
|
|
|
|
|
|
) AllowAndDenyIpService {
|
|
|
return &allowAndDenyIpService{
|
|
|
Service: service,
|
|
|
allowAndDenyIpRepository: allowAndDenyIpRepository,
|
|
|
- gatewayGroupIp: gatewayGroupIp,
|
|
|
wafformatter : wafformatter,
|
|
|
+ gatewayIpRep : gatewayIpRep,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
type allowAndDenyIpService struct {
|
|
|
*Service
|
|
|
allowAndDenyIpRepository repository.AllowAndDenyIpRepository
|
|
|
- gatewayGroupIp GateWayGroupIpService
|
|
|
wafformatter WafFormatterService
|
|
|
+ gatewayIpRep repository.GatewayipRepository
|
|
|
}
|
|
|
|
|
|
func (s *allowAndDenyIpService) GetAllowAndDenyIp(ctx context.Context, id int64) (*model.AllowAndDenyIp, error) {
|
|
@@ -61,7 +61,7 @@ func (s *allowAndDenyIpService) AddAllowAndDenyIps(ctx context.Context, req v1.A
|
|
|
}
|
|
|
|
|
|
|
|
|
- gatewayGroupIps, err := s.gatewayGroupIp.GetGateWayGroupIpByHostId(ctx, req.HostId)
|
|
|
+ gatewayGroupIps, err := s.gatewayIpRep.GetGatewayipOnlyIpByHostIdAll(ctx, int64(req.HostId))
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -70,6 +70,8 @@ func (s *allowAndDenyIpService) AddAllowAndDenyIps(ctx context.Context, req v1.A
|
|
|
if req.AllowOrDeny == 1 {
|
|
|
color = "white"
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
for _, v := range gatewayGroupIps {
|
|
|
go s.wafformatter.PublishIpWhitelistTask([]string{req.Ip}, "add",v,color)
|
|
|
}
|
|
@@ -92,7 +94,7 @@ func (s *allowAndDenyIpService) EditAllowAndDenyIps(ctx context.Context, req v1.
|
|
|
}
|
|
|
|
|
|
|
|
|
- gatewayGroupIps, err := s.gatewayGroupIp.GetGateWayGroupIpByHostId(ctx, req.HostId)
|
|
|
+ gatewayGroupIps, err := s.gatewayIpRep.GetGatewayipOnlyIpByHostIdAll(ctx, int64(req.HostId))
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
@@ -131,7 +133,7 @@ func (s *allowAndDenyIpService) EditAllowAndDenyIps(ctx context.Context, req v1.
|
|
|
func (s *allowAndDenyIpService) DeleteAllowAndDenyIps(ctx context.Context, req v1.DelAllowAndDenyIpRequest) error {
|
|
|
|
|
|
for _, id := range req.Ids {
|
|
|
- gatewayGroupIps, err := s.gatewayGroupIp.GetGateWayGroupIpByHostId(ctx, req.HostId)
|
|
|
+ gatewayGroupIps, err := s.gatewayIpRep.GetGatewayipOnlyIpByHostIdAll(ctx, int64(req.HostId))
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|