diff --git a/freeradius_utils/auth.py b/freeradius_utils/auth.py index 4e9ad24e..b318ab63 100644 --- a/freeradius_utils/auth.py +++ b/freeradius_utils/auth.py @@ -369,15 +369,15 @@ def decide_vlan_and_register_switch(nas_machine, nas_type, port_number, else: DECISION_VLAN = VLAN_OK + if not port.state: + return (sw_name, port.room, u'Port desactive', VLAN_NOK) + if port_profil.radius_type == 'NO': return (sw_name, "", u"Pas d'authentification sur ce port" + extra_log, DECISION_VLAN) - if port_profil.radius_type == 'BLOQ': - return (sw_name, port.room, u'Port desactive', VLAN_NOK) - if port_profil.radius_type == 'STRICT': room = port.room if not room: diff --git a/topologie/forms.py b/topologie/forms.py index d0cd38e0..9ac3297f 100644 --- a/topologie/forms.py +++ b/topologie/forms.py @@ -81,7 +81,7 @@ class EditPortForm(FormRevMixin, ModelForm): lent sans)""" class Meta(PortForm.Meta): fields = ['room', 'related', 'machine_interface', 'custom_profil', - 'details'] + 'state', 'details'] def __init__(self, *args, **kwargs): prefix = kwargs.pop('prefix', self.Meta.model.__name__) @@ -102,6 +102,7 @@ class AddPortForm(FormRevMixin, ModelForm): 'machine_interface', 'related', 'custom_profil', + 'state', 'details' ] diff --git a/topologie/migrations/0066_auto_20180630_1855.py b/topologie/migrations/0066_auto_20180630_1855.py new file mode 100644 index 00000000..b197f568 --- /dev/null +++ b/topologie/migrations/0066_auto_20180630_1855.py @@ -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'), + ), + ] diff --git a/topologie/models.py b/topologie/models.py index e4a79f74..9fa30970 100644 --- a/topologie/models.py +++ b/topologie/models.py @@ -401,7 +401,11 @@ class Port(AclMixin, RevMixin, models.Model): blank=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) class Meta: diff --git a/topologie/templates/topologie/aff_port.html b/topologie/templates/topologie/aff_port.html index 85fe901e..46398f75 100644 --- a/topologie/templates/topologie/aff_port.html +++ b/topologie/templates/topologie/aff_port.html @@ -28,30 +28,26 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% include "buttons/sort.html" with prefix='port' col='port' text='Port' %} | -{% include "buttons/sort.html" with prefix='port' col='room' text='Room' %} | -{% include "buttons/sort.html" with prefix='port' col='interface' text='Interface machine' %} | -{% include "buttons/sort.html" with prefix='port' col='related' text='Related' %} | -{% include "buttons/sort.html" with prefix='port' col='radius' text='Radius' %} | -{% include "buttons/sort.html" with prefix='port' col='vlan' text='Vlan forcé' %} | -Détails | -- | |||
---|---|---|---|---|---|---|---|---|---|---|
{{ port.port }} | -- {% if port.room %}{{ port.room }}{% endif %} - | -- {% if port.machine_interface %} - {% can_view port.machine_interface.machine.user %} - - {{ port.machine_interface }} - - {% acl_else %} + | {% include "buttons/sort.html" with prefix='port' col='port' text='Port' %} | +{% include "buttons/sort.html" with prefix='port' col='room' text='Room' %} | +{% include "buttons/sort.html" with prefix='port' col='interface' text='Interface machine' %} | +{% include "buttons/sort.html" with prefix='port' col='related' text='Related' %} | +Etat du port | +Profil du port | +Détails | ++ |
{{ port.port }} | ++ {% if port.room %}{{ port.room }}{% endif %} + | ++ {% if port.machine_interface %} + {% can_view port.machine_interface.machine.user %} + {{ port.machine_interface }} {% acl_end %} {% endif %} @@ -70,6 +66,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% acl_end %} {% endif %} | +{% if port.state %} Actif{% else %}Désactivé{% endif %} | {% if not port.custom_profil %}Par défaut : {% endif %}{{port.get_port_profil}} | {{ port.details }} | diff --git a/topologie/templates/topologie/sidebar.html b/topologie/templates/topologie/sidebar.html index c7ea6337..8652690e 100644 --- a/topologie/templates/topologie/sidebar.html +++ b/topologie/templates/topologie/sidebar.html @@ -34,8 +34,8 @@ with this program; if not, write to the Free Software Foundation, Inc., Switchs - - Profil des ports switchs + + Config des ports switchs |