mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-26 22:52:26 +00:00
Pylint compliance on api
This commit is contained in:
parent
955bf42b02
commit
cc4401ff20
4 changed files with 181 additions and 64 deletions
|
@ -29,20 +29,20 @@ from machines.models import (
|
||||||
IpType,
|
IpType,
|
||||||
Extension,
|
Extension,
|
||||||
IpList,
|
IpList,
|
||||||
MachineType,
|
|
||||||
Domain,
|
Domain,
|
||||||
Txt,
|
Txt,
|
||||||
Mx,
|
Mx,
|
||||||
Srv,
|
Srv,
|
||||||
Service_link,
|
Service_link,
|
||||||
Ns,
|
Ns,
|
||||||
OuverturePortList,
|
|
||||||
OuverturePort,
|
OuverturePort,
|
||||||
Ipv6List
|
Ipv6List
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ServiceLinkSerializer(serializers.ModelSerializer):
|
class ServiceLinkSerializer(serializers.ModelSerializer):
|
||||||
|
""" Serializer for the ServiceLink objects """
|
||||||
|
|
||||||
name = serializers.CharField(source='service.service_type')
|
name = serializers.CharField(source='service.service_type')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -51,6 +51,8 @@ class ServiceLinkSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
|
|
||||||
class MailingSerializer(serializers.ModelSerializer):
|
class MailingSerializer(serializers.ModelSerializer):
|
||||||
|
""" Serializer to build Mailing objects """
|
||||||
|
|
||||||
name = serializers.CharField(source='pseudo')
|
name = serializers.CharField(source='pseudo')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -59,20 +61,27 @@ class MailingSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
|
|
||||||
class MailingMemberSerializer(serializers.ModelSerializer):
|
class MailingMemberSerializer(serializers.ModelSerializer):
|
||||||
|
""" Serializer fot the Adherent objects (who belong to a
|
||||||
|
Mailing) """
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Adherent
|
model = Adherent
|
||||||
fields = ('email', 'name', 'surname', 'pseudo',)
|
fields = ('email',)
|
||||||
|
|
||||||
|
|
||||||
class IpTypeField(serializers.RelatedField):
|
class IpTypeField(serializers.RelatedField):
|
||||||
"""Serialisation d'une iptype, renvoie son evaluation str"""
|
""" Serializer for an IpType object field """
|
||||||
|
|
||||||
def to_representation(self, value):
|
def to_representation(self, value):
|
||||||
return value.type
|
return value.type
|
||||||
|
|
||||||
|
def to_internal_value(self, data):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class IpListSerializer(serializers.ModelSerializer):
|
class IpListSerializer(serializers.ModelSerializer):
|
||||||
"""Serialisation d'une iplist, ip_type etant une foreign_key,
|
""" Serializer for an Ipv4List obejct using the IpType serialization """
|
||||||
on evalue sa methode str"""
|
|
||||||
ip_type = IpTypeField(read_only=True)
|
ip_type = IpTypeField(read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -81,16 +90,19 @@ class IpListSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
|
|
||||||
class Ipv6ListSerializer(serializers.ModelSerializer):
|
class Ipv6ListSerializer(serializers.ModelSerializer):
|
||||||
|
""" Serializer for an Ipv6List object """
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Ipv6List
|
model = Ipv6List
|
||||||
fields = ('ipv6', 'slaac_ip')
|
fields = ('ipv6', 'slaac_ip')
|
||||||
|
|
||||||
|
|
||||||
class InterfaceSerializer(serializers.ModelSerializer):
|
class InterfaceSerializer(serializers.ModelSerializer):
|
||||||
"""Serialisation d'une interface, ipv4, domain et extension sont
|
""" Serializer for an Interface object. Use SerializerMethodField
|
||||||
des foreign_key, on les override et on les evalue avec des fonctions
|
to get ForeignKey values """
|
||||||
get_..."""
|
|
||||||
ipv4 = IpListSerializer(read_only=True)
|
ipv4 = IpListSerializer(read_only=True)
|
||||||
|
# TODO : use serializer.RelatedField to avoid duplicate code
|
||||||
mac_address = serializers.SerializerMethodField('get_macaddress')
|
mac_address = serializers.SerializerMethodField('get_macaddress')
|
||||||
domain = serializers.SerializerMethodField('get_dns')
|
domain = serializers.SerializerMethodField('get_dns')
|
||||||
extension = serializers.SerializerMethodField('get_interface_extension')
|
extension = serializers.SerializerMethodField('get_interface_extension')
|
||||||
|
@ -99,20 +111,29 @@ class InterfaceSerializer(serializers.ModelSerializer):
|
||||||
model = Interface
|
model = Interface
|
||||||
fields = ('ipv4', 'mac_address', 'domain', 'extension')
|
fields = ('ipv4', 'mac_address', 'domain', 'extension')
|
||||||
|
|
||||||
def get_dns(self, obj):
|
@staticmethod
|
||||||
|
def get_dns(obj):
|
||||||
|
""" The name of the associated DNS object """
|
||||||
return obj.domain.name
|
return obj.domain.name
|
||||||
|
|
||||||
def get_interface_extension(self, obj):
|
@staticmethod
|
||||||
|
def get_interface_extension(obj):
|
||||||
|
""" The name of the associated Interface object """
|
||||||
return obj.domain.extension.name
|
return obj.domain.extension.name
|
||||||
|
|
||||||
def get_macaddress(self, obj):
|
@staticmethod
|
||||||
|
def get_macaddress(obj):
|
||||||
|
""" The string representation of the associated MAC address """
|
||||||
return str(obj.mac_address)
|
return str(obj.mac_address)
|
||||||
|
|
||||||
|
|
||||||
class FullInterfaceSerializer(serializers.ModelSerializer):
|
class FullInterfaceSerializer(serializers.ModelSerializer):
|
||||||
"""Serialisation complete d'une interface avec les ipv6 en plus"""
|
""" Serializer for an Interface obejct. Use SerializerMethodField
|
||||||
|
to get ForeignKey values """
|
||||||
|
|
||||||
ipv4 = IpListSerializer(read_only=True)
|
ipv4 = IpListSerializer(read_only=True)
|
||||||
ipv6 = Ipv6ListSerializer(read_only=True, many=True)
|
ipv6 = Ipv6ListSerializer(read_only=True, many=True)
|
||||||
|
# TODO : use serializer.RelatedField to avoid duplicate code
|
||||||
mac_address = serializers.SerializerMethodField('get_macaddress')
|
mac_address = serializers.SerializerMethodField('get_macaddress')
|
||||||
domain = serializers.SerializerMethodField('get_dns')
|
domain = serializers.SerializerMethodField('get_dns')
|
||||||
extension = serializers.SerializerMethodField('get_interface_extension')
|
extension = serializers.SerializerMethodField('get_interface_extension')
|
||||||
|
@ -121,26 +142,36 @@ class FullInterfaceSerializer(serializers.ModelSerializer):
|
||||||
model = Interface
|
model = Interface
|
||||||
fields = ('ipv4', 'ipv6', 'mac_address', 'domain', 'extension')
|
fields = ('ipv4', 'ipv6', 'mac_address', 'domain', 'extension')
|
||||||
|
|
||||||
def get_dns(self, obj):
|
@staticmethod
|
||||||
|
def get_dns(obj):
|
||||||
|
""" The name of the associated DNS object """
|
||||||
return obj.domain.name
|
return obj.domain.name
|
||||||
|
|
||||||
def get_interface_extension(self, obj):
|
@staticmethod
|
||||||
|
def get_interface_extension(obj):
|
||||||
|
""" The name of the associated Extension object """
|
||||||
return obj.domain.extension.name
|
return obj.domain.extension.name
|
||||||
|
|
||||||
def get_macaddress(self, obj):
|
@staticmethod
|
||||||
|
def get_macaddress(obj):
|
||||||
|
""" The string representation of the associated MAC address """
|
||||||
return str(obj.mac_address)
|
return str(obj.mac_address)
|
||||||
|
|
||||||
|
|
||||||
class ExtensionNameField(serializers.RelatedField):
|
class ExtensionNameField(serializers.RelatedField):
|
||||||
"""Evaluation str d'un objet extension (.example.org)"""
|
""" Serializer for Extension object field """
|
||||||
|
|
||||||
def to_representation(self, value):
|
def to_representation(self, value):
|
||||||
return value.name
|
return value.name
|
||||||
|
|
||||||
|
def to_internal_value(self, data):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TypeSerializer(serializers.ModelSerializer):
|
class TypeSerializer(serializers.ModelSerializer):
|
||||||
"""Serialisation d'un iptype : extension et la liste des
|
""" Serializer for an IpType object. Use SerializerMethodField to
|
||||||
ouvertures de port son evalués en get_... etant des
|
get ForeignKey values """
|
||||||
foreign_key ou des relations manytomany"""
|
|
||||||
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')
|
||||||
|
@ -158,7 +189,10 @@ class TypeSerializer(serializers.ModelSerializer):
|
||||||
'ouverture_ports_tcp_in', 'ouverture_ports_tcp_out',
|
'ouverture_ports_tcp_in', 'ouverture_ports_tcp_out',
|
||||||
'ouverture_ports_udp_in', 'ouverture_ports_udp_out',)
|
'ouverture_ports_udp_in', 'ouverture_ports_udp_out',)
|
||||||
|
|
||||||
def get_port_policy(self, obj, protocole, io):
|
@staticmethod
|
||||||
|
def get_port_policy(obj, protocole, io):
|
||||||
|
""" Generic utility function to get the policy for a given
|
||||||
|
port, protocole and IN or OUT """
|
||||||
if obj.ouverture_ports is None:
|
if obj.ouverture_ports is None:
|
||||||
return []
|
return []
|
||||||
return map(
|
return map(
|
||||||
|
@ -196,13 +230,19 @@ class ExtensionSerializer(serializers.ModelSerializer):
|
||||||
model = Extension
|
model = Extension
|
||||||
fields = ('name', 'origin', 'origin_v6', 'zone_entry', 'soa')
|
fields = ('name', 'origin', 'origin_v6', 'zone_entry', 'soa')
|
||||||
|
|
||||||
def get_origin_ip(self, obj):
|
@staticmethod
|
||||||
|
def get_origin_ip(obj):
|
||||||
|
""" The IP of the associated origin for the zone """
|
||||||
return obj.origin.ipv4
|
return obj.origin.ipv4
|
||||||
|
|
||||||
def get_zone_name(self, obj):
|
@staticmethod
|
||||||
|
def get_zone_name(obj):
|
||||||
|
""" The name of the associated zone """
|
||||||
return str(obj.dns_entry)
|
return str(obj.dns_entry)
|
||||||
|
|
||||||
def get_soa_data(self, obj):
|
@staticmethod
|
||||||
|
def get_soa_data(obj):
|
||||||
|
""" The representation of the associated SOA """
|
||||||
return {'mail': obj.soa.dns_soa_mail, 'param': obj.soa.dns_soa_param}
|
return {'mail': obj.soa.dns_soa_mail, 'param': obj.soa.dns_soa_param}
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,13 +257,19 @@ class MxSerializer(serializers.ModelSerializer):
|
||||||
model = Mx
|
model = Mx
|
||||||
fields = ('zone', 'priority', 'name', 'mx_entry')
|
fields = ('zone', 'priority', 'name', 'mx_entry')
|
||||||
|
|
||||||
def get_entry_name(self, obj):
|
@staticmethod
|
||||||
|
def get_entry_name(obj):
|
||||||
|
""" The name of the DNS MX entry """
|
||||||
return str(obj.name)
|
return str(obj.name)
|
||||||
|
|
||||||
def get_zone_name(self, obj):
|
@staticmethod
|
||||||
|
def get_zone_name(obj):
|
||||||
|
""" The name of the associated zone of the MX record """
|
||||||
return obj.zone.name
|
return obj.zone.name
|
||||||
|
|
||||||
def get_mx_name(self, obj):
|
@staticmethod
|
||||||
|
def get_mx_name(obj):
|
||||||
|
""" The string representation of the entry to add to the DNS """
|
||||||
return str(obj.dns_entry)
|
return str(obj.dns_entry)
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,10 +283,14 @@ class TxtSerializer(serializers.ModelSerializer):
|
||||||
model = Txt
|
model = Txt
|
||||||
fields = ('zone', 'txt_entry', 'field1', 'field2')
|
fields = ('zone', 'txt_entry', 'field1', 'field2')
|
||||||
|
|
||||||
def get_zone_name(self, obj):
|
@staticmethod
|
||||||
|
def get_zone_name(obj):
|
||||||
|
""" The name of the associated zone """
|
||||||
return str(obj.zone.name)
|
return str(obj.zone.name)
|
||||||
|
|
||||||
def get_txt_name(self, obj):
|
@staticmethod
|
||||||
|
def get_txt_name(obj):
|
||||||
|
""" The string representation of the entry to add to the DNS """
|
||||||
return str(obj.dns_entry)
|
return str(obj.dns_entry)
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,10 +313,14 @@ class SrvSerializer(serializers.ModelSerializer):
|
||||||
'srv_entry'
|
'srv_entry'
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_extension_name(self, obj):
|
@staticmethod
|
||||||
|
def get_extension_name(obj):
|
||||||
|
""" The name of the associated extension """
|
||||||
return str(obj.extension.name)
|
return str(obj.extension.name)
|
||||||
|
|
||||||
def get_srv_name(self, obj):
|
@staticmethod
|
||||||
|
def get_srv_name(obj):
|
||||||
|
""" The string representation of the entry to add to the DNS """
|
||||||
return str(obj.dns_entry)
|
return str(obj.dns_entry)
|
||||||
|
|
||||||
|
|
||||||
|
@ -281,13 +335,19 @@ class NsSerializer(serializers.ModelSerializer):
|
||||||
model = Ns
|
model = Ns
|
||||||
fields = ('zone', 'ns', 'ns_entry')
|
fields = ('zone', 'ns', 'ns_entry')
|
||||||
|
|
||||||
def get_zone_name(self, obj):
|
@staticmethod
|
||||||
|
def get_zone_name(obj):
|
||||||
|
""" The name of the associated zone """
|
||||||
return obj.zone.name
|
return obj.zone.name
|
||||||
|
|
||||||
def get_domain_name(self, obj):
|
@staticmethod
|
||||||
|
def get_domain_name(obj):
|
||||||
|
""" The name of the associated NS target """
|
||||||
return str(obj.ns)
|
return str(obj.ns)
|
||||||
|
|
||||||
def get_text_name(self, obj):
|
@staticmethod
|
||||||
|
def get_text_name(obj):
|
||||||
|
""" The string representation of the entry to add to the DNS """
|
||||||
return str(obj.dns_entry)
|
return str(obj.dns_entry)
|
||||||
|
|
||||||
|
|
||||||
|
@ -302,13 +362,19 @@ class DomainSerializer(serializers.ModelSerializer):
|
||||||
model = Domain
|
model = Domain
|
||||||
fields = ('name', 'extension', 'cname', 'cname_entry')
|
fields = ('name', 'extension', 'cname', 'cname_entry')
|
||||||
|
|
||||||
def get_zone_name(self, obj):
|
@staticmethod
|
||||||
|
def get_zone_name(obj):
|
||||||
|
""" The name of the associated zone """
|
||||||
return obj.extension.name
|
return obj.extension.name
|
||||||
|
|
||||||
def get_alias_name(self, obj):
|
@staticmethod
|
||||||
|
def get_alias_name(obj):
|
||||||
|
""" The name of the associated alias """
|
||||||
return str(obj.cname)
|
return str(obj.cname)
|
||||||
|
|
||||||
def get_cname_name(self, obj):
|
@staticmethod
|
||||||
|
def get_cname_name(obj):
|
||||||
|
""" The name of the associated CNAME target """
|
||||||
return str(obj.dns_entry)
|
return str(obj.dns_entry)
|
||||||
|
|
||||||
|
|
||||||
|
@ -322,13 +388,19 @@ class ServicesSerializer(serializers.ModelSerializer):
|
||||||
model = Service_link
|
model = Service_link
|
||||||
fields = ('server', 'service', 'need_regen')
|
fields = ('server', 'service', 'need_regen')
|
||||||
|
|
||||||
def get_server_name(self, obj):
|
@staticmethod
|
||||||
|
def get_server_name(obj):
|
||||||
|
""" The name of the associated server """
|
||||||
return str(obj.server.domain.name)
|
return str(obj.server.domain.name)
|
||||||
|
|
||||||
def get_service_name(self, obj):
|
@staticmethod
|
||||||
|
def get_service_name(obj):
|
||||||
|
""" The name of the service name """
|
||||||
return str(obj.service)
|
return str(obj.service)
|
||||||
|
|
||||||
def get_regen_status(self, obj):
|
@staticmethod
|
||||||
|
def get_regen_status(obj):
|
||||||
|
""" The string representation of the regen status """
|
||||||
return obj.need_regen()
|
return obj.need_regen()
|
||||||
|
|
||||||
|
|
||||||
|
@ -337,7 +409,19 @@ class OuverturePortsSerializer(serializers.Serializer):
|
||||||
ipv4 = serializers.SerializerMethodField()
|
ipv4 = serializers.SerializerMethodField()
|
||||||
ipv6 = serializers.SerializerMethodField()
|
ipv6 = serializers.SerializerMethodField()
|
||||||
|
|
||||||
|
def create(self, validated_data):
|
||||||
|
""" Creates a new object based on the un-serialized data.
|
||||||
|
Used to implement an abstract inherited method """
|
||||||
|
pass
|
||||||
|
|
||||||
|
def update(self, instance, validated_data):
|
||||||
|
""" Updates an object based on the un-serialized data.
|
||||||
|
Used to implement an abstract inherited method """
|
||||||
|
pass
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def get_ipv4():
|
def get_ipv4():
|
||||||
|
""" The representation of the policy for the IPv4 addresses """
|
||||||
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()],
|
||||||
|
@ -348,7 +432,9 @@ class OuverturePortsSerializer(serializers.Serializer):
|
||||||
for i in Interface.objects.all() if i.ipv4
|
for i in Interface.objects.all() if i.ipv4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
def get_ipv6():
|
def get_ipv6():
|
||||||
|
""" The representation of the policy for the IPv6 addresses """
|
||||||
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()],
|
||||||
|
|
|
@ -19,7 +19,10 @@
|
||||||
# You should have received a copy of the GNU General Public License along
|
# You should have received a copy of the GNU General Public License along
|
||||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
"""api.tests
|
||||||
|
The tests for the API module.
|
||||||
|
"""
|
||||||
|
|
||||||
from django.test import TestCase
|
# from django.test import TestCase
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
|
|
|
@ -106,7 +106,11 @@ def accept_method(methods):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def decorator(view):
|
def decorator(view):
|
||||||
|
"""The decorator to use on a specific view
|
||||||
|
"""
|
||||||
def wrapper(request, *args, **kwargs):
|
def wrapper(request, *args, **kwargs):
|
||||||
|
"""The wrapper used for a specific request
|
||||||
|
"""
|
||||||
if request.method in methods:
|
if request.method in methods:
|
||||||
return view(request, *args, **kwargs)
|
return view(request, *args, **kwargs)
|
||||||
else:
|
else:
|
||||||
|
|
70
api/views.py
70
api/views.py
|
@ -27,18 +27,42 @@ HTML pages such as the login and index pages for a better integration.
|
||||||
from django.contrib.auth.decorators import login_required, permission_required
|
from django.contrib.auth.decorators import login_required, permission_required
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
|
||||||
from re2o.utils import all_has_access, all_active_assigned_interfaces
|
from re2o.utils import (
|
||||||
|
all_has_access,
|
||||||
|
all_active_assigned_interfaces,
|
||||||
|
filter_active_interfaces
|
||||||
|
)
|
||||||
from users.models import Club
|
from users.models import Club
|
||||||
from machines.models import (
|
from machines.models import (
|
||||||
Service_link,
|
Service_link,
|
||||||
Service,
|
Service,
|
||||||
Interface,
|
Interface,
|
||||||
Domain,
|
Domain,
|
||||||
OuverturePortList
|
IpType,
|
||||||
|
Mx,
|
||||||
|
Ns,
|
||||||
|
Txt,
|
||||||
|
Srv,
|
||||||
|
Extension,
|
||||||
|
OuverturePortList,
|
||||||
|
OuverturePort
|
||||||
)
|
)
|
||||||
|
|
||||||
from .serializers import *
|
from .serializers import (
|
||||||
|
ServicesSerializer,
|
||||||
|
ServiceLinkSerializer,
|
||||||
|
FullInterfaceSerializer,
|
||||||
|
DomainSerializer,
|
||||||
|
TypeSerializer,
|
||||||
|
MxSerializer,
|
||||||
|
NsSerializer,
|
||||||
|
TxtSerializer,
|
||||||
|
SrvSerializer,
|
||||||
|
ExtensionSerializer,
|
||||||
|
InterfaceSerializer,
|
||||||
|
MailingMemberSerializer,
|
||||||
|
MailingSerializer
|
||||||
|
)
|
||||||
from .utils import JSONError, JSONSuccess, accept_method
|
from .utils import JSONError, JSONSuccess, accept_method
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,7 +70,7 @@ from .utils import JSONError, JSONSuccess, accept_method
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def services(request):
|
def services(_request):
|
||||||
"""The list of the different services and servers couples
|
"""The list of the different services and servers couples
|
||||||
|
|
||||||
Return:
|
Return:
|
||||||
|
@ -104,7 +128,7 @@ def services_server_service_regen(request, server_name, service_name):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def services_server(request, server_name):
|
def services_server(_request, server_name):
|
||||||
"""The list of services attached to a specific server
|
"""The list of services attached to a specific server
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -122,8 +146,8 @@ def services_server(request, server_name):
|
||||||
if not query:
|
if not query:
|
||||||
return JSONError("This service is not active for this server")
|
return JSONError("This service is not active for this server")
|
||||||
|
|
||||||
services = query.all()
|
services_objects = query.all()
|
||||||
seria = ServiceLinkSerializer(services, many=True)
|
seria = ServiceLinkSerializer(services_objects, many=True)
|
||||||
return JSONSuccess(seria.data)
|
return JSONSuccess(seria.data)
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,7 +155,7 @@ def services_server(request, server_name):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def dns_mac_ip_dns(request):
|
def dns_mac_ip_dns(_request):
|
||||||
"""The list of all active interfaces with all the associated infos
|
"""The list of all active interfaces with all the associated infos
|
||||||
(MAC, IP, IpType, DNS name and associated zone extension)
|
(MAC, IP, IpType, DNS name and associated zone extension)
|
||||||
|
|
||||||
|
@ -160,7 +184,7 @@ def dns_mac_ip_dns(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def dns_alias(request):
|
def dns_alias(_request):
|
||||||
"""The list of all the alias used and the DNS info associated
|
"""The list of all the alias used and the DNS info associated
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -193,7 +217,7 @@ def dns_alias(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def accesspoint_ip_dns(request):
|
def accesspoint_ip_dns(_request):
|
||||||
"""The list of all active interfaces with all the associated infos
|
"""The list of all active interfaces with all the associated infos
|
||||||
(MAC, IP, IpType, DNS name and associated zone extension)
|
(MAC, IP, IpType, DNS name and associated zone extension)
|
||||||
|
|
||||||
|
@ -225,7 +249,7 @@ def accesspoint_ip_dns(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def dns_corresp(request):
|
def dns_corresp(_request):
|
||||||
"""The list of the IpTypes possible with the infos about each
|
"""The list of the IpTypes possible with the infos about each
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -253,7 +277,7 @@ def dns_corresp(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def dns_mx(request):
|
def dns_mx(_request):
|
||||||
"""The list of MX record to add to the DNS
|
"""The list of MX record to add to the DNS
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -278,7 +302,7 @@ def dns_mx(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def dns_ns(request):
|
def dns_ns(_request):
|
||||||
"""The list of NS record to add to the DNS
|
"""The list of NS record to add to the DNS
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -307,7 +331,7 @@ def dns_ns(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def dns_txt(request):
|
def dns_txt(_request):
|
||||||
"""The list of TXT record to add to the DNS
|
"""The list of TXT record to add to the DNS
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -330,7 +354,7 @@ def dns_txt(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def dns_srv(request):
|
def dns_srv(_request):
|
||||||
"""The list of SRV record to add to the DNS
|
"""The list of SRV record to add to the DNS
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -360,7 +384,7 @@ def dns_srv(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def dns_zones(request):
|
def dns_zones(_request):
|
||||||
"""The list of the zones managed
|
"""The list of the zones managed
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -389,7 +413,7 @@ def dns_zones(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def firewall_ouverture_ports(request):
|
def firewall_ouverture_ports(_request):
|
||||||
"""The list of the ports authorized to be openned by the firewall
|
"""The list of the ports authorized to be openned by the firewall
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -480,7 +504,7 @@ def firewall_ouverture_ports(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def dhcp_mac_ip(request):
|
def dhcp_mac_ip(_request):
|
||||||
"""The list of all active interfaces with all the associated infos
|
"""The list of all active interfaces with all the associated infos
|
||||||
(MAC, IP, IpType, DNS name and associated zone extension)
|
(MAC, IP, IpType, DNS name and associated zone extension)
|
||||||
|
|
||||||
|
@ -506,7 +530,7 @@ def dhcp_mac_ip(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def mailing_standard(request):
|
def mailing_standard(_request):
|
||||||
"""All the available standard mailings.
|
"""All the available standard mailings.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -525,7 +549,7 @@ def mailing_standard(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def mailing_standard_ml_members(request):
|
def mailing_standard_ml_members(_request, ml_name):
|
||||||
"""All the members of a specific standard mailing
|
"""All the members of a specific standard mailing
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -552,7 +576,7 @@ def mailing_standard_ml_members(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def mailing_club(request):
|
def mailing_club(_request):
|
||||||
"""All the available club mailings.
|
"""All the available club mailings.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -571,7 +595,7 @@ def mailing_club(request):
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('machines.serveur')
|
@permission_required('machines.serveur')
|
||||||
@accept_method(['GET'])
|
@accept_method(['GET'])
|
||||||
def mailing_club_ml_members(request):
|
def mailing_club_ml_members(_request, ml_name):
|
||||||
"""All the members of a specific club mailing
|
"""All the members of a specific club mailing
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
|
Loading…
Reference in a new issue