Verified Commit 54392d96 authored by erdnaxe's avatar erdnaxe 🎇

Vlan security is now managed in admin

parent 9dfdfac1
Pipeline #1104 passed with stage
in 3 minutes and 1 second
......@@ -40,10 +40,8 @@ from .models import (
Ns,
Role,
Service,
Vlan,
Srv,
SshFp,
Nas,
IpType,
OuverturePortList,
Ipv6List,
......@@ -516,17 +514,6 @@ class DelServiceForm(FormRevMixin, Form):
self.fields['service'].queryset = Service.objects.all()
class EditOptionVlanForm(FormRevMixin, ModelForm):
"""Ajout d'un vlan : id, nom"""
class Meta:
model = Vlan
fields = ['dhcp_snooping', 'dhcpv6_snooping', 'arp_protect', 'igmp', 'mld']
def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
super(EditOptionVlanForm, self).__init__(*args, prefix=prefix, **kwargs)
class EditOuverturePortConfigForm(FormRevMixin, ModelForm):
"""Edition de la liste des profils d'ouverture de ports
pour l'interface"""
......
......@@ -33,14 +33,11 @@ from re2o.mixins import FormRevMixin
from .models import (
Port,
Switch,
Room,
Stack,
ModelSwitch,
ConstructorSwitch,
AccessPoint,
SwitchBay,
Building,
Dormitory,
PortProfile,
ModuleSwitch,
ModuleOnSwitch,
......
{% comment %}
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.
{% endcomment %}
{% load acl %}
{% load logs_extra %}
{% load i18n %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{% trans "ID" %}</th>
<th>{% trans "Name" %}</th>
<th>{% trans "ARP protect" %}</th>
<th>{% trans "DHCP snooping" %}</th>
<th>{% trans "DHCPv6 snooping" %}</th>
<th>{% trans "IGMP" %}</th>
<th>{% trans "MLD" %}</th>
<th></th>
</tr>
</thead>
{% for vlan in vlan_list %}
<tr>
<td>{{ vlan.vlan_id }}</td>
<td>{{ vlan.name }}</td>
<td>{{ vlan.arp_protect }}</td>
<td>{{ vlan.dhcp_snooping }}</td>
<td>{{ vlan.dhcpv6_snooping }}</td>
<td>{{ vlan.igmp }}</td>
<td>{{ vlan.mld }}</td>
<td class="text-right">
{% can_edit vlan %}
{% include 'buttons/edit.html' with href='topologie:edit-vlanoptions' id=vlan.id %}
{% acl_end %}
{% history_button vlan %}
</td>
</tr>
{% endfor %}
</table>
</div>
......@@ -29,22 +29,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% block title %}{% trans "Topology" %}{% endblock %}
{% block content %}
<h2>{% trans "Port profiles" %}</h2>
{% can_create PortProfile %}
<a class="btn btn-primary btn-sm" role="button" href="{% url 'topologie:new-port-profile' %}"><i class="fa fa-plus"></i>{% trans " Add a port profile" %}</a>
<hr>
{% acl_end %}
{% include 'topologie/aff_port_profile.html' with port_profile_list=port_profile_list %}
<h2>{% trans "VLAN security" %}</h2>
{% include 'topologie/aff_vlanoptions.html' with vlan_list=vlan_list %}
<br />
<br />
<br />
{% endblock %}
......@@ -93,9 +93,6 @@ urlpatterns = [
url(r'^del_port_profile/(?P<portprofileid>[0-9]+)$',
views.del_port_profile,
name='del-port-profile'),
url(r'^edit_vlanoptions/(?P<vlanid>[0-9]+)$',
views.edit_vlanoptions,
name='edit-vlanoptions'),
url(r'^add_module/$', views.add_module, name='add-module'),
url(r'^edit_module/(?P<moduleswitchid>[0-9]+)$',
views.edit_module,
......
......@@ -50,7 +50,6 @@ from machines.forms import (
DomainForm,
EditInterfaceForm,
AddInterfaceForm,
EditOptionVlanForm
)
from machines.views import generate_ipv4_mbf_param
from machines.models import (
......@@ -292,23 +291,6 @@ def index_module(request):
)
@login_required
@can_edit(Vlan)
def edit_vlanoptions(request, vlan_instance, **_kwargs):
""" View used to edit options for switch of VLAN object """
vlan = EditOptionVlanForm(request.POST or None, instance=vlan_instance)
if vlan.is_valid():
if vlan.changed_data:
vlan.save()
messages.success(request, _("The VLAN was edited."))
return redirect(reverse('topologie:index-port-profile'))
return form(
{'vlanform': vlan, 'action_name': _("Edit")},
'machines/machine.html',
request
)
@login_required
@can_create(Port)
def new_port(request, switchid):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment