mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-30 08:32:26 +00:00
Politique d'ouverture des ports par défaut associée à un range d'IP.
This commit is contained in:
parent
495bf6be19
commit
0bb5095d17
4 changed files with 27 additions and 4 deletions
|
@ -145,7 +145,7 @@ class DelMachineTypeForm(Form):
|
||||||
class IpTypeForm(ModelForm):
|
class IpTypeForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = IpType
|
model = IpType
|
||||||
fields = ['type','extension','need_infra','domaine_ip_start','domaine_ip_stop', 'prefix_v6', 'vlan']
|
fields = ['type','extension','need_infra','domaine_ip_start','domaine_ip_stop', 'prefix_v6', 'vlan', 'ouverture_ports']
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
@ -154,7 +154,7 @@ class IpTypeForm(ModelForm):
|
||||||
|
|
||||||
class EditIpTypeForm(IpTypeForm):
|
class EditIpTypeForm(IpTypeForm):
|
||||||
class Meta(IpTypeForm.Meta):
|
class Meta(IpTypeForm.Meta):
|
||||||
fields = ['extension','type','need_infra', 'prefix_v6', 'vlan']
|
fields = ['extension','type','need_infra', 'prefix_v6', 'vlan', 'ouverture_ports']
|
||||||
|
|
||||||
class DelIpTypeForm(Form):
|
class DelIpTypeForm(Form):
|
||||||
iptypes = forms.ModelMultipleChoiceField(queryset=IpType.objects.all(), label="Types d'ip actuelles", widget=forms.CheckboxSelectMultiple)
|
iptypes = forms.ModelMultipleChoiceField(queryset=IpType.objects.all(), label="Types d'ip actuelles", widget=forms.CheckboxSelectMultiple)
|
||||||
|
|
21
machines/migrations/0060_iptype_ouverture_ports.py
Normal file
21
machines/migrations/0060_iptype_ouverture_ports.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.7 on 2017-10-03 16:08
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('machines', '0059_iptype_prefix_v6'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='iptype',
|
||||||
|
name='ouverture_ports',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='machines.OuverturePortList'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -72,6 +72,7 @@ class IpType(models.Model):
|
||||||
domaine_ip_stop = models.GenericIPAddressField(protocol='IPv4')
|
domaine_ip_stop = models.GenericIPAddressField(protocol='IPv4')
|
||||||
prefix_v6 = models.GenericIPAddressField(protocol='IPv6', null=True, blank=True)
|
prefix_v6 = models.GenericIPAddressField(protocol='IPv6', null=True, blank=True)
|
||||||
vlan = models.ForeignKey('Vlan', on_delete=models.PROTECT, blank=True, null=True)
|
vlan = models.ForeignKey('Vlan', on_delete=models.PROTECT, blank=True, null=True)
|
||||||
|
ouverture_ports = models.ForeignKey('OuverturePortList', blank=True, null=True)
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def ip_range(self):
|
def ip_range(self):
|
||||||
|
|
|
@ -83,7 +83,7 @@ class TypeSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = IpType
|
model = IpType
|
||||||
fields = ('type', 'extension', 'domaine_ip_start', 'domaine_ip_stop')
|
fields = ('type', 'extension', 'domaine_ip_start', 'domaine_ip_stop', 'ouverture_ports')
|
||||||
|
|
||||||
class ExtensionSerializer(serializers.ModelSerializer):
|
class ExtensionSerializer(serializers.ModelSerializer):
|
||||||
origin = serializers.SerializerMethodField('get_origin_ip')
|
origin = serializers.SerializerMethodField('get_origin_ip')
|
||||||
|
@ -184,3 +184,4 @@ class ServiceServersSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
def get_regen_status(self, obj):
|
def get_regen_status(self, obj):
|
||||||
return obj.need_regen()
|
return obj.need_regen()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue