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 !

Commit f59930e4 authored by Gabriel Detraz's avatar Gabriel Detraz Committed by root

Add radius settings

parent 414c7964
......@@ -12,7 +12,7 @@ https://docs.djangoproject.com/en/1.8/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
from .settings_local import SECRET_KEY, DATABASES, DEBUG, ALLOWED_HOSTS, SECURE_CONTENT_TYPE_NOSNIFF, SECURE_BROWSER_XSS_FILTER, SESSION_COOKIE_SECURE, CSRF_COOKIE_SECURE, CSRF_COOKIE_HTTPONLY, X_FRAME_OPTIONS, SESSION_COOKIE_AGE, ASSO_NAME, ASSO_ADDRESS_LINE1, ASSO_ADDRESS_LINE2, ASSO_SIRET, ASSO_EMAIL, ASSO_PHONE, LOGO_PATH, services_urls, REQ_EXPIRE_HRS, REQ_EXPIRE_STR, EMAIL_FROM, SITE_NAME, LDAP, MAIN_EXTENSION, GID_RANGES, UID_RANGES, ASSO_PSEUDO, SEARCH_RESULT, MAX_INTERFACES, MAX_ALIAS
from .settings_local import SECRET_KEY, DATABASES, DEBUG, ALLOWED_HOSTS, SECURE_CONTENT_TYPE_NOSNIFF, SECURE_BROWSER_XSS_FILTER, SESSION_COOKIE_SECURE, CSRF_COOKIE_SECURE, CSRF_COOKIE_HTTPONLY, X_FRAME_OPTIONS, SESSION_COOKIE_AGE, ASSO_NAME, ASSO_ADDRESS_LINE1, ASSO_ADDRESS_LINE2, ASSO_SIRET, ASSO_EMAIL, ASSO_PHONE, LOGO_PATH, services_urls, REQ_EXPIRE_HRS, REQ_EXPIRE_STR, EMAIL_FROM, SITE_NAME, LDAP, MAIN_EXTENSION, GID_RANGES, UID_RANGES, ASSO_PSEUDO, SEARCH_RESULT, MAX_INTERFACES, MAX_ALIAS, VLAN_ID_LIST, RADIUS_VLAN_DECISION
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
......
......@@ -8,7 +8,7 @@ class SwitchAdmin(VersionAdmin):
list_display = ('switch_interface','location','number','details')
class PortAdmin(VersionAdmin):
list_display = ('switch', 'port','room','machine_interface','details')
list_display = ('switch', 'port','room','machine_interface','radius','details')
class RoomAdmin(VersionAdmin):
list_display = ('name','details')
......
......@@ -8,7 +8,7 @@ class PortForm(ModelForm):
class EditPortForm(ModelForm):
class Meta(PortForm.Meta):
fields = ['room', 'machine_interface', 'related', 'details']
fields = ['room', 'machine_interface', 'related', 'radius', 'details']
def __init__(self, *args, **kwargs):
super(EditPortForm, self).__init__(*args, **kwargs)
......@@ -16,7 +16,7 @@ class EditPortForm(ModelForm):
class AddPortForm(ModelForm):
class Meta(PortForm.Meta):
fields = ['port', 'room', 'machine_interface', 'related', 'details']
fields = ['port', 'room', 'machine_interface', 'related', 'radius', 'details']
class EditSwitchForm(ModelForm):
class Meta:
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('topologie', '0020_auto_20161119_0033'),
]
operations = [
migrations.AddField(
model_name='port',
name='radius',
field=models.CharField(choices=[('NO', 'NO'), ('STRICT', 'STRICT'), ('BLOQ', 'BLOQ'), ('COMMON', 'COMMON'), (7, 7), (8, 8), (42, 42), (69, 69)], max_length=32, default='NO'),
),
]
......@@ -5,6 +5,8 @@ from django.contrib.contenttypes.fields import GenericForeignKey
from django.core.exceptions import ValidationError
import reversion
from re2o.settings import VLAN_ID_LIST
def make_port_related(port):
related_port = port.related
related_port.related = port
......@@ -28,12 +30,20 @@ class Switch(models.Model):
class Port(models.Model):
PRETTY_NAME = "Port de switch"
STATES_BASE = (
('NO', 'NO'),
('STRICT', 'STRICT'),
('BLOQ', 'BLOQ'),
('COMMON', 'COMMON'),
)
STATES = STATES_BASE + tuple([(id, id) for id in VLAN_ID_LIST])
switch = models.ForeignKey('Switch', related_name="ports")
port = models.IntegerField()
room = models.ForeignKey('Room', on_delete=models.PROTECT, blank=True, null=True)
machine_interface = models.ForeignKey('machines.Interface', on_delete=models.SET_NULL, blank=True, null=True)
related = models.OneToOneField('self', null=True, blank=True, related_name='related_port')
radius = models.CharField(max_length=32, choices=STATES, default='NO')
details = models.CharField(max_length=255, blank=True)
class Meta:
......
......@@ -5,6 +5,7 @@
<th>Room</th>
<th>Interface machine</th>
<th>Related</th>
<th>Radius</th>
<th>Détails</th>
<th></th>
</tr>
......@@ -27,6 +28,7 @@
<a href="{% url 'topologie:index-port' switch_id=port.related.switch.id %}">{{ port.related }}</a>
{% endif %}
</td>
<td>{{ port.radius }}</td>
<td>{{ port.details }}</td>
<td class="text-right">
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'port' port.pk %}">
......
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