urls.py 6.85 KB
Newer Older
1
# -*- mode: python; coding: utf-8 -*-
moamoak's avatar
moamoak committed
2 3 4 5
# 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.
#
moamoak's avatar
moamoak committed
6
# Copyright © 2018 Maël Kervella
moamoak's avatar
moamoak committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#
# 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.

moamoak's avatar
moamoak committed
22
"""Defines the URLs of the API
moamoak's avatar
moamoak committed
23

moamoak's avatar
moamoak committed
24 25 26 27 28
A custom router is used to register all the routes. That allows to register
all the URL patterns from the viewsets as a standard router but, the views
can also be register. That way a complete API root page presenting all URLs
can be generated automatically.
"""
moamoak's avatar
moamoak committed
29

moamoak's avatar
moamoak committed
30
from django.conf.urls import url, include
moamoak's avatar
moamoak committed
31

moamoak's avatar
moamoak committed
32
from . import views
moamoak's avatar
moamoak committed
33 34
from .routers import AllViewsRouter

35
router = AllViewsRouter()
moamoak's avatar
moamoak committed
36
# COTISATIONS
moamoak's avatar
moamoak committed
37 38 39 40 41 42
router.register_viewset(r'cotisations/facture', views.FactureViewSet)
router.register_viewset(r'cotisations/vente', views.VenteViewSet)
router.register_viewset(r'cotisations/article', views.ArticleViewSet)
router.register_viewset(r'cotisations/banque', views.BanqueViewSet)
router.register_viewset(r'cotisations/paiement', views.PaiementViewSet)
router.register_viewset(r'cotisations/cotisation', views.CotisationViewSet)
moamoak's avatar
moamoak committed
43
# MACHINES
moamoak's avatar
moamoak committed
44 45 46 47
router.register_viewset(r'machines/machine', views.MachineViewSet)
router.register_viewset(r'machines/machinetype', views.MachineTypeViewSet)
router.register_viewset(r'machines/iptype', views.IpTypeViewSet)
router.register_viewset(r'machines/vlan', views.VlanViewSet)
48 49
router.register_viewset(r'machines/nas', views.NasViewSet)
router.register_viewset(r'machines/soa', views.SOAViewSet)
moamoak's avatar
moamoak committed
50
router.register_viewset(r'machines/extension', views.ExtensionViewSet)
51 52 53
router.register_viewset(r'machines/mx', views.MxViewSet)
router.register_viewset(r'machines/ns', views.NsViewSet)
router.register_viewset(r'machines/txt', views.TxtViewSet)
jacomme's avatar
jacomme committed
54
router.register_viewset(r'machines/dname', views.DNameViewSet)
55
router.register_viewset(r'machines/srv', views.SrvViewSet)
56
router.register_viewset(r'machines/sshfp', views.SshFpViewSet)
moamoak's avatar
moamoak committed
57 58 59 60 61 62 63 64
router.register_viewset(r'machines/interface', views.InterfaceViewSet)
router.register_viewset(r'machines/ipv6list', views.Ipv6ListViewSet)
router.register_viewset(r'machines/domain', views.DomainViewSet)
router.register_viewset(r'machines/iplist', views.IpListViewSet)
router.register_viewset(r'machines/service', views.ServiceViewSet)
router.register_viewset(r'machines/servicelink', views.ServiceLinkViewSet, base_name='servicelink')
router.register_viewset(r'machines/ouvertureportlist', views.OuverturePortListViewSet)
router.register_viewset(r'machines/ouvertureport', views.OuverturePortViewSet)
65
router.register_viewset(r'machines/role', views.RoleViewSet)
moamoak's avatar
moamoak committed
66
# PREFERENCES
67 68 69
router.register_view(r'preferences/optionaluser', views.OptionalUserView),
router.register_view(r'preferences/optionalmachine', views.OptionalMachineView),
router.register_view(r'preferences/optionaltopologie', views.OptionalTopologieView),
70
router.register_view(r'preferences/radiusoption', views.RadiusOptionView),
71
router.register_view(r'preferences/generaloption', views.GeneralOptionView),
72
router.register_viewset(r'preferences/service', views.HomeServiceViewSet, base_name='homeservice'),
73 74 75
router.register_view(r'preferences/assooption', views.AssoOptionView),
router.register_view(r'preferences/homeoption', views.HomeOptionView),
router.register_view(r'preferences/mailmessageoption', views.MailMessageOptionView),
moamoak's avatar
moamoak committed
76
# TOPOLOGIE
77 78 79
router.register_viewset(r'topologie/stack', views.StackViewSet)
router.register_viewset(r'topologie/acesspoint', views.AccessPointViewSet)
router.register_viewset(r'topologie/switch', views.SwitchViewSet)
80
router.register_viewset(r'topologie/server', views.ServerViewSet)
81 82 83 84
router.register_viewset(r'topologie/modelswitch', views.ModelSwitchViewSet)
router.register_viewset(r'topologie/constructorswitch', views.ConstructorSwitchViewSet)
router.register_viewset(r'topologie/switchbay', views.SwitchBayViewSet)
router.register_viewset(r'topologie/building', views.BuildingViewSet)
85 86
router.register_viewset(r'topologie/switchport', views.SwitchPortViewSet, base_name='switchport')
router.register_viewset(r'topologie/portprofile', views.PortProfileViewSet, base_name='portprofile')
87
router.register_viewset(r'topologie/room', views.RoomViewSet)
88
router.register(r'topologie/portprofile', views.PortProfileViewSet)
moamoak's avatar
moamoak committed
89
# USERS
90 91
router.register_viewset(r'users/user', views.UserViewSet, base_name='user')
router.register_viewset(r'users/homecreation', views.HomeCreationViewSet, base_name='homecreation')
detraz's avatar
detraz committed
92 93
router.register_viewset(r'users/normaluser', views.NormalUserViewSet, base_name='normaluser')
router.register_viewset(r'users/criticaluser', views.CriticalUserViewSet, base_name='criticaluser')
moamoak's avatar
moamoak committed
94 95 96 97 98 99 100 101
router.register_viewset(r'users/club', views.ClubViewSet)
router.register_viewset(r'users/adherent', views.AdherentViewSet)
router.register_viewset(r'users/serviceuser', views.ServiceUserViewSet)
router.register_viewset(r'users/school', views.SchoolViewSet)
router.register_viewset(r'users/listright', views.ListRightViewSet)
router.register_viewset(r'users/shell', views.ShellViewSet, base_name='shell')
router.register_viewset(r'users/ban', views.BanViewSet)
router.register_viewset(r'users/whitelist', views.WhitelistViewSet)
102
router.register_viewset(r'users/emailaddress', views.EMailAddressViewSet)
moamoak's avatar
moamoak committed
103
# SERVICE REGEN
104 105 106
router.register_viewset(r'services/regen', views.ServiceRegenViewSet, base_name='serviceregen')
# DHCP
router.register_view(r'dhcp/hostmacip', views.HostMacIpView),
moamoak's avatar
moamoak committed
107 108
# LOCAL EMAILS
router.register_view(r'localemail/users', views.LocalEmailUsersView),
109 110
# Firewall
router.register_view(r'firewall/subnet-ports', views.SubnetPortsOpenView),
111
router.register_view(r'firewall/interface-ports', views.InterfacePortsOpenView),
112 113
# Switches config
router.register_view(r'switchs/ports-config', views.SwitchPortView),
114
router.register_view(r'switchs/role', views.RoleView),
115 116
# Reminder
router.register_view(r'reminder/get-users', views.ReminderView),
117 118
# DNS
router.register_view(r'dns/zones', views.DNSZonesView),
jacomme's avatar
jacomme committed
119
router.register_view(r'dns/reverse-zones', views.DNSReverseZonesView),
120 121 122
# MAILING
router.register_view(r'mailing/standard', views.StandardMailingView),
router.register_view(r'mailing/club', views.ClubMailingView),
moamoak's avatar
moamoak committed
123
# TOKEN AUTHENTICATION
124
router.register_view(r'token-auth', views.ObtainExpiringAuthToken)
125

moamoak's avatar
moamoak committed
126
urlpatterns = [
moamoak's avatar
moamoak committed
127
    url(r'^', include(router.urls)),
moamoak's avatar
moamoak committed
128
]