8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 07:23:46 +00:00

Handles DNAME records

This commit is contained in:
Maxime Bombar 2018-11-02 15:04:37 +01:00
parent b710e2a56a
commit e4f975e18a
2 changed files with 16 additions and 1 deletions

View file

@ -1001,6 +1001,17 @@ class CNAMERecordSerializer(serializers.ModelSerializer):
model = machines.Domain
fields = ('alias', 'hostname')
class DNAMERecordSerializer(serializers.ModelSerializer):
"""Serialize `machines.models.Domain` objects with the data needed to
generate a DNAME DNS record.
"""
alias = serializers.CharField(read_only=True)
zone = serializers.CharField(read_only=True)
class Meta:
model = machines.DName
fields = ('alias', 'zone')
class DNSZonesSerializer(serializers.ModelSerializer):
"""Serialize the data about DNS Zones.
@ -1015,13 +1026,14 @@ class DNSZonesSerializer(serializers.ModelSerializer):
a_records = ARecordSerializer(many=True, source='get_associated_a_records')
aaaa_records = AAAARecordSerializer(many=True, source='get_associated_aaaa_records')
cname_records = CNAMERecordSerializer(many=True, source='get_associated_cname_records')
dname_records = DNAMERecordSerializer(many=True, source='get_associated_dname_records')
sshfp_records = SSHFPInterfaceSerializer(many=True, source='get_associated_sshfp_records')
class Meta:
model = machines.Extension
fields = ('name', 'soa', 'ns_records', 'originv4', 'originv6',
'mx_records', 'txt_records', 'srv_records', 'a_records',
'aaaa_records', 'cname_records', 'sshfp_records')
'aaaa_records', 'cname_records', 'dname_records', 'sshfp_records')
#REMINDER

View file

@ -741,6 +741,9 @@ class Extension(RevMixin, AclMixin, models.Model):
.filter(cname__interface_parent__in=all_active_assigned_interfaces())
.prefetch_related('cname'))
def get_associated_dname_records(self):
return (DName.objects.filter(alias=self))
@staticmethod
def can_use_all(user_request, *_args, **_kwargs):
"""Superdroit qui permet d'utiliser toutes les extensions sans