mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
Merge branch 'cleanup_machines' into 'dev'
Clean up of machines See merge request federez/re2o!310
This commit is contained in:
commit
ee2ee0ad12
41 changed files with 823 additions and 806 deletions
|
@ -41,4 +41,3 @@ def can_view(user):
|
||||||
can = user.has_module_perms('machines')
|
can = user.has_module_perms('machines')
|
||||||
return can, None if can else _("You don't have the right to view this"
|
return can, None if can else _("You don't have the right to view this"
|
||||||
" application.")
|
" application.")
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ from __future__ import unicode_literals
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from reversion.admin import VersionAdmin
|
from reversion.admin import VersionAdmin
|
||||||
|
|
||||||
from .models import IpType, Machine, MachineType, Domain, IpList, Interface
|
|
||||||
from .models import (
|
from .models import (
|
||||||
Extension,
|
Extension,
|
||||||
SOA,
|
SOA,
|
||||||
|
@ -47,6 +46,7 @@ from .models import (
|
||||||
Ipv6List,
|
Ipv6List,
|
||||||
OuverturePortList,
|
OuverturePortList,
|
||||||
)
|
)
|
||||||
|
from .models import IpType, Machine, MachineType, Domain, IpList, Interface
|
||||||
|
|
||||||
|
|
||||||
class MachineAdmin(VersionAdmin):
|
class MachineAdmin(VersionAdmin):
|
||||||
|
@ -98,6 +98,7 @@ class TxtAdmin(VersionAdmin):
|
||||||
""" Admin view of a TXT object """
|
""" Admin view of a TXT object """
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class DNameAdmin(VersionAdmin):
|
class DNameAdmin(VersionAdmin):
|
||||||
""" Admin view of a DName object """
|
""" Admin view of a DName object """
|
||||||
pass
|
pass
|
||||||
|
@ -147,12 +148,12 @@ class ServiceAdmin(VersionAdmin):
|
||||||
""" Admin view of a ServiceAdmin object """
|
""" Admin view of a ServiceAdmin object """
|
||||||
list_display = ('service_type', 'min_time_regen', 'regular_time_regen')
|
list_display = ('service_type', 'min_time_regen', 'regular_time_regen')
|
||||||
|
|
||||||
|
|
||||||
class RoleAdmin(VersionAdmin):
|
class RoleAdmin(VersionAdmin):
|
||||||
""" Admin view of a RoleAdmin object """
|
""" Admin view of a RoleAdmin object """
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(Machine, MachineAdmin)
|
admin.site.register(Machine, MachineAdmin)
|
||||||
admin.site.register(MachineType, MachineTypeAdmin)
|
admin.site.register(MachineType, MachineTypeAdmin)
|
||||||
admin.site.register(IpType, IpTypeAdmin)
|
admin.site.register(IpType, IpTypeAdmin)
|
||||||
|
|
|
@ -35,13 +35,12 @@ Formulaires d'ajout, edition et suppressions de :
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.forms import ModelForm, Form
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
from django.forms import ModelForm, Form
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from re2o.field_permissions import FieldPermissionFormMixin
|
from re2o.field_permissions import FieldPermissionFormMixin
|
||||||
from re2o.mixins import FormRevMixin
|
from re2o.mixins import FormRevMixin
|
||||||
|
|
||||||
from .models import (
|
from .models import (
|
||||||
Domain,
|
Domain,
|
||||||
Machine,
|
Machine,
|
||||||
|
@ -68,6 +67,7 @@ from .models import (
|
||||||
|
|
||||||
class EditMachineForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
class EditMachineForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
"""Formulaire d'édition d'une machine"""
|
"""Formulaire d'édition d'une machine"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Machine
|
model = Machine
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -80,12 +80,14 @@ class EditMachineForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
|
|
||||||
class NewMachineForm(EditMachineForm):
|
class NewMachineForm(EditMachineForm):
|
||||||
"""Creation d'une machine, ne renseigne que le nom"""
|
"""Creation d'une machine, ne renseigne que le nom"""
|
||||||
|
|
||||||
class Meta(EditMachineForm.Meta):
|
class Meta(EditMachineForm.Meta):
|
||||||
fields = ['name']
|
fields = ['name']
|
||||||
|
|
||||||
|
|
||||||
class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
"""Edition d'une interface. Edition complète"""
|
"""Edition d'une interface. Edition complète"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Interface
|
model = Interface
|
||||||
fields = ['machine', 'type', 'ipv4', 'mac_address', 'details']
|
fields = ['machine', 'type', 'ipv4', 'mac_address', 'details']
|
||||||
|
@ -116,7 +118,7 @@ class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
interface=self.instance
|
interface=self.instance
|
||||||
)
|
)
|
||||||
if "machine" in self.fields:
|
if "machine" in self.fields:
|
||||||
self.fields['machine'].queryset = Machine.objects.all()\
|
self.fields['machine'].queryset = Machine.objects.all() \
|
||||||
.select_related('user')
|
.select_related('user')
|
||||||
can_use_all_machinetype, _reason = MachineType.can_use_all(user)
|
can_use_all_machinetype, _reason = MachineType.can_use_all(user)
|
||||||
if not can_use_all_machinetype:
|
if not can_use_all_machinetype:
|
||||||
|
@ -128,12 +130,14 @@ class EditInterfaceForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
class AddInterfaceForm(EditInterfaceForm):
|
class AddInterfaceForm(EditInterfaceForm):
|
||||||
"""Ajout d'une interface à une machine. En fonction des droits,
|
"""Ajout d'une interface à une machine. En fonction des droits,
|
||||||
affiche ou non l'ensemble des ip disponibles"""
|
affiche ou non l'ensemble des ip disponibles"""
|
||||||
|
|
||||||
class Meta(EditInterfaceForm.Meta):
|
class Meta(EditInterfaceForm.Meta):
|
||||||
fields = ['type', 'ipv4', 'mac_address', 'details']
|
fields = ['type', 'ipv4', 'mac_address', 'details']
|
||||||
|
|
||||||
|
|
||||||
class AliasForm(FormRevMixin, ModelForm):
|
class AliasForm(FormRevMixin, ModelForm):
|
||||||
"""Ajout d'un alias (et edition), CNAME, contenant nom et extension"""
|
"""Ajout d'un alias (et edition), CNAME, contenant nom et extension"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Domain
|
model = Domain
|
||||||
fields = ['name', 'extension']
|
fields = ['name', 'extension']
|
||||||
|
@ -151,6 +155,7 @@ class AliasForm(FormRevMixin, ModelForm):
|
||||||
|
|
||||||
class DomainForm(FormRevMixin, ModelForm):
|
class DomainForm(FormRevMixin, ModelForm):
|
||||||
"""Ajout et edition d'un enregistrement de nom, relié à interface"""
|
"""Ajout et edition d'un enregistrement de nom, relié à interface"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Domain
|
model = Domain
|
||||||
fields = ['name']
|
fields = ['name']
|
||||||
|
@ -183,6 +188,7 @@ class DelAliasForm(FormRevMixin, Form):
|
||||||
|
|
||||||
class MachineTypeForm(FormRevMixin, ModelForm):
|
class MachineTypeForm(FormRevMixin, ModelForm):
|
||||||
"""Ajout et edition d'un machinetype, relié à un iptype"""
|
"""Ajout et edition d'un machinetype, relié à un iptype"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = MachineType
|
model = MachineType
|
||||||
fields = ['type', 'ip_type']
|
fields = ['type', 'ip_type']
|
||||||
|
@ -214,6 +220,7 @@ class DelMachineTypeForm(FormRevMixin, Form):
|
||||||
class IpTypeForm(FormRevMixin, ModelForm):
|
class IpTypeForm(FormRevMixin, ModelForm):
|
||||||
"""Formulaire d'ajout d'un iptype. Pas d'edition de l'ip de start et de
|
"""Formulaire d'ajout d'un iptype. Pas d'edition de l'ip de start et de
|
||||||
stop après creation"""
|
stop après creation"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = IpType
|
model = IpType
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -227,6 +234,7 @@ class IpTypeForm(FormRevMixin, ModelForm):
|
||||||
class EditIpTypeForm(IpTypeForm):
|
class EditIpTypeForm(IpTypeForm):
|
||||||
"""Edition d'un iptype. Pas d'edition du rangev4 possible, car il faudrait
|
"""Edition d'un iptype. Pas d'edition du rangev4 possible, car il faudrait
|
||||||
synchroniser les objets iplist"""
|
synchroniser les objets iplist"""
|
||||||
|
|
||||||
class Meta(IpTypeForm.Meta):
|
class Meta(IpTypeForm.Meta):
|
||||||
fields = ['extension', 'type', 'need_infra', 'domaine_ip_network', 'domaine_ip_netmask',
|
fields = ['extension', 'type', 'need_infra', 'domaine_ip_network', 'domaine_ip_netmask',
|
||||||
'prefix_v6', 'prefix_v6_length',
|
'prefix_v6', 'prefix_v6_length',
|
||||||
|
@ -253,6 +261,7 @@ class DelIpTypeForm(FormRevMixin, Form):
|
||||||
|
|
||||||
class ExtensionForm(FormRevMixin, ModelForm):
|
class ExtensionForm(FormRevMixin, ModelForm):
|
||||||
"""Formulaire d'ajout et edition d'une extension"""
|
"""Formulaire d'ajout et edition d'une extension"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Extension
|
model = Extension
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -285,6 +294,7 @@ class DelExtensionForm(FormRevMixin, Form):
|
||||||
|
|
||||||
class Ipv6ListForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
class Ipv6ListForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
"""Gestion des ipv6 d'une machine"""
|
"""Gestion des ipv6 d'une machine"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Ipv6List
|
model = Ipv6List
|
||||||
fields = ['ipv6', 'slaac_ip']
|
fields = ['ipv6', 'slaac_ip']
|
||||||
|
@ -296,6 +306,7 @@ class Ipv6ListForm(FormRevMixin, FieldPermissionFormMixin, ModelForm):
|
||||||
|
|
||||||
class SOAForm(FormRevMixin, ModelForm):
|
class SOAForm(FormRevMixin, ModelForm):
|
||||||
"""Ajout et edition d'un SOA"""
|
"""Ajout et edition d'un SOA"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SOA
|
model = SOA
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -324,6 +335,7 @@ class DelSOAForm(FormRevMixin, Form):
|
||||||
|
|
||||||
class MxForm(FormRevMixin, ModelForm):
|
class MxForm(FormRevMixin, ModelForm):
|
||||||
"""Ajout et edition d'un MX"""
|
"""Ajout et edition d'un MX"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Mx
|
model = Mx
|
||||||
fields = ['zone', 'priority', 'name']
|
fields = ['zone', 'priority', 'name']
|
||||||
|
@ -357,6 +369,7 @@ class NsForm(FormRevMixin, ModelForm):
|
||||||
"""Ajout d'un NS pour une zone
|
"""Ajout d'un NS pour une zone
|
||||||
On exclue les CNAME dans les objets domain (interdit par la rfc)
|
On exclue les CNAME dans les objets domain (interdit par la rfc)
|
||||||
donc on prend uniquemet """
|
donc on prend uniquemet """
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Ns
|
model = Ns
|
||||||
fields = ['zone', 'ns']
|
fields = ['zone', 'ns']
|
||||||
|
@ -388,6 +401,7 @@ class DelNsForm(FormRevMixin, Form):
|
||||||
|
|
||||||
class TxtForm(FormRevMixin, ModelForm):
|
class TxtForm(FormRevMixin, ModelForm):
|
||||||
"""Ajout d'un txt pour une zone"""
|
"""Ajout d'un txt pour une zone"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Txt
|
model = Txt
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -416,6 +430,7 @@ class DelTxtForm(FormRevMixin, Form):
|
||||||
|
|
||||||
class DNameForm(FormRevMixin, ModelForm):
|
class DNameForm(FormRevMixin, ModelForm):
|
||||||
"""Add a DNAME entry for a zone"""
|
"""Add a DNAME entry for a zone"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = DName
|
model = DName
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -444,6 +459,7 @@ class DelDNameForm(FormRevMixin, Form):
|
||||||
|
|
||||||
class SrvForm(FormRevMixin, ModelForm):
|
class SrvForm(FormRevMixin, ModelForm):
|
||||||
"""Ajout d'un srv pour une zone"""
|
"""Ajout d'un srv pour une zone"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Srv
|
model = Srv
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -473,6 +489,7 @@ class DelSrvForm(FormRevMixin, Form):
|
||||||
class NasForm(FormRevMixin, ModelForm):
|
class NasForm(FormRevMixin, ModelForm):
|
||||||
"""Ajout d'un type de nas (machine d'authentification,
|
"""Ajout d'un type de nas (machine d'authentification,
|
||||||
swicths, bornes...)"""
|
swicths, bornes...)"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Nas
|
model = Nas
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -501,6 +518,7 @@ class DelNasForm(FormRevMixin, Form):
|
||||||
|
|
||||||
class RoleForm(FormRevMixin, ModelForm):
|
class RoleForm(FormRevMixin, ModelForm):
|
||||||
"""Add and edit role."""
|
"""Add and edit role."""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Role
|
model = Role
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -509,9 +527,9 @@ class RoleForm(FormRevMixin, ModelForm):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(RoleForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(RoleForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['servers'].queryset = (Interface.objects.all()
|
self.fields['servers'].queryset = (Interface.objects.all()
|
||||||
.select_related(
|
.select_related(
|
||||||
'domain__extension'
|
'domain__extension'
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
class DelRoleForm(FormRevMixin, Form):
|
class DelRoleForm(FormRevMixin, Form):
|
||||||
|
@ -533,6 +551,7 @@ class DelRoleForm(FormRevMixin, Form):
|
||||||
|
|
||||||
class ServiceForm(FormRevMixin, ModelForm):
|
class ServiceForm(FormRevMixin, ModelForm):
|
||||||
"""Ajout et edition d'une classe de service : dns, dhcp, etc"""
|
"""Ajout et edition d'une classe de service : dns, dhcp, etc"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Service
|
model = Service
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -541,9 +560,9 @@ class ServiceForm(FormRevMixin, ModelForm):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(ServiceForm, self).__init__(*args, prefix=prefix, **kwargs)
|
super(ServiceForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||||
self.fields['servers'].queryset = (Interface.objects.all()
|
self.fields['servers'].queryset = (Interface.objects.all()
|
||||||
.select_related(
|
.select_related(
|
||||||
'domain__extension'
|
'domain__extension'
|
||||||
))
|
))
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
# TODO : None of the parents of ServiceForm use the commit
|
# TODO : None of the parents of ServiceForm use the commit
|
||||||
|
@ -574,6 +593,7 @@ class DelServiceForm(FormRevMixin, Form):
|
||||||
|
|
||||||
class VlanForm(FormRevMixin, ModelForm):
|
class VlanForm(FormRevMixin, ModelForm):
|
||||||
"""Ajout d'un vlan : id, nom"""
|
"""Ajout d'un vlan : id, nom"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Vlan
|
model = Vlan
|
||||||
fields = ['vlan_id', 'name', 'comment']
|
fields = ['vlan_id', 'name', 'comment']
|
||||||
|
@ -614,6 +634,7 @@ class DelVlanForm(FormRevMixin, Form):
|
||||||
class EditOuverturePortConfigForm(FormRevMixin, ModelForm):
|
class EditOuverturePortConfigForm(FormRevMixin, ModelForm):
|
||||||
"""Edition de la liste des profils d'ouverture de ports
|
"""Edition de la liste des profils d'ouverture de ports
|
||||||
pour l'interface"""
|
pour l'interface"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Interface
|
model = Interface
|
||||||
fields = ['port_lists']
|
fields = ['port_lists']
|
||||||
|
@ -630,6 +651,7 @@ class EditOuverturePortConfigForm(FormRevMixin, ModelForm):
|
||||||
class EditOuverturePortListForm(FormRevMixin, ModelForm):
|
class EditOuverturePortListForm(FormRevMixin, ModelForm):
|
||||||
"""Edition de la liste des ports et profils d'ouverture
|
"""Edition de la liste des ports et profils d'ouverture
|
||||||
des ports"""
|
des ports"""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = OuverturePortList
|
model = OuverturePortList
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
@ -642,9 +664,10 @@ class EditOuverturePortListForm(FormRevMixin, ModelForm):
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SshFpForm(FormRevMixin, ModelForm):
|
class SshFpForm(FormRevMixin, ModelForm):
|
||||||
"""Edits a SSHFP record."""
|
"""Edits a SSHFP record."""
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SshFp
|
model = SshFp
|
||||||
exclude = ('machine',)
|
exclude = ('machine',)
|
||||||
|
@ -656,4 +679,3 @@ class SshFpForm(FormRevMixin, ModelForm):
|
||||||
prefix=prefix,
|
prefix=prefix,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -27,32 +27,30 @@ The models definitions for the Machines app
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from datetime import timedelta
|
import base64
|
||||||
|
import hashlib
|
||||||
import re
|
import re
|
||||||
|
from datetime import timedelta
|
||||||
from ipaddress import IPv6Address
|
from ipaddress import IPv6Address
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from netaddr import mac_bare, EUI, IPSet, IPRange, IPNetwork, IPAddress
|
|
||||||
import hashlib
|
|
||||||
import base64
|
|
||||||
|
|
||||||
|
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.db.models.signals import post_save, post_delete
|
from django.db.models.signals import post_save, post_delete
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.forms import ValidationError
|
from django.forms import ValidationError
|
||||||
from django.utils.functional import cached_property
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
from django.utils.functional import cached_property
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from macaddress.fields import MACAddressField
|
from macaddress.fields import MACAddressField
|
||||||
|
from netaddr import mac_bare, EUI, IPSet, IPRange, IPNetwork, IPAddress
|
||||||
|
|
||||||
|
import preferences.models
|
||||||
|
import users.models
|
||||||
from re2o.field_permissions import FieldPermissionModelMixin
|
from re2o.field_permissions import FieldPermissionModelMixin
|
||||||
from re2o.mixins import AclMixin, RevMixin
|
from re2o.mixins import AclMixin, RevMixin
|
||||||
|
|
||||||
import users.models
|
|
||||||
import preferences.models
|
|
||||||
|
|
||||||
|
|
||||||
class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
|
class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
|
||||||
""" Class définissant une machine, object parent user, objets fils
|
""" Class définissant une machine, object parent user, objets fils
|
||||||
|
@ -116,7 +114,7 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
|
||||||
:return: True ou False avec la raison de l'échec le cas échéant"""
|
:return: True ou False avec la raison de l'échec le cas échéant"""
|
||||||
if not user_request.has_perm('machines.view_machine'):
|
if not user_request.has_perm('machines.view_machine'):
|
||||||
return False, _("You don't have the right to view all the"
|
return False, _("You don't have the right to view all the"
|
||||||
" machines.")
|
" machines.")
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -131,9 +129,9 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
|
||||||
except users.models.User.DoesNotExist:
|
except users.models.User.DoesNotExist:
|
||||||
return False, _("Nonexistent user.")
|
return False, _("Nonexistent user.")
|
||||||
max_lambdauser_interfaces = (preferences.models.OptionalMachine
|
max_lambdauser_interfaces = (preferences.models.OptionalMachine
|
||||||
.get_cached_value(
|
.get_cached_value(
|
||||||
'max_lambdauser_interfaces'
|
'max_lambdauser_interfaces'
|
||||||
))
|
))
|
||||||
if not user_request.has_perm('machines.add_machine'):
|
if not user_request.has_perm('machines.add_machine'):
|
||||||
if not (preferences.models.OptionalMachine
|
if not (preferences.models.OptionalMachine
|
||||||
.get_cached_value('create_machine')):
|
.get_cached_value('create_machine')):
|
||||||
|
@ -180,7 +178,7 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
|
||||||
**kwargs
|
**kwargs
|
||||||
)[0]):
|
)[0]):
|
||||||
return False, _("You don't have the right to delete a machine"
|
return False, _("You don't have the right to delete a machine"
|
||||||
" of another user.")
|
" of another user.")
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
def can_view(self, user_request, *_args, **_kwargs):
|
def can_view(self, user_request, *_args, **_kwargs):
|
||||||
|
@ -192,7 +190,7 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
|
||||||
if (not user_request.has_perm('machines.view_machine') and
|
if (not user_request.has_perm('machines.view_machine') and
|
||||||
self.user != user_request):
|
self.user != user_request):
|
||||||
return False, _("You don't have the right to view other machines"
|
return False, _("You don't have the right to view other machines"
|
||||||
" than yours.")
|
" than yours.")
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
|
@ -213,14 +211,14 @@ class Machine(RevMixin, FieldPermissionModelMixin, models.Model):
|
||||||
machine"""
|
machine"""
|
||||||
return Domain.objects.filter(
|
return Domain.objects.filter(
|
||||||
interface_parent__machine=self
|
interface_parent__machine=self
|
||||||
).values_list('name', flat=True).distinct()
|
).values_list('name', flat=True).distinct()
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def all_complete_names(self):
|
def all_complete_names(self):
|
||||||
"""Renvoie tous les tls complets de la machine"""
|
"""Renvoie tous les tls complets de la machine"""
|
||||||
return [str(domain) for domain in Domain.objects.filter(
|
return [str(domain) for domain in Domain.objects.filter(
|
||||||
Q(cname__interface_parent__machine=self) | Q(interface_parent__machine=self)
|
Q(cname__interface_parent__machine=self) | Q(interface_parent__machine=self)
|
||||||
)]
|
)]
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Machine, self).__init__(*args, **kwargs)
|
super(Machine, self).__init__(*args, **kwargs)
|
||||||
|
@ -296,8 +294,8 @@ class IpType(RevMixin, AclMixin, models.Model):
|
||||||
help_text=_("Netmask for the domain's IPv4 range")
|
help_text=_("Netmask for the domain's IPv4 range")
|
||||||
)
|
)
|
||||||
reverse_v4 = models.BooleanField(
|
reverse_v4 = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
help_text=_("Enable reverse DNS for IPv4"),
|
help_text=_("Enable reverse DNS for IPv4"),
|
||||||
)
|
)
|
||||||
prefix_v6 = models.GenericIPAddressField(
|
prefix_v6 = models.GenericIPAddressField(
|
||||||
protocol='IPv6',
|
protocol='IPv6',
|
||||||
|
@ -310,10 +308,10 @@ class IpType(RevMixin, AclMixin, models.Model):
|
||||||
MaxValueValidator(128),
|
MaxValueValidator(128),
|
||||||
MinValueValidator(0)
|
MinValueValidator(0)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
reverse_v6 = models.BooleanField(
|
reverse_v6 = models.BooleanField(
|
||||||
default=False,
|
default=False,
|
||||||
help_text=_("Enable reverse DNS for IPv6"),
|
help_text=_("Enable reverse DNS for IPv6"),
|
||||||
)
|
)
|
||||||
vlan = models.ForeignKey(
|
vlan = models.ForeignKey(
|
||||||
'Vlan',
|
'Vlan',
|
||||||
|
@ -333,7 +331,7 @@ class IpType(RevMixin, AclMixin, models.Model):
|
||||||
("use_all_iptype", _("Can use all IP types")),
|
("use_all_iptype", _("Can use all IP types")),
|
||||||
)
|
)
|
||||||
verbose_name = _("IP type")
|
verbose_name = _("IP type")
|
||||||
verbose_name_plural = ("IP types")
|
verbose_name_plural = "IP types"
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def ip_range(self):
|
def ip_range(self):
|
||||||
|
@ -373,9 +371,9 @@ class IpType(RevMixin, AclMixin, models.Model):
|
||||||
def ip6_set_full_info(self):
|
def ip6_set_full_info(self):
|
||||||
if self.prefix_v6:
|
if self.prefix_v6:
|
||||||
return {
|
return {
|
||||||
'network' : str(self.prefix_v6),
|
'network': str(self.prefix_v6),
|
||||||
'netmask' : 'ffff:ffff:ffff:ffff::',
|
'netmask': 'ffff:ffff:ffff:ffff::',
|
||||||
'netmask_cidr' : str(self.prefix_v6_length),
|
'netmask_cidr': str(self.prefix_v6_length),
|
||||||
'vlan': str(self.vlan),
|
'vlan': str(self.vlan),
|
||||||
'vlan_id': self.vlan.vlan_id
|
'vlan_id': self.vlan.vlan_id
|
||||||
}
|
}
|
||||||
|
@ -394,10 +392,10 @@ class IpType(RevMixin, AclMixin, models.Model):
|
||||||
def ip_net_full_info(self):
|
def ip_net_full_info(self):
|
||||||
"""Renvoie les infos du network contenant du range"""
|
"""Renvoie les infos du network contenant du range"""
|
||||||
return {
|
return {
|
||||||
'network' : str(self.ip_network.network),
|
'network': str(self.ip_network.network),
|
||||||
'netmask' : str(self.ip_network.netmask),
|
'netmask': str(self.ip_network.netmask),
|
||||||
'broadcast' : str(self.ip_network.broadcast),
|
'broadcast': str(self.ip_network.broadcast),
|
||||||
'netmask_cidr' : str(self.ip_network.prefixlen),
|
'netmask_cidr': str(self.ip_network.prefixlen),
|
||||||
}
|
}
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
|
@ -448,9 +446,9 @@ class IpType(RevMixin, AclMixin, models.Model):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
for ipv6 in Ipv6List.objects.filter(
|
for ipv6 in Ipv6List.objects.filter(
|
||||||
interface__in=Interface.objects.filter(
|
interface__in=Interface.objects.filter(
|
||||||
type__in=MachineType.objects.filter(ip_type=self)
|
type__in=MachineType.objects.filter(ip_type=self)
|
||||||
)
|
)
|
||||||
):
|
):
|
||||||
ipv6.check_and_replace_prefix(prefix=self.prefix_v6)
|
ipv6.check_and_replace_prefix(prefix=self.prefix_v6)
|
||||||
|
|
||||||
|
@ -814,8 +812,8 @@ class Txt(RevMixin, AclMixin, models.Model):
|
||||||
verbose_name_plural = _("TXT records")
|
verbose_name_plural = _("TXT records")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.zone) + " : " + str(self.field1) + " " +\
|
return str(self.zone) + " : " + str(self.field1) + " " + \
|
||||||
str(self.field2)
|
str(self.field2)
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def dns_entry(self):
|
def dns_entry(self):
|
||||||
|
@ -874,7 +872,7 @@ class Srv(RevMixin, AclMixin, models.Model):
|
||||||
default=0,
|
default=0,
|
||||||
validators=[MaxValueValidator(65535)],
|
validators=[MaxValueValidator(65535)],
|
||||||
help_text=_("Relative weight for records with the same priority"
|
help_text=_("Relative weight for records with the same priority"
|
||||||
" (integer value between 0 and 65535)")
|
" (integer value between 0 and 65535)")
|
||||||
)
|
)
|
||||||
port = models.PositiveIntegerField(
|
port = models.PositiveIntegerField(
|
||||||
validators=[MaxValueValidator(65535)],
|
validators=[MaxValueValidator(65535)],
|
||||||
|
@ -894,17 +892,17 @@ class Srv(RevMixin, AclMixin, models.Model):
|
||||||
verbose_name_plural = _("SRV records")
|
verbose_name_plural = _("SRV records")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.service) + ' ' + str(self.protocole) + ' ' +\
|
return str(self.service) + ' ' + str(self.protocole) + ' ' + \
|
||||||
str(self.extension) + ' ' + str(self.priority) +\
|
str(self.extension) + ' ' + str(self.priority) + \
|
||||||
' ' + str(self.weight) + str(self.port) + str(self.target)
|
' ' + str(self.weight) + str(self.port) + str(self.target)
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def dns_entry(self):
|
def dns_entry(self):
|
||||||
"""Renvoie l'enregistrement SRV complet pour le fichier de zone"""
|
"""Renvoie l'enregistrement SRV complet pour le fichier de zone"""
|
||||||
return str(self.service) + '._' + str(self.protocole).lower() +\
|
return str(self.service) + '._' + str(self.protocole).lower() + \
|
||||||
str(self.extension) + '. ' + str(self.ttl) + ' IN SRV ' +\
|
str(self.extension) + '. ' + str(self.ttl) + ' IN SRV ' + \
|
||||||
str(self.priority) + ' ' + str(self.weight) + ' ' +\
|
str(self.priority) + ' ' + str(self.weight) + ' ' + \
|
||||||
str(self.port) + ' ' + str(self.target) + '.'
|
str(self.port) + ' ' + str(self.target) + '.'
|
||||||
|
|
||||||
|
|
||||||
class SshFp(RevMixin, AclMixin, models.Model):
|
class SshFp(RevMixin, AclMixin, models.Model):
|
||||||
|
@ -949,8 +947,8 @@ class SshFp(RevMixin, AclMixin, models.Model):
|
||||||
"""Return the hashess for the pub key with correct id
|
"""Return the hashess for the pub key with correct id
|
||||||
cf RFC, 1 is sha1 , 2 sha256"""
|
cf RFC, 1 is sha1 , 2 sha256"""
|
||||||
return {
|
return {
|
||||||
"1" : hashlib.sha1(base64.b64decode(self.pub_key_entry)).hexdigest(),
|
"1": hashlib.sha1(base64.b64decode(self.pub_key_entry)).hexdigest(),
|
||||||
"2" : hashlib.sha256(base64.b64decode(self.pub_key_entry)).hexdigest(),
|
"2": hashlib.sha256(base64.b64decode(self.pub_key_entry)).hexdigest(),
|
||||||
}
|
}
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -973,7 +971,6 @@ class SshFp(RevMixin, AclMixin, models.Model):
|
||||||
return str(self.algo) + ' ' + str(self.comment)
|
return str(self.algo) + ' ' + str(self.comment)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
|
class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
|
||||||
""" Une interface. Objet clef de l'application machine :
|
""" Une interface. Objet clef de l'application machine :
|
||||||
- une address mac unique. Possibilité de la rendre unique avec le
|
- une address mac unique. Possibilité de la rendre unique avec le
|
||||||
|
@ -1067,7 +1064,7 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
|
||||||
.get_cached_value('ipv6_mode') == 'SLAAC'):
|
.get_cached_value('ipv6_mode') == 'SLAAC'):
|
||||||
self.sync_ipv6_slaac()
|
self.sync_ipv6_slaac()
|
||||||
elif (preferences.models.OptionalMachine
|
elif (preferences.models.OptionalMachine
|
||||||
.get_cached_value('ipv6_mode') == 'DHCPV6'):
|
.get_cached_value('ipv6_mode') == 'DHCPV6'):
|
||||||
self.sync_ipv6_dhcpv6()
|
self.sync_ipv6_dhcpv6()
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
@ -1080,7 +1077,7 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
|
||||||
.get_cached_value('ipv6_mode') == 'SLAAC'):
|
.get_cached_value('ipv6_mode') == 'SLAAC'):
|
||||||
return self.ipv6list.all()
|
return self.ipv6list.all()
|
||||||
elif (preferences.models.OptionalMachine
|
elif (preferences.models.OptionalMachine
|
||||||
.get_cached_value('ipv6_mode') == 'DHCPV6'):
|
.get_cached_value('ipv6_mode') == 'DHCPV6'):
|
||||||
return self.ipv6list.filter(slaac_ip=False)
|
return self.ipv6list.filter(slaac_ip=False)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
@ -1159,9 +1156,9 @@ class Interface(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
|
||||||
.get_cached_value('create_machine')):
|
.get_cached_value('create_machine')):
|
||||||
return False, _("You can't add a machine.")
|
return False, _("You can't add a machine.")
|
||||||
max_lambdauser_interfaces = (preferences.models.OptionalMachine
|
max_lambdauser_interfaces = (preferences.models.OptionalMachine
|
||||||
.get_cached_value(
|
.get_cached_value(
|
||||||
'max_lambdauser_interfaces'
|
'max_lambdauser_interfaces'
|
||||||
))
|
))
|
||||||
if machine.user != user_request:
|
if machine.user != user_request:
|
||||||
return False, _("You don't have the right to add an interface"
|
return False, _("You don't have the right to add an interface"
|
||||||
" to a machine of another user.")
|
" to a machine of another user.")
|
||||||
|
@ -1365,8 +1362,8 @@ class Ipv6List(RevMixin, AclMixin, FieldPermissionModelMixin, models.Model):
|
||||||
|
|
||||||
def clean(self, *args, **kwargs):
|
def clean(self, *args, **kwargs):
|
||||||
if self.slaac_ip and (Ipv6List.objects
|
if self.slaac_ip and (Ipv6List.objects
|
||||||
.filter(interface=self.interface, slaac_ip=True)
|
.filter(interface=self.interface, slaac_ip=True)
|
||||||
.exclude(id=self.id)):
|
.exclude(id=self.id)):
|
||||||
raise ValidationError(_("A SLAAC IP address is already registered."))
|
raise ValidationError(_("A SLAAC IP address is already registered."))
|
||||||
prefix_v6 = self.interface.type.ip_type.prefix_v6.encode().decode('utf-8')
|
prefix_v6 = self.interface.type.ip_type.prefix_v6.encode().decode('utf-8')
|
||||||
if prefix_v6:
|
if prefix_v6:
|
||||||
|
@ -1498,18 +1495,18 @@ class Domain(RevMixin, AclMixin, models.Model):
|
||||||
return False, _("Nonexistent interface.")
|
return False, _("Nonexistent interface.")
|
||||||
if not user_request.has_perm('machines.add_domain'):
|
if not user_request.has_perm('machines.add_domain'):
|
||||||
max_lambdauser_aliases = (preferences.models.OptionalMachine
|
max_lambdauser_aliases = (preferences.models.OptionalMachine
|
||||||
.get_cached_value(
|
.get_cached_value(
|
||||||
'max_lambdauser_aliases'
|
'max_lambdauser_aliases'
|
||||||
))
|
))
|
||||||
if interface.machine.user != user_request:
|
if interface.machine.user != user_request:
|
||||||
return False, _("You don't have the right to add an alias to a"
|
return False, _("You don't have the right to add an alias to a"
|
||||||
" machine of another user.")
|
" machine of another user.")
|
||||||
if Domain.objects.filter(
|
if Domain.objects.filter(
|
||||||
cname__in=Domain.objects.filter(
|
cname__in=Domain.objects.filter(
|
||||||
interface_parent__in=(interface.machine.user
|
interface_parent__in=(interface.machine.user
|
||||||
.user_interfaces())
|
.user_interfaces())
|
||||||
)
|
)
|
||||||
).count() >= max_lambdauser_aliases:
|
).count() >= max_lambdauser_aliases:
|
||||||
return False, _("You reached the maximum number of alias that"
|
return False, _("You reached the maximum number of alias that"
|
||||||
" you are allowed to create yourself (%s). "
|
" you are allowed to create yourself (%s). "
|
||||||
% max_lambdauser_aliases)
|
% max_lambdauser_aliases)
|
||||||
|
@ -1695,7 +1692,7 @@ class Service(RevMixin, AclMixin, models.Model):
|
||||||
|
|
||||||
def ask_regen(self):
|
def ask_regen(self):
|
||||||
""" Marque à True la demande de régénération pour un service x """
|
""" Marque à True la demande de régénération pour un service x """
|
||||||
Service_link.objects.filter(service=self).exclude(asked_regen=True)\
|
Service_link.objects.filter(service=self).exclude(asked_regen=True) \
|
||||||
.update(asked_regen=True)
|
.update(asked_regen=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -1703,11 +1700,11 @@ class Service(RevMixin, AclMixin, models.Model):
|
||||||
""" Django ne peut créer lui meme les relations manytomany avec table
|
""" Django ne peut créer lui meme les relations manytomany avec table
|
||||||
intermediaire explicite"""
|
intermediaire explicite"""
|
||||||
for serv in servers.exclude(
|
for serv in servers.exclude(
|
||||||
pk__in=Interface.objects.filter(service=self)
|
pk__in=Interface.objects.filter(service=self)
|
||||||
):
|
):
|
||||||
link = Service_link(service=self, server=serv)
|
link = Service_link(service=self, server=serv)
|
||||||
link.save()
|
link.save()
|
||||||
Service_link.objects.filter(service=self).exclude(server__in=servers)\
|
Service_link.objects.filter(service=self).exclude(server__in=servers) \
|
||||||
.delete()
|
.delete()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -1754,10 +1751,10 @@ class Service_link(RevMixin, AclMixin, models.Model):
|
||||||
régénération de service"""
|
régénération de service"""
|
||||||
return bool(
|
return bool(
|
||||||
(self.asked_regen and (
|
(self.asked_regen and (
|
||||||
self.last_regen + self.service.min_time_regen
|
self.last_regen + self.service.min_time_regen
|
||||||
) < timezone.now()
|
) < timezone.now()
|
||||||
) or (
|
) or (
|
||||||
self.last_regen + self.service.regular_time_regen
|
self.last_regen + self.service.regular_time_regen
|
||||||
) < timezone.now()
|
) < timezone.now()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1875,9 +1872,8 @@ class OuverturePort(RevMixin, AclMixin, models.Model):
|
||||||
),
|
),
|
||||||
default=OUT,
|
default=OUT,
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("ports opening")
|
|
||||||
verbose_name = _("ports openings")
|
verbose_name = _("ports openings")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -2044,4 +2040,3 @@ def srv_post_save(**_kwargs):
|
||||||
def srv_post_delete(**_kwargs):
|
def srv_post_delete(**_kwargs):
|
||||||
"""Regeneration dns après modification d'un SRV"""
|
"""Regeneration dns après modification d'un SRV"""
|
||||||
regen('dns')
|
regen('dns')
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
Serializers for the Machines app
|
Serializers for the Machines app
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from machines.models import (
|
from machines.models import (
|
||||||
Interface,
|
Interface,
|
||||||
IpType,
|
IpType,
|
||||||
|
@ -148,13 +148,13 @@ class TypeSerializer(serializers.ModelSerializer):
|
||||||
get ForeignKey values. Infos about the general port policy is added """
|
get ForeignKey values. Infos about the general port policy is added """
|
||||||
|
|
||||||
extension = ExtensionNameField(read_only=True)
|
extension = ExtensionNameField(read_only=True)
|
||||||
ouverture_ports_tcp_in = serializers\
|
ouverture_ports_tcp_in = serializers \
|
||||||
.SerializerMethodField('get_port_policy_input_tcp')
|
.SerializerMethodField('get_port_policy_input_tcp')
|
||||||
ouverture_ports_tcp_out = serializers\
|
ouverture_ports_tcp_out = serializers \
|
||||||
.SerializerMethodField('get_port_policy_output_tcp')
|
.SerializerMethodField('get_port_policy_output_tcp')
|
||||||
ouverture_ports_udp_in = serializers\
|
ouverture_ports_udp_in = serializers \
|
||||||
.SerializerMethodField('get_port_policy_input_udp')
|
.SerializerMethodField('get_port_policy_input_udp')
|
||||||
ouverture_ports_udp_out = serializers\
|
ouverture_ports_udp_out = serializers \
|
||||||
.SerializerMethodField('get_port_policy_output_udp')
|
.SerializerMethodField('get_port_policy_output_udp')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -400,7 +400,7 @@ class OuverturePortsSerializer(serializers.Serializer):
|
||||||
return {
|
return {
|
||||||
i.ipv4.ipv4: {
|
i.ipv4.ipv4: {
|
||||||
"tcp_in": [j.tcp_ports_in() for j in i.port_lists.all()],
|
"tcp_in": [j.tcp_ports_in() for j in i.port_lists.all()],
|
||||||
"tcp_out": [j.tcp_ports_out()for j in i.port_lists.all()],
|
"tcp_out": [j.tcp_ports_out() for j in i.port_lists.all()],
|
||||||
"udp_in": [j.udp_ports_in() for j in i.port_lists.all()],
|
"udp_in": [j.udp_ports_in() for j in i.port_lists.all()],
|
||||||
"udp_out": [j.udp_ports_out() for j in i.port_lists.all()],
|
"udp_out": [j.udp_ports_out() for j in i.port_lists.all()],
|
||||||
}
|
}
|
||||||
|
@ -413,7 +413,7 @@ class OuverturePortsSerializer(serializers.Serializer):
|
||||||
return {
|
return {
|
||||||
i.ipv6: {
|
i.ipv6: {
|
||||||
"tcp_in": [j.tcp_ports_in() for j in i.port_lists.all()],
|
"tcp_in": [j.tcp_ports_in() for j in i.port_lists.all()],
|
||||||
"tcp_out": [j.tcp_ports_out()for j in i.port_lists.all()],
|
"tcp_out": [j.tcp_ports_out() for j in i.port_lists.all()],
|
||||||
"udp_in": [j.udp_ports_in() for j in i.port_lists.all()],
|
"udp_in": [j.udp_ports_in() for j in i.port_lists.all()],
|
||||||
"udp_out": [j.udp_ports_out() for j in i.port_lists.all()],
|
"udp_out": [j.udp_ports_out() for j in i.port_lists.all()],
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,21 +28,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Aliases" %}</th>
|
<th>{% trans "Aliases" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for alias in alias_list %}
|
{% for alias in alias_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ alias }}</td>
|
<td>{{ alias }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit alias %}
|
{% can_edit alias %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-alias' id=alias.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-alias' id=alias.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button alias %}
|
{% history_button alias %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Target zone" %}</th>
|
<th>{% trans "Target zone" %}</th>
|
||||||
<th>{% trans "Record" %}</th>
|
<th>{% trans "Record" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for dname in dname_list %}
|
{% for dname in dname_list %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -38,11 +38,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ dname.dns_entry }}</td>
|
<td>{{ dname.dns_entry }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit dname %}
|
{% can_edit dname %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-dname' id=dname.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-dname' id=dname.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button dname %}
|
{% history_button dname %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -30,34 +30,33 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Extension" %}</th>
|
<th>{% trans "Extension" %}</th>
|
||||||
<th>{% trans "'infra' right required" %}</th>
|
<th>{% trans "'infra' right required" %}</th>
|
||||||
<th>{% trans "SOA record" %}</th>
|
<th>{% trans "SOA record" %}</th>
|
||||||
<th>{% trans "A record origin" %}</th>
|
<th>{% trans "A record origin" %}</th>
|
||||||
{% if ipv6_enabled %}
|
{% if ipv6_enabled %}
|
||||||
<th>{% trans "AAAA record origin" %}</th>
|
<th>{% trans "AAAA record origin" %}</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for extension in extension_list %}
|
{% for extension in extension_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ extension.name }}</td>
|
<td>{{ extension.name }}</td>
|
||||||
<td>{{ extension.need_infra|tick }}</td>
|
<td>{{ extension.need_infra|tick }}</td>
|
||||||
<td>{{ extension.soa }}</td>
|
<td>{{ extension.soa }}</td>
|
||||||
<td>{{ extension.origin }}</td>
|
<td>{{ extension.origin }}</td>
|
||||||
{% if ipv6_enabled %}
|
{% if ipv6_enabled %}
|
||||||
<td>{{ extension.origin_v6 }}</td>
|
<td>{{ extension.origin_v6 }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit extension %}
|
{% can_edit extension %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-extension' id=extension.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button extension %}
|
{% history_button extension %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -31,36 +31,36 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "IP type" %}</th>
|
<th>{% trans "IP type" %}</th>
|
||||||
<th>{% trans "Extension" %}</th>
|
<th>{% trans "Extension" %}</th>
|
||||||
<th>{% trans "'infra' right required" %}</th>
|
<th>{% trans "'infra' right required" %}</th>
|
||||||
<th>{% trans "IPv4 range" %}</th>
|
<th>{% trans "IPv4 range" %}</th>
|
||||||
<th>{% trans "v6 prefix" %}</th>
|
<th>{% trans "v6 prefix" %}</th>
|
||||||
<th>{% trans "DNSSEC reverse v4/v6" %}</th>
|
<th>{% trans "DNSSEC reverse v4/v6" %}</th>
|
||||||
<th>{% trans "On VLAN(s)" %}</th>
|
<th>{% trans "On VLAN(s)" %}</th>
|
||||||
<th>{% trans "Default ports opening" %}</th>
|
<th>{% trans "Default ports opening" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for type in iptype_list %}
|
{% for type in iptype_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ type.type }}</td>
|
<td>{{ type.type }}</td>
|
||||||
<td>{{ type.extension }}</td>
|
<td>{{ type.extension }}</td>
|
||||||
<td>{{ type.need_infra|tick }}</td>
|
<td>{{ type.need_infra|tick }}</td>
|
||||||
<td>{{ type.domaine_ip_start }}-{{ type.domaine_ip_stop }}{% if type.ip_network %}<b><u> on </b></u>{{ type.ip_network }}{% endif %}</td>
|
<td>{{ type.domaine_ip_start }}-{{ type.domaine_ip_stop }}{% if type.ip_network %}<b><u> on </u></b>
|
||||||
<td>{{ type.prefix_v6 }}/{{ type.prefix_v6_length }}</td>
|
{{ type.ip_network }}{% endif %}</td>
|
||||||
<td>{{ type.reverse_v4|tick }}/{{ type.reverse_v6|tick }}</td>
|
<td>{{ type.prefix_v6 }}/{{ type.prefix_v6_length }}</td>
|
||||||
<td>{{ type.vlan }}</td>
|
<td>{{ type.reverse_v4|tick }}/{{ type.reverse_v6|tick }}</td>
|
||||||
<td>{{ type.ouverture_ports }}</td>
|
<td>{{ type.vlan }}</td>
|
||||||
<td class="text-right">
|
<td>{{ type.ouverture_ports }}</td>
|
||||||
{% can_edit type %}
|
<td class="text-right">
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-iptype' id=type.id %}
|
{% can_edit type %}
|
||||||
{% acl_end %}
|
{% include 'buttons/edit.html' with href='machines:edit-iptype' id=type.id %}
|
||||||
{% history_button type %}
|
{% acl_end %}
|
||||||
</td>
|
{% history_button type %}
|
||||||
</tr>
|
</td>
|
||||||
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -28,26 +28,25 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "IPv6 addresses" %}</th>
|
<th>{% trans "IPv6 addresses" %}</th>
|
||||||
<th>{% trans "SLAAC" %}</th>
|
<th>{% trans "SLAAC" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for ipv6 in ipv6_list %}
|
{% for ipv6 in ipv6_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ ipv6.ipv6 }}</td>
|
<td>{{ ipv6.ipv6 }}</td>
|
||||||
<td>{{ ipv6.slaac_ip }}</td>
|
<td>{{ ipv6.slaac_ip }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit ipv6 %}
|
{% can_edit ipv6 %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-ipv6list' id=ipv6.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-ipv6list' id=ipv6.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_delete ipv6 %}
|
{% can_delete ipv6 %}
|
||||||
{% include 'buttons/suppr.html' with href='machines:del-ipv6list' id=ipv6.id %}
|
{% include 'buttons/suppr.html' with href='machines:del-ipv6list' id=ipv6.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button ipv6 %}
|
{% history_button ipv6 %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
{% if machines_list.paginator %}
|
{% if machines_list.paginator %}
|
||||||
{% include "pagination.html" with list=machines_list %}
|
{% include "pagination.html" with list=machines_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<table class="table" id="machines_table">
|
<table class="table" id="machines_table">
|
||||||
|
@ -61,156 +61,160 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% can_create Interface machine.id %}
|
{% can_create Interface machine.id %}
|
||||||
{% trans "Create an interface" as tr_create_an_interface %}
|
{% trans "Create an interface" as tr_create_an_interface %}
|
||||||
{% include 'buttons/add.html' with href='machines:new-interface' id=machine.id desc=tr_create_an_interface %}
|
{% include 'buttons/add.html' with href='machines:new-interface' id=machine.id desc=tr_create_an_interface %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button machine %}
|
{% history_button machine %}
|
||||||
{% can_delete machine %}
|
{% can_delete machine %}
|
||||||
{% include 'buttons/suppr.html' with href='machines:del-machine' id=machine.id %}
|
{% include 'buttons/suppr.html' with href='machines:del-machine' id=machine.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% for interface in machine.interface_set.all %}
|
{% for interface in machine.interface_set.all %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{% if interface.domain.related_domain.all %}
|
{% if interface.domain.related_domain.all %}
|
||||||
{{ interface.domain }}
|
{{ interface.domain }}
|
||||||
<button class="btn btn-default btn-xs" type="button" data-toggle="collapse" data-target="#collapseDomain_{{ interface.id }}" aria-expanded="true" aria-controls="collapseDomain_{{ interface.id }}">
|
<button class="btn btn-default btn-xs" type="button" data-toggle="collapse"
|
||||||
{% trans "Display the aliases" %}
|
data-target="#collapseDomain_{{ interface.id }}" aria-expanded="true"
|
||||||
</button>
|
aria-controls="collapseDomain_{{ interface.id }}">
|
||||||
|
{% trans "Display the aliases" %}
|
||||||
|
</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ interface.domain }}
|
{{ interface.domain }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ interface.type }}
|
{{ interface.type }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ interface.mac_address }}
|
{{ interface.mac_address }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<b>IPv4</b> {{ interface.ipv4 }}
|
<b>IPv4</b> {{ interface.ipv4 }}
|
||||||
<br>
|
<br>
|
||||||
{% if ipv6_enabled and interface.ipv6 != 'None'%}
|
{% if ipv6_enabled and interface.ipv6 != 'None' %}
|
||||||
<b>IPv6</b>
|
<b>IPv6</b>
|
||||||
<button class="btn btn-default btn-xs" type="button" data-toggle="collapse" data-target="#collapseIpv6_{{ interface.id }}" aria-expanded="true" aria-controls="collapseIpv6_{{ interface.id }}">
|
<button class="btn btn-default btn-xs" type="button" data-toggle="collapse"
|
||||||
{% trans "Display the IPv6 address" %}
|
data-target="#collapseIpv6_{{ interface.id }}" aria-expanded="true"
|
||||||
</button>
|
aria-controls="collapseIpv6_{{ interface.id }}">
|
||||||
|
{% trans "Display the IPv6 address" %}
|
||||||
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<div style="width: 128px;">
|
<div style="width: 128px;">
|
||||||
<div class="btn-group" role="group">
|
<div class="btn-group" role="group">
|
||||||
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" id="editioninterface" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
<button class="btn btn-primary btn-sm dropdown-toggle" type="button"
|
||||||
|
id="editioninterface" data-toggle="dropdown" aria-haspopup="true"
|
||||||
|
aria-expanded="true">
|
||||||
<i class="fa fa-edit"></i> <span class="caret"></span>
|
<i class="fa fa-edit"></i> <span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu" aria-labelledby="editioninterface">
|
<ul class="dropdown-menu" aria-labelledby="editioninterface">
|
||||||
{% can_edit interface %}
|
{% can_edit interface %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url 'machines:edit-interface' interface.id %}">
|
<a href="{% url 'machines:edit-interface' interface.id %}">
|
||||||
<i class="fa fa-edit"></i>
|
<i class="fa fa-edit"></i>
|
||||||
{% trans " Edit"%}
|
{% trans " Edit" %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_create Domain interface.id %}
|
{% can_create Domain interface.id %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url 'machines:index-alias' interface.id %}">
|
<a href="{% url 'machines:index-alias' interface.id %}">
|
||||||
<i class="fa fa-edit"></i>
|
<i class="fa fa-edit"></i>
|
||||||
{% trans " Manage the aliases" %}
|
{% trans " Manage the aliases" %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_create Ipv6List interface.id %}
|
{% can_create Ipv6List interface.id %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url 'machines:index-ipv6' interface.id %}">
|
<a href="{% url 'machines:index-ipv6' interface.id %}">
|
||||||
<i class="fa fa-edit"></i>
|
<i class="fa fa-edit"></i>
|
||||||
{% trans " Manage the IPv6 addresses" %}
|
{% trans " Manage the IPv6 addresses" %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_create SshFp interface.machine.id %}
|
{% can_create SshFp interface.machine.id %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url 'machines:index-sshfp' interface.machine.id %}">
|
<a href="{% url 'machines:index-sshfp' interface.machine.id %}">
|
||||||
<i class="fa fa-edit"></i>
|
<i class="fa fa-edit"></i>
|
||||||
{% trans " Manage the SSH fingerprints" %}
|
{% trans " Manage the SSH fingerprints" %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_create OuverturePortList %}
|
{% can_create OuverturePortList %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{% url 'machines:port-config' interface.id%}">
|
<a href="{% url 'machines:port-config' interface.id %}">
|
||||||
<i class="fa fa-edit"></i>
|
<i class="fa fa-edit"></i>
|
||||||
{% trans " Manage the ports configuration" %}
|
{% trans " Manage the ports configuration" %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{% history_button interface %}
|
{% history_button interface %}
|
||||||
{% can_delete interface %}
|
{% can_delete interface %}
|
||||||
{% include 'buttons/suppr.html' with href='machines:del-interface' id=interface.id %}
|
{% include 'buttons/suppr.html' with href='machines:del-interface' id=interface.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if ipv6_enabled and interface.ipv6 != 'None'%}
|
{% if ipv6_enabled and interface.ipv6 != 'None' %}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=5 style="border-top: none; padding: 1px;">
|
<td colspan=5 style="border-top: none; padding: 1px;">
|
||||||
<div class="collapse in" id="collapseIpv6_{{interface.id}}">
|
<div class="collapse in" id="collapseIpv6_{{ interface.id }}">
|
||||||
<ul class="list-group" style="margin-bottom: 0px;">
|
<ul class="list-group" style="margin-bottom: 0;">
|
||||||
{% for ipv6 in interface.ipv6.all %}
|
{% for ipv6 in interface.ipv6.all %}
|
||||||
<li class="list-group-item col-xs-6 col-sm-6 col-md-6" style="border: none;">
|
<li class="list-group-item col-xs-6 col-sm-6 col-md-6" style="border: none;">
|
||||||
{{ ipv6 }}
|
{{ ipv6 }}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if interface.domain.related_domain.all %}
|
{% if interface.domain.related_domain.all %}
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=5 style="border-top: none; padding: 1px;">
|
<td colspan=5 style="border-top: none; padding: 1px;">
|
||||||
<div class="collapse in" id="collapseDomain_{{interface.id}}">
|
<div class="collapse in" id="collapseDomain_{{ interface.id }}">
|
||||||
<ul class="list-group" style="margin-bottom: 0px;">
|
<ul class="list-group" style="margin-bottom: 0;">
|
||||||
{% for al in interface.domain.related_domain.all %}
|
{% for al in interface.domain.related_domain.all %}
|
||||||
<li class="list-group-item col-xs-6 col-sm-4 col-md-3" style="border: none;">
|
<li class="list-group-item col-xs-6 col-sm-4 col-md-3" style="border: none;">
|
||||||
<a href="http://{{ al }}">
|
<a href="http://{{ al }}">
|
||||||
{{ al }}
|
{{ al }}
|
||||||
<i class="fa fa-share"></i>
|
<i class="fa fa-share"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
|
||||||
<tr>
|
|
||||||
<td colspan="8"></td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
<tr>
|
||||||
</thead>
|
<td colspan="8"></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$("#machines_table").ready( function() {
|
$("#machines_table").ready(function () {
|
||||||
var alias_div = [{% for machine in machines_list %}{% for interface in machine.interface_set.all %}{% if interface.domain.related_domain.all %}$("#collapseDomain_{{ interface.id }}"), {% endif %}{% endfor %}{% endfor %}];
|
var alias_div = [{% for machine in machines_list %}{% for interface in machine.interface_set.all %}{% if interface.domain.related_domain.all %}$("#collapseDomain_{{ interface.id }}"), {% endif %}{% endfor %}{% endfor %}];
|
||||||
for (var i=0 ; i<alias_div.length ; i++) {
|
for (var i = 0; i < alias_div.length; i++) {
|
||||||
alias_div[i].collapse('hide');
|
alias_div[i].collapse('hide');
|
||||||
}
|
}
|
||||||
} );
|
});
|
||||||
$("#machines_table").ready( function() {
|
$("#machines_table").ready(function () {
|
||||||
var ipv6_div = [{% for machine in machines_list %}{% for interface in machine.interface_set.all %}{% if interface.ipv6.all %}$("#collapseIpv6_{{ interface.id }}"), {% endif %}{% endfor %}{% endfor %}];
|
var ipv6_div = [{% for machine in machines_list %}{% for interface in machine.interface_set.all %}{% if interface.ipv6.all %}$("#collapseIpv6_{{ interface.id }}"), {% endif %}{% endfor %}{% endfor %}];
|
||||||
for (var i=0 ; i<ipv6_div.length ; i++) {
|
for (var i = 0; i < ipv6_div.length; i++) {
|
||||||
ipv6_div[i].collapse('hide');
|
ipv6_div[i].collapse('hide');
|
||||||
}
|
}
|
||||||
} );
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% if machines_list.paginator %}
|
{% if machines_list.paginator %}
|
||||||
{% include "pagination.html" with list=machines_list %}
|
{% include "pagination.html" with list=machines_list %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Machine type" %}</th>
|
<th>{% trans "Machine type" %}</th>
|
||||||
<th>{% trans "Matching IP type" %}</th>
|
<th>{% trans "Matching IP type" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for type in machinetype_list %}
|
{% for type in machinetype_list %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -40,11 +40,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ type.ip_type }}</td>
|
<td>{{ type.ip_type }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit type %}
|
{% can_edit type %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-machinetype' id=type.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-machinetype' id=type.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button type %}
|
{% history_button type %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -28,12 +28,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Concerned zone" %}</th>
|
<th>{% trans "Concerned zone" %}</th>
|
||||||
<th>{% trans "Priority" %}</th>
|
<th>{% trans "Priority" %}</th>
|
||||||
<th>{% trans "Record" %}</th>
|
<th>{% trans "Record" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for mx in mx_list %}
|
{% for mx in mx_list %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -42,11 +42,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ mx.name }}</td>
|
<td>{{ mx.name }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit mx %}
|
{% can_edit mx %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-mx' id=mx.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-mx' id=mx.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button mx %}
|
{% history_button mx %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -29,29 +29,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Name" %}</th>
|
<th>{% trans "Name" %}</th>
|
||||||
<th>{% trans "NAS device type" %}</th>
|
<th>{% trans "NAS device type" %}</th>
|
||||||
<th>{% trans "Machine type linked to the NAS device" %}</th>
|
<th>{% trans "Machine type linked to the NAS device" %}</th>
|
||||||
<th>{% trans "Access mode" %}</th>
|
<th>{% trans "Access mode" %}</th>
|
||||||
<th>{% trans "MAC address auto capture" %}</th>
|
<th>{% trans "MAC address auto capture" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for nas in nas_list %}
|
{% for nas in nas_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ nas.name }}</td>
|
<td>{{ nas.name }}</td>
|
||||||
<td>{{ nas.nas_type }}</td>
|
<td>{{ nas.nas_type }}</td>
|
||||||
<td>{{ nas.machine_type }}</td>
|
<td>{{ nas.machine_type }}</td>
|
||||||
<td>{{ nas.port_access_mode }}</td>
|
<td>{{ nas.port_access_mode }}</td>
|
||||||
<td>{{ nas.autocapture_mac|tick }}</td>
|
<td>{{ nas.autocapture_mac|tick }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit nas %}
|
{% can_edit nas %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-nas' id=nas.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-nas' id=nas.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button nas %}
|
{% history_button nas %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Concerned zone" %}</th>
|
<th>{% trans "Concerned zone" %}</th>
|
||||||
<th>{% trans "Authoritarian interface for the concerned zone" %}</th>
|
<th>{% trans "Authoritarian interface for the concerned zone" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for ns in ns_list %}
|
{% for ns in ns_list %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -40,11 +40,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ ns.ns }}</td>
|
<td>{{ ns.ns }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit ns %}
|
{% can_edit ns %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-ns' id=ns.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-ns' id=ns.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button ns %}
|
{% history_button ns %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Role name" %}</th>
|
<th>{% trans "Role name" %}</th>
|
||||||
<th>{% trans "Specific role" %}</th>
|
<th>{% trans "Specific role" %}</th>
|
||||||
<th>{% trans "Servers" %}</th>
|
<th>{% trans "Servers" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for role in role_list %}
|
{% for role in role_list %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -43,12 +43,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ role.specific_role }}</td>
|
<td>{{ role.specific_role }}</td>
|
||||||
<td>{% for serv in role.servers.all %}{{ serv }}, {% endfor %}</td>
|
<td>{% for serv in role.servers.all %}{{ serv }}, {% endfor %}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit role %}
|
{% can_edit role %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-role' id=role.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-role' id=role.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button role %}
|
{% history_button role %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -27,13 +27,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Service name" %}</th>
|
<th>{% trans "Service name" %}</th>
|
||||||
<th>{% trans "Server" %}</th>
|
<th>{% trans "Server" %}</th>
|
||||||
<th>{% trans "Last regeneration" %}</th>
|
<th>{% trans "Last regeneration" %}</th>
|
||||||
<th>{% trans "Regeneration required" %}</th>
|
<th>{% trans "Regeneration required" %}</th>
|
||||||
<th>{% trans "Regeneration activated" %}</th>
|
<th>{% trans "Regeneration activated" %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for server in servers_list %}
|
{% for server in servers_list %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -47,4 +47,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Service name" %}</th>
|
<th>{% trans "Service name" %}</th>
|
||||||
<th>{% trans "Minimal time before regeneration" %}</th>
|
<th>{% trans "Minimal time before regeneration" %}</th>
|
||||||
<th>{% trans "Maximal time before regeneration" %}</th>
|
<th>{% trans "Maximal time before regeneration" %}</th>
|
||||||
<th>{% trans "Included servers" %}</th>
|
<th>{% trans "Included servers" %}</th>
|
||||||
<th>{% trans "Ask for regeneration" %}</th>
|
<th>{% trans "Ask for regeneration" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for service in service_list %}
|
{% for service in service_list %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -43,14 +43,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ service.min_time_regen }}</td>
|
<td>{{ service.min_time_regen }}</td>
|
||||||
<td>{{ service.regular_time_regen }}</td>
|
<td>{{ service.regular_time_regen }}</td>
|
||||||
<td>{% for serv in service.servers.all %}{{ serv }}, {% endfor %}</td>
|
<td>{% for serv in service.servers.all %}{{ serv }}, {% endfor %}</td>
|
||||||
<td><a role="button" class="btn btn-danger" href="{% url 'machines:regen-service' service.id %}"><i class="fa fa-sync"></i></a></td>
|
<td><a role="button" class="btn btn-danger" href="{% url 'machines:regen-service' service.id %}"><i
|
||||||
|
class="fa fa-sync"></i></a></td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit service %}
|
{% can_edit service %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-service' id=service.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button service %}
|
{% history_button service %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -28,15 +28,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Name" %}</th>
|
<th>{% trans "Name" %}</th>
|
||||||
<th>{% trans "Mail" %}</th>
|
<th>{% trans "Mail" %}</th>
|
||||||
<th>{% trans "Refresh" %}</th>
|
<th>{% trans "Refresh" %}</th>
|
||||||
<th>{% trans "Retry" %}</th>
|
<th>{% trans "Retry" %}</th>
|
||||||
<th>{% trans "Expire" %}</th>
|
<th>{% trans "Expire" %}</th>
|
||||||
<th>{% trans "TTL" %}</th>
|
<th>{% trans "TTL" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for soa in soa_list %}
|
{% for soa in soa_list %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -48,11 +48,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ soa.ttl }}</td>
|
<td>{{ soa.ttl }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit soa %}
|
{% can_edit soa %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-soa' id=soa.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-soa' id=soa.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button soa %}
|
{% history_button soa %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -28,17 +28,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Service" %}</th>
|
<th>{% trans "Service" %}</th>
|
||||||
<th>{% trans "Protocol" %}</th>
|
<th>{% trans "Protocol" %}</th>
|
||||||
<th>{% trans "Extension" %}</th>
|
<th>{% trans "Extension" %}</th>
|
||||||
<th>{% trans "TTL" %}</th>
|
<th>{% trans "TTL" %}</th>
|
||||||
<th>{% trans "Priority" %}</th>
|
<th>{% trans "Priority" %}</th>
|
||||||
<th>{% trans "Weight" %}</th>
|
<th>{% trans "Weight" %}</th>
|
||||||
<th>{% trans "Port" %}</th>
|
<th>{% trans "Port" %}</th>
|
||||||
<th>{% trans "Target" %}</th>
|
<th>{% trans "Target" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for srv in srv_list %}
|
{% for srv in srv_list %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -52,11 +52,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ srv.target }}</td>
|
<td>{{ srv.target }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit srv %}
|
{% can_edit srv %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-srv' id=srv.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-srv' id=srv.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button srv %}
|
{% history_button srv %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -27,12 +27,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped long_text">
|
<table class="table table-striped long_text">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="long_text">{% trans "SSH public key" %}</th>
|
<th class="long_text">{% trans "SSH public key" %}</th>
|
||||||
<th>{% trans "Algorithm used" %}</th>
|
<th>{% trans "Algorithm used" %}</th>
|
||||||
<th>{% trans "Comment" %}</th>
|
<th>{% trans "Comment" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for sshfp in sshfp_list %}
|
{% for sshfp in sshfp_list %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -41,15 +41,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ sshfp.comment }}</td>
|
<td>{{ sshfp.comment }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit sshfp %}
|
{% can_edit sshfp %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-sshfp' id=sshfp.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-sshfp' id=sshfp.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button sshfp %}
|
{% history_button sshfp %}
|
||||||
{% can_delete sshfp %}
|
{% can_delete sshfp %}
|
||||||
{% include 'buttons/suppr.html' with href='machines:del-sshfp' id=sshfp.id %}
|
{% include 'buttons/suppr.html' with href='machines:del-sshfp' id=sshfp.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Concerned zone" %}</th>
|
<th>{% trans "Concerned zone" %}</th>
|
||||||
<th>{% trans "Record" %}</th>
|
<th>{% trans "Record" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for txt in txt_list %}
|
{% for txt in txt_list %}
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -40,11 +40,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<td>{{ txt.dns_entry }}</td>
|
<td>{{ txt.dns_entry }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit txt %}
|
{% can_edit txt %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-txt' id=txt.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-txt' id=txt.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button txt %}
|
{% history_button txt %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -29,23 +29,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "ID" %}</th>
|
<th>{% trans "ID" %}</th>
|
||||||
<th>{% trans "Name" %}</th>
|
<th>{% trans "Name" %}</th>
|
||||||
<th>{% trans "Comment" %}</th>
|
<th>{% trans "Comment" %}</th>
|
||||||
<th>{% trans "IP ranges" %}</th>
|
<th>{% trans "IP ranges" %}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{% for vlan in vlan_list %}
|
{% for vlan in vlan_list %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ vlan.vlan_id }}</td>
|
<td>{{ vlan.vlan_id }}</td>
|
||||||
<td>{{ vlan.name }}</td>
|
<td>{{ vlan.name }}</td>
|
||||||
<td>{{ vlan.comment }}</td>
|
<td>{{ vlan.comment }}</td>
|
||||||
<td>{% for range in vlan.iptype_set.all %}{{ range }}, {% endfor%}</td>
|
<td>{% for range in vlan.iptype_set.all %}{{ range }}, {% endfor %}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{% can_edit vlan %}
|
{% can_edit vlan %}
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-vlan' id=vlan.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-vlan' id=vlan.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% history_button vlan %}
|
{% history_button vlan %}
|
||||||
</td>
|
</td>
|
||||||
|
@ -53,4 +53,3 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -30,14 +30,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<h4>{% blocktrans %}Warning: are you sure you want to delete this object {{ objet_name }} ( {{ objet }} )?{% endblocktrans %}</h4>
|
<h4>{% blocktrans %}Warning: are you sure you want to delete this object {{ objet_name }} ( {{ objet }}
|
||||||
{% trans "Confirm" as tr_confirm %}
|
)?{% endblocktrans %}</h4>
|
||||||
{% bootstrap_button tr_confirm button_type="submit" icon='trash' button_class='btn-danger' %}
|
{% trans "Confirm" as tr_confirm %}
|
||||||
</form>
|
{% bootstrap_button tr_confirm button_type="submit" icon='trash' button_class='btn-danger' %}
|
||||||
<br />
|
</form>
|
||||||
<br />
|
<br/>
|
||||||
<br />
|
<br/>
|
||||||
|
<br/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -29,44 +29,45 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% block title %}{% trans "Machines" %}{% endblock %}
|
{% block title %}{% trans "Machines" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% bootstrap_form_errors port_list %}
|
{% bootstrap_form_errors port_list %}
|
||||||
|
|
||||||
|
|
||||||
<form class="form" method="post">
|
<form class="form" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{% bootstrap_form port_list %}
|
{% bootstrap_form port_list %}
|
||||||
{{ ports.management_form }}
|
{{ ports.management_form }}
|
||||||
<div id="formset">
|
<div id="formset">
|
||||||
{% for form in ports.forms %}
|
{% for form in ports.forms %}
|
||||||
<div class="port">
|
<div class="port">
|
||||||
<p>
|
<p>
|
||||||
{{ form }}
|
{{ form }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% trans "Add a port" as value %}
|
{% trans "Add a port" as value %}
|
||||||
<input class="btn btn-primary btn-sm" role="button" value=value id="add_one">
|
<input class="btn btn-primary btn-sm" role="button" value="value" id="add_one">
|
||||||
</p>
|
</p>
|
||||||
{% trans "Create or edit" as tr_create_or_edit %}
|
{% trans "Create or edit" as tr_create_or_edit %}
|
||||||
{% bootstrap_button tr_create_or_edit icon='ok' button_class='btn-success' %}
|
{% bootstrap_button tr_create_or_edit icon='ok' button_class='btn-success' %}
|
||||||
</form>
|
</form>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var template = `{{ports.empty_form}}`;
|
var template = `{{ports.empty_form}}`;
|
||||||
function add_port(){
|
|
||||||
var new_index = document.getElementsByClassName('port').length;
|
|
||||||
document.getElementById('id_form-TOTAL_FORMS').value =
|
|
||||||
parseInt(document.getElementById('id_form-TOTAL_FORMS').value) + 1;
|
|
||||||
var new_port = document.createElement('div');
|
|
||||||
new_port.className = 'port';
|
|
||||||
new_port.innerHTML = template.replace(/__prefix__/g, new_index);
|
|
||||||
document.getElementById('formset').appendChild(new_port);
|
|
||||||
}
|
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
|
||||||
document.getElementById("add_one").addEventListener("click", add_port, true);});
|
|
||||||
|
|
||||||
</script>
|
function add_port() {
|
||||||
|
var new_index = document.getElementsByClassName('port').length;
|
||||||
|
document.getElementById('id_form-TOTAL_FORMS').value =
|
||||||
|
parseInt(document.getElementById('id_form-TOTAL_FORMS').value) + 1;
|
||||||
|
var new_port = document.createElement('div');
|
||||||
|
new_port.className = 'port';
|
||||||
|
new_port.innerHTML = template.replace(/__prefix__/g, new_index);
|
||||||
|
document.getElementById('formset').appendChild(new_port);
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
document.getElementById("add_one").addEventListener("click", add_port, true);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% block title %}{% trans "Machines" %}{% endblock %}
|
{% block title %}{% trans "Machines" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans "Machines" %}</h2>
|
<h2>{% trans "Machines" %}</h2>
|
||||||
{% include "machines/aff_machines.html" with machines_list=machines_list %}
|
{% include "machines/aff_machines.html" with machines_list=machines_list %}
|
||||||
<br />
|
<br/>
|
||||||
<br />
|
<br/>
|
||||||
<br />
|
<br/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans "List of the aliases of the interface" %}</h2>
|
<h2>{% trans "List of the aliases of the interface" %}</h2>
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-alias' interface_id %}"><i class="fa fa-plus"></i>{% trans " Add an alias" %}</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-alias' interface_id %}"><i
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-alias' interface_id %}"><i class="fa fa-trash"></i>{% trans " Delete one or several aliases" %}</a>
|
class="fa fa-plus"></i>{% trans " Add an alias" %}</a>
|
||||||
{% include "machines/aff_alias.html" with alias_list=alias_list %}
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-alias' interface_id %}"><i
|
||||||
<br />
|
class="fa fa-trash"></i>{% trans " Delete one or several aliases" %}</a>
|
||||||
<br />
|
{% include "machines/aff_alias.html" with alias_list=alias_list %}
|
||||||
<br />
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -24,67 +24,86 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}{% trans "Machines" %}{% endblock %}
|
{% block title %}{% trans "Machines" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans "List of extensions" %}</h2>
|
<h2>{% trans "List of extensions" %}</h2>
|
||||||
{% can_create Extension %}
|
{% can_create Extension %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-extension' %}"><i class="fa fa-plus"></i>{% trans " Add an extension" %}</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-extension' %}">
|
||||||
{% acl_end %}
|
<i class="fa fa-plus"></i>
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-extension' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several extensions" %}</a>
|
{% trans " Add an extension" %}</a>
|
||||||
{% include "machines/aff_extension.html" with extension_list=extension_list %}
|
{% acl_end %}
|
||||||
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-extension' %}">
|
||||||
|
<i class="fa fa-trash"></i>{% trans " Delete one or several extensions" %}
|
||||||
|
</a>
|
||||||
|
{% include "machines/aff_extension.html" with extension_list=extension_list %}
|
||||||
|
|
||||||
<h2>{% trans "List of SOA records" %}</h2>
|
<h2>{% trans "List of SOA records" %}</h2>
|
||||||
{% can_create SOA %}
|
{% can_create SOA %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-soa' %}"><i class="fa fa-plus"></i>{% trans " Add an SOA record" %}</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-soa' %}">
|
||||||
{% acl_end %}
|
<i class="fa fa-plus"></i>{% trans " Add an SOA record" %}
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-soa' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several SOA records" %}</a>
|
</a>
|
||||||
{% include "machines/aff_soa.html" with soa_list=soa_list %}
|
{% acl_end %}
|
||||||
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-soa' %}">
|
||||||
|
<i class="fa fa-trash"></i>{% trans " Delete one or several SOA records" %}
|
||||||
|
</a>
|
||||||
|
{% include "machines/aff_soa.html" with soa_list=soa_list %}
|
||||||
|
|
||||||
<h2>{% trans "List of MX records" %}</h2>
|
<h2>{% trans "List of MX records" %}</h2>
|
||||||
{% can_create Mx %}
|
{% can_create Mx %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-mx' %}"><i class="fa fa-plus"></i>{% trans " Add an MX record" %}</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-mx' %}">
|
||||||
{% acl_end %}
|
<i class="fa fa-plus"></i>{% trans " Add an MX record" %}
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-mx' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several MX records" %}</a>
|
</a>
|
||||||
{% include "machines/aff_mx.html" with mx_list=mx_list %}
|
{% acl_end %}
|
||||||
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-mx' %}">
|
||||||
|
<i class="fa fa-trash"></i>{% trans " Delete one or several MX records" %}
|
||||||
|
</a>
|
||||||
|
{% include "machines/aff_mx.html" with mx_list=mx_list %}
|
||||||
|
|
||||||
<h2>{% trans "List of NS records" %}</h2>
|
<h2>{% trans "List of NS records" %}</h2>
|
||||||
{% can_create Ns %}
|
{% can_create Ns %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-ns' %}"><i class="fa fa-plus"></i>{% trans " Add an NS record" %}</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-ns' %}">
|
||||||
{% acl_end %}
|
<i class="fa fa-plus"></i>{% trans " Add an NS record" %}
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-ns' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several NS records" %}</a>
|
</a>
|
||||||
{% include "machines/aff_ns.html" with ns_list=ns_list %}
|
{% acl_end %}
|
||||||
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-ns' %}">
|
||||||
|
<i class="fa fa-trash"></i>{% trans " Delete one or several NS records" %}
|
||||||
|
</a>
|
||||||
|
{% include "machines/aff_ns.html" with ns_list=ns_list %}
|
||||||
|
|
||||||
<h2>{% trans "List of TXT records" %}</h2>
|
<h2>{% trans "List of TXT records" %}</h2>
|
||||||
{% can_create Txt %}
|
{% can_create Txt %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-txt' %}"><i class="fa fa-plus"></i>{% trans " Add a TXT record" %}</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-txt' %}">
|
||||||
{% acl_end %}
|
<i class="fa fa-plus"></i>{% trans " Add a TXT record" %}
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-txt' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several TXT records" %}</a>
|
</a>
|
||||||
{% include "machines/aff_txt.html" with txt_list=txt_list %}
|
{% acl_end %}
|
||||||
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-txt' %}">
|
||||||
|
<i class="fa fa-trash"></i>{% trans " Delete one or several TXT records" %}
|
||||||
|
</a>
|
||||||
|
{% include "machines/aff_txt.html" with txt_list=txt_list %}
|
||||||
|
|
||||||
<h2>{% trans "List of DNAME records" %}</h2>
|
<h2>{% trans "List of DNAME records" %}</h2>
|
||||||
{% can_create DName %}
|
{% can_create DName %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-dname' %}">
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-dname' %}">
|
||||||
<i class="fa fa-plus"></i> {% trans " Add a DNAME record" %}
|
<i class="fa fa-plus"></i> {% trans " Add a DNAME record" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-dname' %}">
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-dname' %}">
|
||||||
<i class="fa fa-trash"></i> {% trans " Delete one or several DNAME records" %}
|
<i class="fa fa-trash"></i> {% trans " Delete one or several DNAME records" %}
|
||||||
</a>
|
</a>
|
||||||
{% include "machines/aff_dname.html" with dname_list=dname_list %}
|
{% include "machines/aff_dname.html" with dname_list=dname_list %}
|
||||||
|
|
||||||
<h2>{% trans "List of SRV records" %}</h2>
|
|
||||||
{% can_create Srv %}
|
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-srv' %}"><i class="fa fa-plus"></i>{% trans " Add an SRV record" %}</a>
|
|
||||||
{% acl_end %}
|
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-srv' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several SRV records" %}</a>
|
|
||||||
{% include "machines/aff_srv.html" with srv_list=srv_list %}
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
<h2>{% trans "List of SRV records" %}</h2>
|
||||||
|
{% can_create Srv %}
|
||||||
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-srv' %}">
|
||||||
|
<i class="fa fa-plus"></i>{% trans " Add an SRV record" %}
|
||||||
|
</a>
|
||||||
|
{% acl_end %}
|
||||||
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-srv' %}">
|
||||||
|
<i class="fa fa-trash"></i>{% trans " Delete one or several SRV records" %}
|
||||||
|
</a>
|
||||||
|
{% include "machines/aff_srv.html" with srv_list=srv_list %}
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -24,21 +24,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}{% trans "Machines" %}{% endblock %}
|
{% block title %}{% trans "Machines" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans "List of IP types" %}</h2>
|
<h2>{% trans "List of IP types" %}</h2>
|
||||||
{% can_create IpType %}
|
{% can_create IpType %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-iptype' %}"><i class="fa fa-plus"></i>{% trans " Add an IP type" %}</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-iptype' %}">
|
||||||
{% acl_end %}
|
<i class="fa fa-plus"></i>{% trans " Add an IP type" %}
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-iptype' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several IP types" %}</a>
|
</a>
|
||||||
{% include "machines/aff_iptype.html" with iptype_list=iptype_list %}
|
{% acl_end %}
|
||||||
<br />
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-iptype' %}">
|
||||||
<br />
|
<i class="fa fa-trash"></i>{% trans " Delete one or several IP types" %}
|
||||||
<br />
|
</a>
|
||||||
|
{% include "machines/aff_iptype.html" with iptype_list=iptype_list %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,14 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% block title %}{% trans "Machines" %}{% endblock %}
|
{% block title %}{% trans "Machines" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans "List of the IPv6 addresses of the interface" %}</h2>
|
<h2>{% trans "List of the IPv6 addresses of the interface" %}</h2>
|
||||||
{% can_create Ipv6List interface_id %}
|
{% can_create Ipv6List interface_id %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-ipv6list' interface_id %}"><i class="fa fa-plus"></i>{% trans " Add an IPv6 address" %}</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:new-ipv6list' interface_id %}">
|
||||||
{% acl_end %}
|
<i class="fa fa-plus"></i>{% trans " Add an IPv6 address" %}
|
||||||
{% include "machines/aff_ipv6.html" with ipv6_list=ipv6_list %}
|
</a>
|
||||||
<br />
|
{% acl_end %}
|
||||||
<br />
|
{% include "machines/aff_ipv6.html" with ipv6_list=ipv6_list %}
|
||||||
<br />
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -31,14 +31,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% block title %}{% trans "Machines" %}{% endblock %}
|
{% block title %}{% trans "Machines" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans "List of machine types" %}</h2>
|
<h2>{% trans "List of machine types" %}</h2>
|
||||||
{% can_create MachineType %}
|
{% can_create MachineType %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-machinetype' %}"><i class="fa fa-plus"></i>{% trans " Add a machine type" %}</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-machinetype' %}">
|
||||||
{% acl_end %}
|
<i class="fa fa-plus"></i>{% trans " Add a machine type" %}
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-machinetype' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several machine types" %}</a>
|
</a>
|
||||||
{% include "machines/aff_machinetype.html" with machinetype_list=machinetype_list %}
|
{% acl_end %}
|
||||||
<br />
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-machinetype' %}">
|
||||||
<br />
|
<i class="fa fa-trash"></i>{% trans " Delete one or several machine types" %}
|
||||||
<br />
|
</a>
|
||||||
|
{% include "machines/aff_machinetype.html" with machinetype_list=machinetype_list %}
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -31,15 +31,18 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% block title %}{% trans "Machines" %}{% endblock %}
|
{% block title %}{% trans "Machines" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans "List of NAS devices" %}</h2>
|
<h2>{% trans "List of NAS devices" %}</h2>
|
||||||
<h5>{% trans "The NAS device type and machine type are linked. It is useful for MAC address auto capture by RADIUS, and allows to choose the machine type to assign to the machines according to the NAS device type." %}</h5>
|
<h5>{% trans "The NAS device type and machine type are linked. It is useful for MAC address auto capture by RADIUS, and allows to choose the machine type to assign to the machines according to the NAS device type." %}</h5>
|
||||||
{% can_create Nas %}
|
{% can_create Nas %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-nas' %}"><i class="fa fa-plus"></i>{% trans " Add a NAS device type" %}</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-nas' %}">
|
||||||
{% acl_end %}
|
<i class="fa fa-plus"></i>{% trans " Add a NAS device type" %}
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-nas' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several NAS device types" %}</a>
|
</a>
|
||||||
{% include "machines/aff_nas.html" with nas_list=nas_list %}
|
{% acl_end %}
|
||||||
<br />
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-nas' %}">
|
||||||
<br />
|
<i class="fa fa-trash"></i>{% trans " Delete one or several NAS device types" %}
|
||||||
<br />
|
</a>
|
||||||
|
{% include "machines/aff_nas.html" with nas_list=nas_list %}
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -8,60 +8,58 @@
|
||||||
{% block title %}{% trans "Machines" %}{% endblock %}
|
{% block title %}{% trans "Machines" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans "List of ports configurations" %}</h2>
|
<h2>{% trans "List of ports configurations" %}</h2>
|
||||||
{% can_create OuverturePortList %}
|
{% can_create OuverturePortList %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-portlist' %}"><i class="fa fa-plus"></i>{% trans " Add a configuration" %}</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-portlist' %}">
|
||||||
{% acl_end %}
|
<i class="fa fa-plus"></i>{% trans " Add a configuration" %}
|
||||||
<table class="table table-striped">
|
</a>
|
||||||
<thead>
|
{% acl_end %}
|
||||||
<tr>
|
<table class="table table-striped">
|
||||||
<th>{% trans "Name" %}</th>
|
<thead>
|
||||||
<th>{% trans "TCP (input)" %}</th>
|
<tr>
|
||||||
<th>{% trans "TCP (output)" %}</th>
|
<th>{% trans "Name" %}</th>
|
||||||
<th>{% trans "UDP (input)" %}</th>
|
<th>{% trans "TCP (input)" %}</th>
|
||||||
<th>{% trans "UDP (output)" %}</th>
|
<th>{% trans "TCP (output)" %}</th>
|
||||||
<th>{% trans "Machines" %}</th>
|
<th>{% trans "UDP (input)" %}</th>
|
||||||
<th></th>
|
<th>{% trans "UDP (output)" %}</th>
|
||||||
</tr>
|
<th>{% trans "Machines" %}</th>
|
||||||
</thead>
|
<th></th>
|
||||||
{% for pl in port_list %}
|
</tr>
|
||||||
<tr>
|
</thead>
|
||||||
<td>{{pl.name}}</td>
|
{% for pl in port_list %}
|
||||||
<td>{% for p in pl.tcp_ports_in %}{{p.show_port}}, {%endfor%}</td>
|
<tr>
|
||||||
<td>{% for p in pl.tcp_ports_out %}{{p.show_port}}, {%endfor%}</td>
|
<td>{{ pl.name }}</td>
|
||||||
<td>{% for p in pl.udp_ports_in %}{{p.show_port}}, {%endfor%}</td>
|
<td>{% for p in pl.tcp_ports_in %}{{ p.show_port }}, {% endfor %}</td>
|
||||||
<td>{% for p in pl.udp_ports_out %}{{p.show_port}}, {%endfor%}</td>
|
<td>{% for p in pl.tcp_ports_out %}{{ p.show_port }}, {% endfor %}</td>
|
||||||
<td>
|
<td>{% for p in pl.udp_ports_in %}{{ p.show_port }}, {% endfor %}</td>
|
||||||
{% if pl.interface_set.all %}
|
<td>{% for p in pl.udp_ports_out %}{{ p.show_port }}, {% endfor %}</td>
|
||||||
<div class="dropdown">
|
<td>
|
||||||
<button class="btn btn-default dropdown-toggle" type="button" id="editioninterface" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
{% if pl.interface_set.all %}
|
||||||
<span class="caret"></span>
|
<div class="dropdown">
|
||||||
</button>
|
<button class="btn btn-default dropdown-toggle" type="button" id="editioninterface"
|
||||||
<ul class="dropdown-menu" aria-labelledby="editioninterface">
|
data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||||
{% for interface in pl.interface_set.all %}
|
<span class="caret"></span>
|
||||||
<li>
|
</button>
|
||||||
<a href="{% url 'users:profil' userid=interface.machine.user.id %}">
|
<ul class="dropdown-menu" aria-labelledby="editioninterface">
|
||||||
{{ interface }}
|
{% for interface in pl.interface_set.all %}
|
||||||
</a>
|
<li>
|
||||||
</li>
|
<a href="{% url 'users:profil' userid=interface.machine.user.id %}">
|
||||||
{% endfor %}
|
{{ interface }}
|
||||||
</ul>
|
</a>
|
||||||
</div>
|
</li>
|
||||||
{% endif %}
|
{% endfor %}
|
||||||
<td class="text-right">
|
</ul>
|
||||||
{% can_edit pl %}
|
</div>
|
||||||
{% include 'buttons/edit.html' with href='machines:edit-portlist' id=pl.id %}
|
{% endif %}
|
||||||
{% acl_end %}
|
<td class="text-right">
|
||||||
{% can_delete pl %}
|
{% can_edit pl %}
|
||||||
{% include 'buttons/suppr.html' with href='machines:del-portlist' id=pl.id %}
|
{% include 'buttons/edit.html' with href='machines:edit-portlist' id=pl.id %}
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
</td>
|
{% can_delete pl %}
|
||||||
</tr>
|
{% include 'buttons/suppr.html' with href='machines:del-portlist' id=pl.id %}
|
||||||
{%endfor%}
|
{% acl_end %}
|
||||||
</table>
|
</td>
|
||||||
<br />
|
</tr>
|
||||||
<br />
|
{% endfor %}
|
||||||
<br />
|
</table>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% block title %}{% trans "Machines" %}{% endblock %}
|
{% block title %}{% trans "Machines" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans "List of roles" %}</h2>
|
<h2>{% trans "List of roles" %}</h2>
|
||||||
{% can_create Role %}
|
{% can_create Role %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-role' %}"><i class="fa fa-plus"></i>{% trans " Add a role"%}</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-role' %}"><i
|
||||||
{% acl_end %}
|
class="fa fa-plus"></i>{% trans " Add a role" %}</a>
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-role' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several roles" %}</a>
|
{% acl_end %}
|
||||||
{% include "machines/aff_role.html" with role_list=role_list %}
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-role' %}"><i
|
||||||
<br />
|
class="fa fa-trash"></i>{% trans " Delete one or several roles" %}</a>
|
||||||
<br />
|
{% include "machines/aff_role.html" with role_list=role_list %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -30,16 +30,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% block title %}{% trans "Machines" %}{% endblock %}
|
{% block title %}{% trans "Machines" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans "List of services" %}</h2>
|
<h2>{% trans "List of services" %}</h2>
|
||||||
{% can_create machines.Service %}
|
{% can_create machines.Service %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-service' %}"><i class="fa fa-plus"></i>{% trans " Add a service" %}</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-service' %}"><i
|
||||||
{% acl_end %}
|
class="fa fa-plus"></i>{% trans " Add a service" %}</a>
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-service' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several services" %}</a>
|
{% acl_end %}
|
||||||
{% include "machines/aff_service.html" with service_list=service_list %}
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-service' %}"><i
|
||||||
<h2>{% trans "States of servers" %}</h2>
|
class="fa fa-trash"></i>{% trans " Delete one or several services" %}</a>
|
||||||
{% include "machines/aff_servers.html" with servers_list=servers_list %}
|
{% include "machines/aff_service.html" with service_list=service_list %}
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
<h2>{% trans "States of servers" %}</h2>
|
||||||
|
{% include "machines/aff_servers.html" with servers_list=servers_list %}
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -34,6 +34,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
<i class="fa fa-plus"></i>{% trans " Add an SSH fingerprint" %}
|
<i class="fa fa-plus"></i>{% trans " Add an SSH fingerprint" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% include "machines/aff_sshfp.html" with sshfp_list=sshfp_list %}
|
{% include "machines/aff_sshfp.html" with sshfp_list=sshfp_list %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -24,21 +24,18 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% endcomment %}
|
{% endcomment %}
|
||||||
|
|
||||||
{% load bootstrap3 %}
|
{% load bootstrap3 %}
|
||||||
|
|
||||||
{% load acl %}
|
{% load acl %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}{% trans "Machines" %}{% endblock %}
|
{% block title %}{% trans "Machines" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% trans "List of VLANs" %}</h2>
|
<h2>{% trans "List of VLANs" %}</h2>
|
||||||
{% can_create Vlan %}
|
{% can_create Vlan %}
|
||||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-vlan' %}"><i class="fa fa-plus"></i>{% trans " Add a VLAN" %}</a>
|
<a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-vlan' %}"><i
|
||||||
{% acl_end %}
|
class="fa fa-plus"></i>{% trans " Add a VLAN" %}</a>
|
||||||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-vlan' %}"><i class="fa fa-trash"></i>{% trans " Delete one or several VLANs" %}</a>
|
{% acl_end %}
|
||||||
{% include "machines/aff_vlan.html" with vlan_list=vlan_list %}
|
<a class="btn btn-danger btn-sm" role="button" href="{% url 'machines:del-vlan' %}"><i
|
||||||
<br />
|
class="fa fa-trash"></i>{% trans " Delete one or several VLANs" %}</a>
|
||||||
<br />
|
{% include "machines/aff_vlan.html" with vlan_list=vlan_list %}
|
||||||
<br />
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -31,147 +31,143 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% block title %}{% trans "Machines" %}{% endblock %}
|
{% block title %}{% trans "Machines" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if machineform %}
|
|
||||||
{% bootstrap_form_errors machineform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if interfaceform %}
|
|
||||||
{% bootstrap_form_errors interfaceform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if domainform %}
|
|
||||||
{% bootstrap_form_errors domainform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if iptypeform %}
|
|
||||||
{% bootstrap_form_errors iptypeform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if machinetypeform %}
|
|
||||||
{% bootstrap_form_errors machinetypeform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if extensionform %}
|
|
||||||
{% bootstrap_form_errors extensionform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if mxform %}
|
|
||||||
{% bootstrap_form_errors mxform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if nsform %}
|
|
||||||
{% bootstrap_form_errors nsform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if txtform %}
|
|
||||||
{% bootstrap_form_errors txtform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if dnameform %}
|
|
||||||
{% bootstrap_form_errors dnameform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if srvform %}
|
|
||||||
{% bootstrap_form_errors srvform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if aliasform %}
|
|
||||||
{% bootstrap_form_errors aliasform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if serviceform %}
|
|
||||||
{% bootstrap_form_errors serviceform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if sshfpform %}
|
|
||||||
{% bootstrap_form_errors sshfpform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if roleform %}
|
|
||||||
{% bootstrap_form_errors roleform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if vlanform %}
|
|
||||||
{% bootstrap_form_errors vlanform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if nasform %}
|
|
||||||
{% bootstrap_form_errors nasform %}
|
|
||||||
{% endif %}
|
|
||||||
{% if ipv6form %}
|
|
||||||
{% bootstrap_form_errors ipv6form %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<form class="form" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
{% if machineform %}
|
{% if machineform %}
|
||||||
<h3>{% trans "Machine" %}</h3>
|
{% bootstrap_form_errors machineform %}
|
||||||
{% massive_bootstrap_form machineform 'user' %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if interfaceform %}
|
{% if interfaceform %}
|
||||||
<h3>{% trans "Interface" %}</h3>
|
{% bootstrap_form_errors interfaceform %}
|
||||||
{% if i_mbf_param %}
|
|
||||||
{% massive_bootstrap_form interfaceform 'ipv4,machine' mbf_param=i_mbf_param %}
|
|
||||||
{% else %}
|
|
||||||
{% massive_bootstrap_form interfaceform 'ipv4,machine' %}
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if domainform %}
|
{% if domainform %}
|
||||||
<h3>{% trans "Domain" %}</h3>
|
{% bootstrap_form_errors domainform %}
|
||||||
{% bootstrap_form domainform %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if iptypeform %}
|
{% if iptypeform %}
|
||||||
<h3>{% trans "IP type" %}</h3>
|
{% bootstrap_form_errors iptypeform %}
|
||||||
{% bootstrap_form iptypeform %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if machinetypeform %}
|
{% if machinetypeform %}
|
||||||
<h3>{% trans "Machine type" %}</h3>
|
{% bootstrap_form_errors machinetypeform %}
|
||||||
{% bootstrap_form machinetypeform %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if extensionform %}
|
{% if extensionform %}
|
||||||
<h3>{% trans "Extension" %}</h3>
|
{% bootstrap_form_errors extensionform %}
|
||||||
{% massive_bootstrap_form extensionform 'origin' %}
|
|
||||||
{% endif %}
|
|
||||||
{% if soaform %}
|
|
||||||
<h3>{% trans "SOA record" %}</h3>
|
|
||||||
{% bootstrap_form soaform %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if mxform %}
|
{% if mxform %}
|
||||||
<h3>{% trans "MX record" %}</h3>
|
{% bootstrap_form_errors mxform %}
|
||||||
{% massive_bootstrap_form mxform 'name' %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if nsform %}
|
{% if nsform %}
|
||||||
<h3>{% trans "NS record" %}</h3>
|
{% bootstrap_form_errors nsform %}
|
||||||
{% massive_bootstrap_form nsform 'ns' %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if txtform %}
|
{% if txtform %}
|
||||||
<h3>{% trans "TXT record" %}</h3>
|
{% bootstrap_form_errors txtform %}
|
||||||
{% bootstrap_form txtform %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if dnameform %}
|
{% if dnameform %}
|
||||||
<h3>{% trans "DNAME record" %}</h3>
|
{% bootstrap_form_errors dnameform %}
|
||||||
{% bootstrap_form dnameform %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if srvform %}
|
{% if srvform %}
|
||||||
<h3>{% trans "SRV record" %}</h3>
|
{% bootstrap_form_errors srvform %}
|
||||||
{% massive_bootstrap_form srvform 'target' %}
|
|
||||||
{% endif %}
|
|
||||||
{% if sshfpform %}
|
|
||||||
<h3>{% trans "SSHFP record" %}</h3>
|
|
||||||
{% bootstrap_form sshfpform %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if aliasform %}
|
{% if aliasform %}
|
||||||
<h3>{% trans "Alias" %}</h3>
|
{% bootstrap_form_errors aliasform %}
|
||||||
{% bootstrap_form aliasform %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if serviceform %}
|
{% if serviceform %}
|
||||||
<h3>{% trans "Service" %}</h3>
|
{% bootstrap_form_errors serviceform %}
|
||||||
{% massive_bootstrap_form serviceform 'servers' %}
|
{% endif %}
|
||||||
|
{% if sshfpform %}
|
||||||
|
{% bootstrap_form_errors sshfpform %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if roleform %}
|
{% if roleform %}
|
||||||
<h3>Role</h3>
|
{% bootstrap_form_errors roleform %}
|
||||||
{% massive_bootstrap_form roleform 'servers' %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if vlanform %}
|
{% if vlanform %}
|
||||||
<h3>{% trans "VLAN" %}</h3>
|
{% bootstrap_form_errors vlanform %}
|
||||||
{% bootstrap_form vlanform %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if nasform %}
|
{% if nasform %}
|
||||||
<h3>{% trans "NAS device" %}</h3>
|
{% bootstrap_form_errors nasform %}
|
||||||
{% bootstrap_form nasform %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ipv6form %}
|
{% if ipv6form %}
|
||||||
<h3>{% trans "IPv6 address" %}</h3>
|
{% bootstrap_form_errors ipv6form %}
|
||||||
{% bootstrap_form ipv6form %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% bootstrap_button action_name button_type="submit" icon='ok' button_class='btn-success' %}
|
|
||||||
</form>
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
<form class="form" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{% if machineform %}
|
||||||
|
<h3>{% trans "Machine" %}</h3>
|
||||||
|
{% massive_bootstrap_form machineform 'user' %}
|
||||||
|
{% endif %}
|
||||||
|
{% if interfaceform %}
|
||||||
|
<h3>{% trans "Interface" %}</h3>
|
||||||
|
{% if i_mbf_param %}
|
||||||
|
{% massive_bootstrap_form interfaceform 'ipv4,machine' mbf_param=i_mbf_param %}
|
||||||
|
{% else %}
|
||||||
|
{% massive_bootstrap_form interfaceform 'ipv4,machine' %}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if domainform %}
|
||||||
|
<h3>{% trans "Domain" %}</h3>
|
||||||
|
{% bootstrap_form domainform %}
|
||||||
|
{% endif %}
|
||||||
|
{% if iptypeform %}
|
||||||
|
<h3>{% trans "IP type" %}</h3>
|
||||||
|
{% bootstrap_form iptypeform %}
|
||||||
|
{% endif %}
|
||||||
|
{% if machinetypeform %}
|
||||||
|
<h3>{% trans "Machine type" %}</h3>
|
||||||
|
{% bootstrap_form machinetypeform %}
|
||||||
|
{% endif %}
|
||||||
|
{% if extensionform %}
|
||||||
|
<h3>{% trans "Extension" %}</h3>
|
||||||
|
{% massive_bootstrap_form extensionform 'origin' %}
|
||||||
|
{% endif %}
|
||||||
|
{% if soaform %}
|
||||||
|
<h3>{% trans "SOA record" %}</h3>
|
||||||
|
{% bootstrap_form soaform %}
|
||||||
|
{% endif %}
|
||||||
|
{% if mxform %}
|
||||||
|
<h3>{% trans "MX record" %}</h3>
|
||||||
|
{% massive_bootstrap_form mxform 'name' %}
|
||||||
|
{% endif %}
|
||||||
|
{% if nsform %}
|
||||||
|
<h3>{% trans "NS record" %}</h3>
|
||||||
|
{% massive_bootstrap_form nsform 'ns' %}
|
||||||
|
{% endif %}
|
||||||
|
{% if txtform %}
|
||||||
|
<h3>{% trans "TXT record" %}</h3>
|
||||||
|
{% bootstrap_form txtform %}
|
||||||
|
{% endif %}
|
||||||
|
{% if dnameform %}
|
||||||
|
<h3>{% trans "DNAME record" %}</h3>
|
||||||
|
{% bootstrap_form dnameform %}
|
||||||
|
{% endif %}
|
||||||
|
{% if srvform %}
|
||||||
|
<h3>{% trans "SRV record" %}</h3>
|
||||||
|
{% massive_bootstrap_form srvform 'target' %}
|
||||||
|
{% endif %}
|
||||||
|
{% if sshfpform %}
|
||||||
|
<h3>{% trans "SSHFP record" %}</h3>
|
||||||
|
{% bootstrap_form sshfpform %}
|
||||||
|
{% endif %}
|
||||||
|
{% if aliasform %}
|
||||||
|
<h3>{% trans "Alias" %}</h3>
|
||||||
|
{% bootstrap_form aliasform %}
|
||||||
|
{% endif %}
|
||||||
|
{% if serviceform %}
|
||||||
|
<h3>{% trans "Service" %}</h3>
|
||||||
|
{% massive_bootstrap_form serviceform 'servers' %}
|
||||||
|
{% endif %}
|
||||||
|
{% if roleform %}
|
||||||
|
<h3>Role</h3>
|
||||||
|
{% massive_bootstrap_form roleform 'servers' %}
|
||||||
|
{% endif %}
|
||||||
|
{% if vlanform %}
|
||||||
|
<h3>{% trans "VLAN" %}</h3>
|
||||||
|
{% bootstrap_form vlanform %}
|
||||||
|
{% endif %}
|
||||||
|
{% if nasform %}
|
||||||
|
<h3>{% trans "NAS device" %}</h3>
|
||||||
|
{% bootstrap_form nasform %}
|
||||||
|
{% endif %}
|
||||||
|
{% if ipv6form %}
|
||||||
|
<h3>{% trans "IPv6 address" %}</h3>
|
||||||
|
{% bootstrap_form ipv6form %}
|
||||||
|
{% endif %}
|
||||||
|
{% bootstrap_button action_name button_type="submit" icon='ok' button_class='btn-success' %}
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% can_view_all Machine %}
|
{% can_view_all Machine %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "machines:index" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "machines:index" %}">
|
||||||
<i class="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
{% trans "Machines" %}
|
{% trans "Machines" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_view_all MachineType %}
|
{% can_view_all MachineType %}
|
||||||
|
@ -42,31 +42,31 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% can_view_all Extension %}
|
{% can_view_all Extension %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "machines:index-extension" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "machines:index-extension" %}">
|
||||||
<i class="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
{% trans "Extensions and zones" %}
|
{% trans "Extensions and zones" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_view_all IpType %}
|
{% can_view_all IpType %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "machines:index-iptype" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "machines:index-iptype" %}">
|
||||||
<i class="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
{% trans "IP ranges" %}
|
{% trans "IP ranges" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_view_all Vlan %}
|
{% can_view_all Vlan %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "machines:index-vlan" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "machines:index-vlan" %}">
|
||||||
<i class="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
{% trans "VLANs" %}
|
{% trans "VLANs" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_view_all Nas %}
|
{% can_view_all Nas %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "machines:index-nas" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "machines:index-nas" %}">
|
||||||
<i class="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
{% trans "NAS devices" %}
|
{% trans "NAS devices" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_view_all machines.Service %}
|
{% can_view_all machines.Service %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "machines:index-service" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "machines:index-service" %}">
|
||||||
<i class="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
{% trans "Services (DHCP, DNS, ...)" %}
|
{% trans "Services (DHCP, DNS, ...)" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% can_view_all Role %}
|
{% can_view_all Role %}
|
||||||
|
@ -78,8 +78,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% can_view_all OuverturePortList %}
|
{% can_view_all OuverturePortList %}
|
||||||
<a class="list-group-item list-group-item-info" href="{% url "machines:index-portlist" %}">
|
<a class="list-group-item list-group-item-info" href="{% url "machines:index-portlist" %}">
|
||||||
<i class="fa fa-list-ul"></i>
|
<i class="fa fa-list-ul"></i>
|
||||||
{% trans "Ports openings" %}
|
{% trans "Ports openings" %}
|
||||||
</a>
|
</a>
|
||||||
{% acl_end %}
|
{% acl_end %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ The defined URLs for the Machines app
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
|
||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|
|
@ -32,26 +32,18 @@ The views for the Machines app
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.urls import reverse
|
|
||||||
from django.http import HttpResponse, HttpResponseRedirect
|
|
||||||
from django.shortcuts import render, redirect
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.auth.decorators import login_required, permission_required
|
from django.contrib.auth.decorators import login_required, permission_required
|
||||||
from django.db.models import ProtectedError, F
|
from django.db.models import ProtectedError, F
|
||||||
from django.forms import modelformset_factory
|
from django.forms import modelformset_factory
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.http import HttpResponse
|
||||||
|
from django.shortcuts import render, redirect
|
||||||
|
from django.urls import reverse
|
||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from rest_framework.renderers import JSONRenderer
|
from rest_framework.renderers import JSONRenderer
|
||||||
|
|
||||||
from users.models import User
|
|
||||||
from preferences.models import GeneralOption
|
from preferences.models import GeneralOption
|
||||||
from re2o.utils import (
|
|
||||||
all_active_assigned_interfaces,
|
|
||||||
filter_active_interfaces,
|
|
||||||
SortTable,
|
|
||||||
re2o_paginator,
|
|
||||||
)
|
|
||||||
from re2o.acl import (
|
from re2o.acl import (
|
||||||
can_create,
|
can_create,
|
||||||
can_edit,
|
can_edit,
|
||||||
|
@ -60,21 +52,14 @@ from re2o.acl import (
|
||||||
can_view_all,
|
can_view_all,
|
||||||
can_delete_set,
|
can_delete_set,
|
||||||
)
|
)
|
||||||
from re2o.views import form
|
from re2o.utils import (
|
||||||
|
all_active_assigned_interfaces,
|
||||||
from .serializers import (
|
filter_active_interfaces,
|
||||||
FullInterfaceSerializer,
|
SortTable,
|
||||||
InterfaceSerializer,
|
re2o_paginator,
|
||||||
TypeSerializer,
|
|
||||||
DomainSerializer,
|
|
||||||
TxtSerializer,
|
|
||||||
SrvSerializer,
|
|
||||||
MxSerializer,
|
|
||||||
ExtensionSerializer,
|
|
||||||
ServiceServersSerializer,
|
|
||||||
NsSerializer,
|
|
||||||
)
|
)
|
||||||
|
from re2o.views import form
|
||||||
|
from users.models import User
|
||||||
from .forms import (
|
from .forms import (
|
||||||
NewMachineForm,
|
NewMachineForm,
|
||||||
EditMachineForm,
|
EditMachineForm,
|
||||||
|
@ -139,6 +124,18 @@ from .models import (
|
||||||
OuverturePort,
|
OuverturePort,
|
||||||
Ipv6List,
|
Ipv6List,
|
||||||
)
|
)
|
||||||
|
from .serializers import (
|
||||||
|
FullInterfaceSerializer,
|
||||||
|
InterfaceSerializer,
|
||||||
|
TypeSerializer,
|
||||||
|
DomainSerializer,
|
||||||
|
TxtSerializer,
|
||||||
|
SrvSerializer,
|
||||||
|
MxSerializer,
|
||||||
|
ExtensionSerializer,
|
||||||
|
ServiceServersSerializer,
|
||||||
|
NsSerializer,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def f_type_id(is_type_tt):
|
def f_type_id(is_type_tt):
|
||||||
|
@ -153,12 +150,12 @@ def generate_ipv4_choices(form_obj):
|
||||||
"""
|
"""
|
||||||
f_ipv4 = form_obj.fields['ipv4']
|
f_ipv4 = form_obj.fields['ipv4']
|
||||||
used_mtype_id = []
|
used_mtype_id = []
|
||||||
choices = '{"":[{key:"",value:"'+_("Select a machine type first.") + '"}'
|
choices = '{"":[{key:"",value:"' + _("Select a machine type first.") + '"}'
|
||||||
mtype_id = -1
|
mtype_id = -1
|
||||||
|
|
||||||
for ip in (f_ipv4.queryset
|
for ip in (f_ipv4.queryset
|
||||||
.annotate(mtype_id=F('ip_type__machinetype__id'))
|
.annotate(mtype_id=F('ip_type__machinetype__id'))
|
||||||
.order_by('mtype_id', 'id')):
|
.order_by('mtype_id', 'id')):
|
||||||
if mtype_id != ip.mtype_id:
|
if mtype_id != ip.mtype_id:
|
||||||
mtype_id = ip.mtype_id
|
mtype_id = ip.mtype_id
|
||||||
used_mtype_id.append(mtype_id)
|
used_mtype_id.append(mtype_id)
|
||||||
|
@ -172,7 +169,7 @@ def generate_ipv4_choices(form_obj):
|
||||||
)
|
)
|
||||||
|
|
||||||
for t in form_obj.fields['type'].queryset.exclude(id__in=used_mtype_id):
|
for t in form_obj.fields['type'].queryset.exclude(id__in=used_mtype_id):
|
||||||
choices += '], "'+str(t.id)+'": ['
|
choices += '], "' + str(t.id) + '": ['
|
||||||
choices += '{key: "", value: "' + str(f_ipv4.empty_label) + '"},'
|
choices += '{key: "", value: "' + str(f_ipv4.empty_label) + '"},'
|
||||||
choices += ']}'
|
choices += ']}'
|
||||||
return choices
|
return choices
|
||||||
|
@ -889,6 +886,7 @@ def del_ns(request, instances):
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@can_create(DName)
|
@can_create(DName)
|
||||||
def add_dname(request):
|
def add_dname(request):
|
||||||
|
@ -935,9 +933,9 @@ def del_dname(request, instances):
|
||||||
messages.success(request, _("The DNAME record was deleted."))
|
messages.success(request, _("The DNAME record was deleted."))
|
||||||
except ProtectedError:
|
except ProtectedError:
|
||||||
messages.error(
|
messages.error(
|
||||||
request,
|
request,
|
||||||
_("Error: the DNAME record %s can't be deleted.")
|
_("Error: the DNAME record %s can't be deleted.")
|
||||||
% dname_del
|
% dname_del
|
||||||
)
|
)
|
||||||
return redirect(reverse('machines:index-extension'))
|
return redirect(reverse('machines:index-extension'))
|
||||||
return form(
|
return form(
|
||||||
|
@ -1252,16 +1250,16 @@ def del_service(request, instances):
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@can_edit(Service)
|
@can_edit(Service)
|
||||||
def regen_service(request,service, **_kwargs):
|
def regen_service(request, service, **_kwargs):
|
||||||
"""Ask for a regen of the service"""
|
"""Ask for a regen of the service"""
|
||||||
|
|
||||||
regen(service)
|
regen(service)
|
||||||
return index_service(request)
|
return index_service(request)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@can_create(Vlan)
|
@can_create(Vlan)
|
||||||
def add_vlan(request):
|
def add_vlan(request):
|
||||||
|
@ -1388,10 +1386,10 @@ def index(request):
|
||||||
.prefetch_related('interface_set__domain__extension')
|
.prefetch_related('interface_set__domain__extension')
|
||||||
.prefetch_related('interface_set__ipv4__ip_type')
|
.prefetch_related('interface_set__ipv4__ip_type')
|
||||||
.prefetch_related(
|
.prefetch_related(
|
||||||
'interface_set__type__ip_type__extension'
|
'interface_set__type__ip_type__extension'
|
||||||
).prefetch_related(
|
).prefetch_related(
|
||||||
'interface_set__domain__related_domain__extension'
|
'interface_set__domain__related_domain__extension'
|
||||||
).prefetch_related('interface_set__ipv6list'))
|
).prefetch_related('interface_set__ipv6list'))
|
||||||
machines_list = SortTable.sort(
|
machines_list = SortTable.sort(
|
||||||
machines_list,
|
machines_list,
|
||||||
request.GET.get('col'),
|
request.GET.get('col'),
|
||||||
|
@ -1548,8 +1546,8 @@ def index_role(request):
|
||||||
""" View used to display the list of existing roles """
|
""" View used to display the list of existing roles """
|
||||||
role_list = (Role.objects
|
role_list = (Role.objects
|
||||||
.prefetch_related(
|
.prefetch_related(
|
||||||
'servers__domain__extension'
|
'servers__domain__extension'
|
||||||
).all())
|
).all())
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
'machines/index_role.html',
|
'machines/index_role.html',
|
||||||
|
@ -1563,8 +1561,8 @@ def index_service(request):
|
||||||
""" View used to display the list of existing services """
|
""" View used to display the list of existing services """
|
||||||
service_list = (Service.objects
|
service_list = (Service.objects
|
||||||
.prefetch_related(
|
.prefetch_related(
|
||||||
'service_link_set__server__domain__extension'
|
'service_link_set__server__domain__extension'
|
||||||
).all())
|
).all())
|
||||||
servers_list = (Service_link.objects
|
servers_list = (Service_link.objects
|
||||||
.select_related('server__domain__extension')
|
.select_related('server__domain__extension')
|
||||||
.select_related('service')
|
.select_related('service')
|
||||||
|
@ -1740,10 +1738,10 @@ def alias(_request):
|
||||||
alias = (Domain.objects
|
alias = (Domain.objects
|
||||||
.filter(interface_parent=None)
|
.filter(interface_parent=None)
|
||||||
.filter(
|
.filter(
|
||||||
cname__in=Domain.objects.filter(
|
cname__in=Domain.objects.filter(
|
||||||
interface_parent__in=Interface.objects.exclude(ipv4=None)
|
interface_parent__in=Interface.objects.exclude(ipv4=None)
|
||||||
)
|
)
|
||||||
).select_related('extension')
|
).select_related('extension')
|
||||||
.select_related('cname__extension'))
|
.select_related('cname__extension'))
|
||||||
seria = DomainSerializer(alias, many=True)
|
seria = DomainSerializer(alias, many=True)
|
||||||
return JSONResponse(seria.data)
|
return JSONResponse(seria.data)
|
||||||
|
@ -1801,10 +1799,10 @@ def ns(_request):
|
||||||
""" API view to list the NS records """
|
""" API view to list the NS records """
|
||||||
ns = (Ns.objects
|
ns = (Ns.objects
|
||||||
.exclude(
|
.exclude(
|
||||||
ns__in=Domain.objects.filter(
|
ns__in=Domain.objects.filter(
|
||||||
interface_parent__in=Interface.objects.filter(ipv4=None)
|
interface_parent__in=Interface.objects.filter(ipv4=None)
|
||||||
)
|
)
|
||||||
).select_related('zone')
|
).select_related('zone')
|
||||||
.select_related('ns__extension'))
|
.select_related('ns__extension'))
|
||||||
seria = NsSerializer(ns, many=True)
|
seria = NsSerializer(ns, many=True)
|
||||||
return JSONResponse(seria.data)
|
return JSONResponse(seria.data)
|
||||||
|
@ -1859,9 +1857,9 @@ def ouverture_ports(_request):
|
||||||
""" API view to list the port policies for each IP """
|
""" API view to list the port policies for each IP """
|
||||||
r = {'ipv4': {}, 'ipv6': {}}
|
r = {'ipv4': {}, 'ipv6': {}}
|
||||||
for o in (OuverturePortList.objects
|
for o in (OuverturePortList.objects
|
||||||
.all()
|
.all()
|
||||||
.prefetch_related('ouvertureport_set')
|
.prefetch_related('ouvertureport_set')
|
||||||
.prefetch_related('interface_set', 'interface_set__ipv4')):
|
.prefetch_related('interface_set', 'interface_set__ipv4')):
|
||||||
pl = {
|
pl = {
|
||||||
"tcp_in": set(map(
|
"tcp_in": set(map(
|
||||||
str,
|
str,
|
||||||
|
@ -1926,17 +1924,16 @@ def regen_achieved(request):
|
||||||
""" API view to list the regen status for each (Service link, Server)
|
""" API view to list the regen status for each (Service link, Server)
|
||||||
couple """
|
couple """
|
||||||
obj = (Service_link.objects
|
obj = (Service_link.objects
|
||||||
.filter(
|
.filter(
|
||||||
service__in=Service.objects.filter(
|
service__in=Service.objects.filter(
|
||||||
service_type=request.POST['service']
|
service_type=request.POST['service']
|
||||||
),
|
),
|
||||||
server__in=Interface.objects.filter(
|
server__in=Interface.objects.filter(
|
||||||
domain__in=Domain.objects.filter(
|
domain__in=Domain.objects.filter(
|
||||||
name=request.POST['server']
|
name=request.POST['server']
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
if obj:
|
if obj:
|
||||||
obj.first().done_regen()
|
obj.first().done_regen()
|
||||||
return HttpResponse("Ok")
|
return HttpResponse("Ok")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue