Commit 9ffab2db authored by Leonidas Poulopoulos's avatar Leonidas Poulopoulos

Added extra field to InstServer - denotes radius packet types

parent 6f08eac3
......@@ -84,6 +84,15 @@ class InstServerForm(forms.ModelForm):
return self.cleaned_data["acct_port"]
else:
raise forms.ValidationError(_('This field is required.'))
def clean_rad_pkt_type(self):
rad_pkt_type = self.cleaned_data['rad_pkt_type']
institution = self.cleaned_data['instid']
if institution.ertype in [1,3]:
if rad_pkt_type:
return self.cleaned_data["rad_pkt_type"]
else:
raise forms.ValidationError(_('This field is required.'))
def clean_host(self):
host = self.cleaned_data['host']
......
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'InstServer.rad_pkt_type'
db.add_column('edumanage_instserver', 'rad_pkt_type', self.gf('django.db.models.fields.CharField')(default='auth+acct', max_length=48, null=True, blank=True), keep_default=False)
def backwards(self, orm):
# Deleting field 'InstServer.rad_pkt_type'
db.delete_column('edumanage_instserver', 'rad_pkt_type')
models = {
'contenttypes.contenttype': {
'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'edumanage.contact': {
'Meta': {'object_name': 'Contact'},
'email': ('django.db.models.fields.CharField', [], {'max_length': '80', 'db_column': "'contact_email'"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_column': "'contact_name'"}),
'phone': ('django.db.models.fields.CharField', [], {'max_length': '80', 'db_column': "'contact_phone'"})
},
'edumanage.institution': {
'Meta': {'object_name': 'Institution'},
'ertype': ('django.db.models.fields.PositiveIntegerField', [], {'max_length': '1', 'db_column': "'type'"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'realmid': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['edumanage.Realm']"})
},
'edumanage.institutioncontactpool': {
'Meta': {'object_name': 'InstitutionContactPool'},
'contact': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['edumanage.Contact']", 'unique': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'institution': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['edumanage.Institution']"})
},
'edumanage.institutiondetails': {
'Meta': {'object_name': 'InstitutionDetails'},
'address_city': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
'address_street': ('django.db.models.fields.CharField', [], {'max_length': '96'}),
'contact': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['edumanage.Contact']", 'symmetrical': 'False'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'institution': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['edumanage.Institution']", 'unique': 'True'}),
'number_id': ('django.db.models.fields.PositiveIntegerField', [], {'max_length': '6', 'null': 'True', 'blank': 'True'}),
'number_user': ('django.db.models.fields.PositiveIntegerField', [], {'max_length': '6', 'null': 'True', 'blank': 'True'}),
'oper_name': ('django.db.models.fields.CharField', [], {'max_length': '24', 'null': 'True', 'blank': 'True'}),
'ts': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
'edumanage.instrealm': {
'Meta': {'object_name': 'InstRealm'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'instid': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['edumanage.Institution']"}),
'proxyto': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['edumanage.InstServer']", 'symmetrical': 'False'}),
'realm': ('django.db.models.fields.CharField', [], {'max_length': '160'})
},
'edumanage.instrealmmon': {
'Meta': {'unique_together': "(('realm', 'mon_type'),)", 'object_name': 'InstRealmMon'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'mon_type': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
'realm': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['edumanage.InstRealm']"})
},
'edumanage.instserver': {
'Meta': {'object_name': 'InstServer'},
'acct_port': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1813', 'max_length': '5', 'null': 'True', 'blank': 'True'}),
'addr_type': ('django.db.models.fields.CharField', [], {'default': "'ipv4'", 'max_length': '16'}),
'auth_port': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1812', 'max_length': '5', 'null': 'True', 'blank': 'True'}),
'ertype': ('django.db.models.fields.PositiveIntegerField', [], {'max_length': '1', 'db_column': "'type'"}),
'host': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'instid': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['edumanage.Institution']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}),
'proto': ('django.db.models.fields.CharField', [], {'default': "'radius'", 'max_length': '12'}),
'rad_pkt_type': ('django.db.models.fields.CharField', [], {'default': "'auth+acct'", 'max_length': '48', 'null': 'True', 'blank': 'True'}),
'secret': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
'status_server': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'ts': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
'edumanage.monlocalauthnparam': {
'Meta': {'object_name': 'MonLocalAuthnParam'},
'eap_method': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'instrealmmonid': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['edumanage.InstRealmMon']", 'unique': 'True'}),
'passwp': ('django.db.models.fields.CharField', [], {'max_length': '24', 'db_column': "'pass'"}),
'phase2': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
'username': ('django.db.models.fields.CharField', [], {'max_length': '24'})
},
'edumanage.monproxybackclient': {
'Meta': {'object_name': 'MonProxybackClient'},
'host': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'instrealmmonid': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['edumanage.InstRealmMon']"}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '80', 'null': 'True', 'blank': 'True'}),
'proto': ('django.db.models.fields.CharField', [], {'max_length': '12'}),
'secret': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
'status_server': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'ts': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
'edumanage.name_i18n': {
'Meta': {'object_name': 'Name_i18n'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'lang': ('django.db.models.fields.CharField', [], {'max_length': '5'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '80'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'})
},
'edumanage.realm': {
'Meta': {'object_name': 'Realm'},
'address_city': ('django.db.models.fields.CharField', [], {'max_length': '24'}),
'address_street': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
'contact': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['edumanage.Contact']", 'symmetrical': 'False'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '2'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'stype': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0', 'max_length': '1'}),
'ts': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'})
},
'edumanage.realmdata': {
'Meta': {'object_name': 'RealmData'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'number_IdP': ('django.db.models.fields.PositiveIntegerField', [], {'max_length': '5'}),
'number_IdPSP': ('django.db.models.fields.PositiveIntegerField', [], {'max_length': '5'}),
'number_SP': ('django.db.models.fields.PositiveIntegerField', [], {'max_length': '5'}),
'number_id': ('django.db.models.fields.PositiveIntegerField', [], {'max_length': '9'}),
'number_inst': ('django.db.models.fields.PositiveIntegerField', [], {'max_length': '5'}),
'number_user': ('django.db.models.fields.PositiveIntegerField', [], {'max_length': '9'}),
'realmid': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['edumanage.Realm']", 'unique': 'True'}),
'ts': ('django.db.models.fields.DateTimeField', [], {})
},
'edumanage.serviceloc': {
'AP_no': ('django.db.models.fields.PositiveIntegerField', [], {'max_length': '3'}),
'IPv6': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'Meta': {'object_name': 'ServiceLoc'},
'NAT': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'SSID': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
'address_city': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
'address_street': ('django.db.models.fields.CharField', [], {'max_length': '96'}),
'contact': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['edumanage.Contact']", 'null': 'True', 'blank': 'True'}),
'enc_level': ('edumanage.models.MultiSelectField', [], {'max_length': '64'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'institutionid': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['edumanage.Institution']"}),
'latitude': ('django.db.models.fields.DecimalField', [], {'max_digits': '8', 'decimal_places': '6'}),
'longitude': ('django.db.models.fields.DecimalField', [], {'max_digits': '8', 'decimal_places': '6'}),
'port_restrict': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'transp_proxy': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
'ts': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'wired': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'})
},
'edumanage.url_i18n': {
'Meta': {'object_name': 'URL_i18n'},
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']", 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'lang': ('django.db.models.fields.CharField', [], {'max_length': '5'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'url': ('django.db.models.fields.CharField', [], {'max_length': '180', 'db_column': "'URL'"}),
'urltype': ('django.db.models.fields.CharField', [], {'max_length': '10', 'db_column': "'type'"})
}
}
complete_apps = ['edumanage']
......@@ -126,6 +126,12 @@ ADDRTYPES = (
#('ipv6', 'IPv6 only'), # Commented for the time...not yet in use
)
RADTYPES = (
('auth', 'Handles Access-Request packets only'),
('acct', 'Handles Accounting-Request packets only'),
('auth+acct', 'Handles both Access-Request and Accounting-Request packets'),
)
class Name_i18n(models.Model):
'''
Name in a particular language
......@@ -235,9 +241,11 @@ class InstServer(models.Model):
host = models.CharField(max_length=80, help_text=_("IP address | FQDN hostname")) # Handling with FQDN parser or ipaddr (google lib) * !!! Add help text to render it in template (mandatory, unique)
#TODO: Add description field or label field
# accept if type: 1 (idp) or 3 (idpsp) (for the folowing 4 fields)
rad_pkt_type = models.CharField(max_length=48, choices=RADTYPES, default='auth+acct', null=True, blank=True,)
auth_port = models.PositiveIntegerField(max_length=5, null=True, blank=True, default=1812, help_text=_("Default for RADIUS: 1812")) # TODO: Also ignore while exporting XML
acct_port = models.PositiveIntegerField(max_length=5, null=True, blank=True, default=1813, help_text=_("Default for RADIUS: 1813"))
status_server = models.BooleanField(help_text=_("Do you accept Status-Server requests?"))
secret = models.CharField(max_length=80)
proto = models.CharField(max_length=12, choices=RADPROTOS, default='radius')
ts = models.DateTimeField(auto_now=True)
......
......@@ -52,6 +52,12 @@
</div>
</div>
{% if institution.ertype == 1 or institution.ertype == 3 %}
<div class="control-group">
<label class="control-label" for="id_port">{% trans "RADIUS Packet Types" %}</label>
<div class="controls">
{{ server.get_rad_pkt_type_display }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_port">{% trans "Authentication Port" %}</label>
<div class="controls">
......
......@@ -63,6 +63,14 @@ $(document).ready(function() {
</div>
</div>
{% if institution.ertype == 1 or institution.ertype == 3 %}
<div class="control-group {% if form.rad_pkt_type.errors %} error {% endif %}">
<label class="control-label" for="id_rad_pkt_type"><b>{% trans "RADIUS Packet Types" %}</b></label>
<div class="controls">
{{ form.rad_pkt_type }}
{% if form.rad_pkt_type.errors %} <span class="help-inline"> {{ form.rad_pkt_type.errors|join:", " }} </span>
{% endif %} <span class="help-block">{{ form.rad_pkt_type.help_text }}</span>
</div>
</div>
<div class="control-group {% if form.auth_port.errors %} error {% endif %}">
<label class="control-label" for="id_auth_port"><b>{% trans "Authentication Port" %}</b></label>
<div class="controls">
......
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