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']
......
......@@ -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