Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

admin.py 4.33 KB
Newer Older
1
# -*- mode: python; coding: utf-8 -*-
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# Re2o est un logiciel d'administration développé initiallement au rezometz. Il
# se veut agnostique au réseau considéré, de manière à être installable en
# quelques clics.
#
# Copyright © 2017  Gabriel Détraz
# Copyright © 2017  Goulven Kermarec
# Copyright © 2017  Augustin Lemesle
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 24 25
"""machines.admin
The objects, fields and datastructures visible in the Django admin view
"""
26

27 28
from __future__ import unicode_literals

29
from django.contrib import admin
30
from reversion.admin import VersionAdmin
31

32
from .models import IpType, Machine, MachineType, Domain, IpList, Interface
Gabriel Detraz's avatar
Gabriel Detraz committed
33 34 35 36 37 38 39
from .models import (
    Extension,
    SOA,
    Mx,
    Ns,
    Vlan,
    Txt,
Charlie Jacomme's avatar
Charlie Jacomme committed
40
    DName,
Gabriel Detraz's avatar
Gabriel Detraz committed
41
    Srv,
42
    SshFp,
Gabriel Detraz's avatar
Gabriel Detraz committed
43 44
    Nas,
    Service,
45
    Role,
Gabriel Detraz's avatar
Gabriel Detraz committed
46
    OuverturePort,
Gabriel Detraz's avatar
Gabriel Detraz committed
47
    Ipv6List,
48
    OuverturePortList,
Gabriel Detraz's avatar
Gabriel Detraz committed
49
)
50

Gabriel Detraz's avatar
Gabriel Detraz committed
51

52
class MachineAdmin(VersionAdmin):
53
    """ Admin view of a Machine object """
54
    pass
55

Gabriel Detraz's avatar
Gabriel Detraz committed
56

Gabriel Detraz's avatar
Gabriel Detraz committed
57
class Ipv6ListAdmin(VersionAdmin):
58
    """ Admin view of a Ipv6List object """
Gabriel Detraz's avatar
Gabriel Detraz committed
59 60 61
    pass


62
class IpTypeAdmin(VersionAdmin):
63
    """ Admin view of a IpType object """
64
    pass
65

Gabriel Detraz's avatar
Gabriel Detraz committed
66

67
class MachineTypeAdmin(VersionAdmin):
68
    """ Admin view of a MachineType object """
69
    pass
70

Gabriel Detraz's avatar
Gabriel Detraz committed
71

72
class VlanAdmin(VersionAdmin):
73
    """ Admin view of a Vlan object """
74
    pass
75

Gabriel Detraz's avatar
Gabriel Detraz committed
76

77
class ExtensionAdmin(VersionAdmin):
78
    """ Admin view of a Extension object """
79
    pass
80

Gabriel Detraz's avatar
Gabriel Detraz committed
81

82
class SOAAdmin(VersionAdmin):
83
    """ Admin view of a SOA object """
84 85 86
    pass


87
class MxAdmin(VersionAdmin):
88
    """ Admin view of a MX object """
89
    pass
90

Gabriel Detraz's avatar
Gabriel Detraz committed
91

92
class NsAdmin(VersionAdmin):
93
    """ Admin view of a NS object """
94
    pass
95

Gabriel Detraz's avatar
Gabriel Detraz committed
96

Gabriel Detraz's avatar
Gabriel Detraz committed
97
class TxtAdmin(VersionAdmin):
98
    """ Admin view of a TXT object """
Gabriel Detraz's avatar
Gabriel Detraz committed
99 100
    pass

Charlie Jacomme's avatar
Charlie Jacomme committed
101 102 103 104
class DNameAdmin(VersionAdmin):
    """ Admin view of a DName object """
    pass

Gabriel Detraz's avatar
Gabriel Detraz committed
105

Gabriel Detraz's avatar
Gabriel Detraz committed
106
class SrvAdmin(VersionAdmin):
107
    """ Admin view of a SRV object """
Gabriel Detraz's avatar
Gabriel Detraz committed
108 109 110
    pass


111 112 113 114 115
class SshFpAdmin(VersionAdmin):
    """ Admin view of a SSHFP object """
    pass


116
class NasAdmin(VersionAdmin):
117
    """ Admin view of a Nas object """
118
    pass
Gabriel Detraz's avatar
Gabriel Detraz committed
119

Gabriel Detraz's avatar
Gabriel Detraz committed
120

121
class IpListAdmin(VersionAdmin):
122
    """ Admin view of a Ipv4List object """
123
    pass
124

Gabriel Detraz's avatar
Gabriel Detraz committed
125

126
class OuverturePortAdmin(VersionAdmin):
127
    """ Admin view of a OuverturePort object """
128 129
    pass

Gabriel Detraz's avatar
Gabriel Detraz committed
130

131
class OuverturePortListAdmin(VersionAdmin):
132
    """ Admin view of a OuverturePortList object """
133 134
    pass

Gabriel Detraz's avatar
Gabriel Detraz committed
135

136
class InterfaceAdmin(VersionAdmin):
137
    """ Admin view of a Interface object """
138
    list_display = ('machine', 'type', 'mac_address', 'ipv4', 'details')
139

Gabriel Detraz's avatar
Gabriel Detraz committed
140

chirac's avatar
chirac committed
141
class DomainAdmin(VersionAdmin):
142
    """ Admin view of a Domain object """
chirac's avatar
chirac committed
143
    list_display = ('interface_parent', 'name', 'extension', 'cname')
144

Gabriel Detraz's avatar
Gabriel Detraz committed
145

146
class ServiceAdmin(VersionAdmin):
147
    """ Admin view of a ServiceAdmin object """
148
    list_display = ('service_type', 'min_time_regen', 'regular_time_regen')
149

150 151
class RoleAdmin(VersionAdmin):
    """ Admin view of a RoleAdmin object """
chirac's avatar
chirac committed
152
    pass
153 154


Gabriel Detraz's avatar
Gabriel Detraz committed
155

156 157
admin.site.register(Machine, MachineAdmin)
admin.site.register(MachineType, MachineTypeAdmin)
158
admin.site.register(IpType, IpTypeAdmin)
159
admin.site.register(Extension, ExtensionAdmin)
160
admin.site.register(SOA, SOAAdmin)
161 162
admin.site.register(Mx, MxAdmin)
admin.site.register(Ns, NsAdmin)
Gabriel Detraz's avatar
Gabriel Detraz committed
163
admin.site.register(Txt, TxtAdmin)
Charlie Jacomme's avatar
Charlie Jacomme committed
164
admin.site.register(DName, DNameAdmin)
Gabriel Detraz's avatar
Gabriel Detraz committed
165
admin.site.register(Srv, SrvAdmin)
166
admin.site.register(SshFp, SshFpAdmin)
167 168
admin.site.register(IpList, IpListAdmin)
admin.site.register(Interface, InterfaceAdmin)
chirac's avatar
chirac committed
169
admin.site.register(Domain, DomainAdmin)
170
admin.site.register(Service, ServiceAdmin)
171
admin.site.register(Role, RoleAdmin)
172
admin.site.register(Vlan, VlanAdmin)
Gabriel Detraz's avatar
Gabriel Detraz committed
173
admin.site.register(Ipv6List, Ipv6ListAdmin)
174
admin.site.register(Nas, NasAdmin)
175 176
admin.site.register(OuverturePort, OuverturePortAdmin)
admin.site.register(OuverturePortList, OuverturePortListAdmin)