8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-24 16:03:47 +00:00

Serialisation des ouvertures de ports en sortie par subnet

This commit is contained in:
Gabriel Detraz 2018-07-13 09:56:15 +02:00
parent 68615c01ea
commit ea2799eef1
3 changed files with 32 additions and 0 deletions

View file

@ -732,6 +732,30 @@ class SwitchPortSerializer(serializers.ModelSerializer):
'interfaces_subnet', 'interfaces6_subnet', 'automatic_provision', 'rest_enabled', 'interfaces_subnet', 'interfaces6_subnet', 'automatic_provision', 'rest_enabled',
'web_management_enabled', 'get_radius_key_value', 'get_management_cred_value') 'web_management_enabled', 'get_radius_key_value', 'get_management_cred_value')
#Firewall
class FirewallPortListSerializer(serializers.ModelSerializer):
class Meta:
model = machines.OuverturePort
fields = ('begin', 'end', 'protocole', 'io')
class FirewallOuverturePortListSerializer(serializers.ModelSerializer):
tcp_ports_in = FirewallPortListSerializer(many=True, read_only=True)
udp_ports_in = FirewallPortListSerializer(many=True, read_only=True)
tcp_ports_out = FirewallPortListSerializer(many=True, read_only=True)
udp_ports_out = FirewallPortListSerializer(many=True, read_only=True)
class Meta:
model = machines.OuverturePortList
fields = ('tcp_ports_in', 'udp_ports_in', 'tcp_ports_out', 'udp_ports_out')
class SubnetPortsOpenSerializer(serializers.ModelSerializer):
ouverture_ports = FirewallOuverturePortListSerializer(read_only=True)
class Meta:
model = machines.IpType
fields = ('type', 'domaine_ip_start', 'domaine_ip_stop', 'prefix_v6', 'ouverture_ports')
# DHCP # DHCP

View file

@ -104,6 +104,8 @@ router.register_view(r'switchs/ports-config', views.SwitchPortView),
router.register_view(r'switchs/role', views.RoleView), router.register_view(r'switchs/role', views.RoleView),
# Reminder # Reminder
router.register_view(r'reminder/get-users', views.ReminderView), router.register_view(r'reminder/get-users', views.ReminderView),
# Firewall
router.register_view(r'firewall/subnet-ports', views.SubnetPortsOpenView),
# DNS # DNS
router.register_view(r'dns/zones', views.DNSZonesView), router.register_view(r'dns/zones', views.DNSZonesView),
# MAILING # MAILING

View file

@ -541,6 +541,12 @@ class HostMacIpView(generics.ListAPIView):
serializer_class = serializers.HostMacIpSerializer serializer_class = serializers.HostMacIpSerializer
#Firewall
class SubnetPortsOpenView(generics.ListAPIView):
queryset = machines.IpType.objects.all()
serializer_class = serializers.SubnetPortsOpenSerializer
# DNS # DNS
class DNSZonesView(generics.ListAPIView): class DNSZonesView(generics.ListAPIView):