8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-16 00:13:12 +00:00

Boolean direct pour désactiver un port + logo

This commit is contained in:
chirac 2018-06-30 17:04:15 +00:00 committed by Hugo LEVY-FALK
parent b66dcff8be
commit 2a2a2850bd
6 changed files with 58 additions and 31 deletions

View file

@ -369,15 +369,15 @@ def decide_vlan_and_register_switch(nas_machine, nas_type, port_number,
else: else:
DECISION_VLAN = VLAN_OK DECISION_VLAN = VLAN_OK
if not port.state:
return (sw_name, port.room, u'Port desactive', VLAN_NOK)
if port_profil.radius_type == 'NO': if port_profil.radius_type == 'NO':
return (sw_name, return (sw_name,
"", "",
u"Pas d'authentification sur ce port" + extra_log, u"Pas d'authentification sur ce port" + extra_log,
DECISION_VLAN) DECISION_VLAN)
if port_profil.radius_type == 'BLOQ':
return (sw_name, port.room, u'Port desactive', VLAN_NOK)
if port_profil.radius_type == 'STRICT': if port_profil.radius_type == 'STRICT':
room = port.room room = port.room
if not room: if not room:

View file

@ -81,7 +81,7 @@ class EditPortForm(FormRevMixin, ModelForm):
lent sans)""" lent sans)"""
class Meta(PortForm.Meta): class Meta(PortForm.Meta):
fields = ['room', 'related', 'machine_interface', 'custom_profil', fields = ['room', 'related', 'machine_interface', 'custom_profil',
'details'] 'state', 'details']
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
prefix = kwargs.pop('prefix', self.Meta.model.__name__) prefix = kwargs.pop('prefix', self.Meta.model.__name__)
@ -102,6 +102,7 @@ class AddPortForm(FormRevMixin, ModelForm):
'machine_interface', 'machine_interface',
'related', 'related',
'custom_profil', 'custom_profil',
'state',
'details' 'details'
] ]

View file

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-06-30 16:55
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('topologie', '0065_auto_20180630_1703'),
]
operations = [
migrations.AddField(
model_name='port',
name='state',
field=models.BooleanField(default=True, help_text='Etat du port Actif', verbose_name='Etat du port Actif'),
),
migrations.AlterField(
model_name='portprofile',
name='profil_default',
field=models.CharField(blank=True, choices=[('room', 'room'), ('accespoint', 'accesspoint'), ('uplink', 'uplink'), ('asso_machine', 'asso_machine'), ('nothing', 'nothing')], max_length=32, null=True, unique=True, verbose_name='profil default'),
),
]

View file

@ -401,7 +401,11 @@ class Port(AclMixin, RevMixin, models.Model):
blank=True, blank=True,
null=True null=True
) )
state = models.BooleanField(
default=True,
help_text='Etat du port Actif',
verbose_name=_("Etat du port Actif")
)
details = models.CharField(max_length=255, blank=True) details = models.CharField(max_length=255, blank=True)
class Meta: class Meta:

View file

@ -28,13 +28,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr>
<th>{% include "buttons/sort.html" with prefix='port' col='port' text='Port' %}</th> <th>{% include "buttons/sort.html" with prefix='port' col='port' text='Port' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='room' text='Room' %}</th> <th>{% include "buttons/sort.html" with prefix='port' col='room' text='Room' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='interface' text='Interface machine' %}</th> <th>{% include "buttons/sort.html" with prefix='port' col='interface' text='Interface machine' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='related' text='Related' %}</th> <th>{% include "buttons/sort.html" with prefix='port' col='related' text='Related' %}</th>
<th>{% include "buttons/sort.html" with prefix='port' col='radius' text='Radius' %}</th> <th>Etat du port</th>
<th>{% include "buttons/sort.html" with prefix='port' col='vlan' text='Vlan forcé' %}</th> <th>Profil du port</th>
<th>Détails</th> <th>Détails</th>
<th></th> <th></th>
</tr> </tr>
@ -50,9 +49,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% can_view port.machine_interface.machine.user %} {% can_view port.machine_interface.machine.user %}
<a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}"> <a href="{% url 'users:profil' userid=port.machine_interface.machine.user.id %}">
{{ port.machine_interface }} {{ port.machine_interface }}
</a>
{% acl_else %}
{{ port.machine_interface }}
{% acl_end %} {% acl_end %}
{% endif %} {% endif %}
</td> </td>
@ -70,6 +66,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% acl_end %} {% acl_end %}
{% endif %} {% endif %}
</td> </td>
<td>{% if port.state %} <i class="text-success">Actif</i>{% else %}<i class="text-danger">Désactivé</i>{% endif %}</td>
<td>{% if not port.custom_profil %}<u>Par défaut</u> : {% endif %}{{port.get_port_profil}}</td> <td>{% if not port.custom_profil %}<u>Par défaut</u> : {% endif %}{{port.get_port_profil}}</td>
<td>{{ port.details }}</td> <td>{{ port.details }}</td>
<td class="text-right"> <td class="text-right">

View file

@ -34,8 +34,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
Switchs Switchs
</a> </a>
<a class="list-group-item list-group-item-info" href="{% url "topologie:index-port-profile" %}"> <a class="list-group-item list-group-item-info" href="{% url "topologie:index-port-profile" %}">
<i class="fa fa-sliders"></i> <i class="fa fa-cogs"></i>
Profil des ports switchs Config des ports switchs
</a> </a>
<a class="list-group-item list-group-item-info" href="{% url "topologie:index-ap" %}"> <a class="list-group-item list-group-item-info" href="{% url "topologie:index-ap" %}">
<i class="fa fa-wifi"></i> <i class="fa fa-wifi"></i>