8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-25 22:22:26 +00:00

Serialisation des ouvertures de ports individuelles

This commit is contained in:
Gabriel Detraz 2018-08-05 14:36:32 +02:00
parent cd7cf1cac4
commit dc8cf8dbcc
3 changed files with 14 additions and 0 deletions

View file

@ -675,6 +675,15 @@ class SubnetPortsOpenSerializer(serializers.ModelSerializer):
model = machines.IpType model = machines.IpType
fields = ('type', 'domaine_ip_start', 'domaine_ip_stop', 'complete_prefixv6', 'ouverture_ports') fields = ('type', 'domaine_ip_start', 'domaine_ip_stop', 'complete_prefixv6', 'ouverture_ports')
class InterfacePortsOpenSerializer(serializers.ModelSerializer):
port_lists = FirewallOuverturePortListSerializer(read_only=True, many=True)
ipv4 = serializers.CharField(source='ipv4.ipv4', read_only=True)
ipv6 = Ipv6ListSerializer(many=True, read_only=True)
class Meta:
model = machines.Interface
fields = ('port_lists', 'ipv4', 'ipv6')
# DHCP # DHCP

View file

@ -103,6 +103,7 @@ router.register_view(r'dhcp/hostmacip', views.HostMacIpView),
router.register_view(r'localemail/users', views.LocalEmailUsersView), router.register_view(r'localemail/users', views.LocalEmailUsersView),
# Firewall # Firewall
router.register_view(r'firewall/subnet-ports', views.SubnetPortsOpenView), router.register_view(r'firewall/subnet-ports', views.SubnetPortsOpenView),
router.register_view(r'firewall/interface-ports', views.InterfacePortsOpenView),
# DNS # DNS
router.register_view(r'dns/zones', views.DNSZonesView), router.register_view(r'dns/zones', views.DNSZonesView),
router.register_view(r'dns/reverse-zones', views.DNSReverseZonesView), router.register_view(r'dns/reverse-zones', views.DNSReverseZonesView),

View file

@ -544,6 +544,10 @@ class SubnetPortsOpenView(generics.ListAPIView):
queryset = machines.IpType.objects.all() queryset = machines.IpType.objects.all()
serializer_class = serializers.SubnetPortsOpenSerializer serializer_class = serializers.SubnetPortsOpenSerializer
class InterfacePortsOpenView(generics.ListAPIView):
queryset = machines.Interface.objects.filter(port_lists__isnull=False).distinct()
serializer_class = serializers.InterfacePortsOpenSerializer
# DNS # DNS