mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-26 08:53:46 +00:00
Add radius settings
This commit is contained in:
parent
e7468fd4a6
commit
3d4f7a6a68
6 changed files with 35 additions and 4 deletions
|
@ -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, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
import os
|
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__)))
|
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')
|
list_display = ('switch_interface','location','number','details')
|
||||||
|
|
||||||
class PortAdmin(VersionAdmin):
|
class PortAdmin(VersionAdmin):
|
||||||
list_display = ('switch', 'port','room','machine_interface','details')
|
list_display = ('switch', 'port','room','machine_interface','radius','details')
|
||||||
|
|
||||||
class RoomAdmin(VersionAdmin):
|
class RoomAdmin(VersionAdmin):
|
||||||
list_display = ('name','details')
|
list_display = ('name','details')
|
||||||
|
|
|
@ -8,7 +8,7 @@ class PortForm(ModelForm):
|
||||||
|
|
||||||
class EditPortForm(ModelForm):
|
class EditPortForm(ModelForm):
|
||||||
class Meta(PortForm.Meta):
|
class Meta(PortForm.Meta):
|
||||||
fields = ['room', 'machine_interface', 'related', 'details']
|
fields = ['room', 'machine_interface', 'related', 'radius', 'details']
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(EditPortForm, self).__init__(*args, **kwargs)
|
super(EditPortForm, self).__init__(*args, **kwargs)
|
||||||
|
@ -16,7 +16,7 @@ class EditPortForm(ModelForm):
|
||||||
|
|
||||||
class AddPortForm(ModelForm):
|
class AddPortForm(ModelForm):
|
||||||
class Meta(PortForm.Meta):
|
class Meta(PortForm.Meta):
|
||||||
fields = ['port', 'room', 'machine_interface', 'related', 'details']
|
fields = ['port', 'room', 'machine_interface', 'related', 'radius', 'details']
|
||||||
|
|
||||||
class EditSwitchForm(ModelForm):
|
class EditSwitchForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
19
topologie/migrations/0021_port_radius.py
Normal file
19
topologie/migrations/0021_port_radius.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# -*- 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
|
from django.core.exceptions import ValidationError
|
||||||
import reversion
|
import reversion
|
||||||
|
|
||||||
|
from re2o.settings import VLAN_ID_LIST
|
||||||
|
|
||||||
def make_port_related(port):
|
def make_port_related(port):
|
||||||
related_port = port.related
|
related_port = port.related
|
||||||
related_port.related = port
|
related_port.related = port
|
||||||
|
@ -28,12 +30,20 @@ class Switch(models.Model):
|
||||||
|
|
||||||
class Port(models.Model):
|
class Port(models.Model):
|
||||||
PRETTY_NAME = "Port de switch"
|
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")
|
switch = models.ForeignKey('Switch', related_name="ports")
|
||||||
port = models.IntegerField()
|
port = models.IntegerField()
|
||||||
room = models.ForeignKey('Room', on_delete=models.PROTECT, blank=True, null=True)
|
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)
|
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')
|
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)
|
details = models.CharField(max_length=255, blank=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
<th>Room</th>
|
<th>Room</th>
|
||||||
<th>Interface machine</th>
|
<th>Interface machine</th>
|
||||||
<th>Related</th>
|
<th>Related</th>
|
||||||
|
<th>Radius</th>
|
||||||
<th>Détails</th>
|
<th>Détails</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -27,6 +28,7 @@
|
||||||
<a href="{% url 'topologie:index-port' switch_id=port.related.switch.id %}">{{ port.related }}</a>
|
<a href="{% url 'topologie:index-port' switch_id=port.related.switch.id %}">{{ port.related }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
<td>{{ port.radius }}</td>
|
||||||
<td>{{ port.details }}</td>
|
<td>{{ port.details }}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'port' port.pk %}">
|
<a class="btn btn-info btn-sm" role="button" title="Historique" href="{% url 'topologie:history' 'port' port.pk %}">
|
||||||
|
|
Loading…
Reference in a new issue