Development
This commit is contained in:
parent
55ae07160d
commit
f237c69307
3 changed files with 28 additions and 0 deletions
|
|
@ -118,6 +118,14 @@ def networklayout_tablevlans_edit():
|
|||
request.form.getlist('use_blocklists'),
|
||||
{b.get('name') for b in load_config().get('dns_blocking', {}).get('blocklists', [])},
|
||||
)
|
||||
identity_ips_raw = [line.strip() for line in request.form.get('server_identity_ips', '').splitlines() if line.strip()]
|
||||
identity_ips = []
|
||||
for raw_ip in identity_ips_raw:
|
||||
clean = sanitize.ip(raw_ip)
|
||||
if not clean:
|
||||
flash(f"'{raw_ip}' is not a valid IP address.", 'error')
|
||||
return redirect(VIEW)
|
||||
identity_ips.append(clean)
|
||||
|
||||
subnet_mask_raw = request.form.get('subnet_mask')
|
||||
if subnet_mask_raw is not None:
|
||||
|
|
@ -168,6 +176,13 @@ def networklayout_tablevlans_edit():
|
|||
flash('Only one VLAN can be the RADIUS default.', 'error')
|
||||
return redirect(VIEW)
|
||||
|
||||
old_identities = existing.get('server_identities', [])
|
||||
new_identities = []
|
||||
for i, ip in enumerate(identity_ips):
|
||||
entry = dict(old_identities[i]) if i < len(old_identities) else {}
|
||||
entry['ip'] = ip
|
||||
new_identities.append(entry)
|
||||
|
||||
before = {k: existing.get(k) for k in _VLAN_FIELDS}
|
||||
existing.update({
|
||||
'name': name,
|
||||
|
|
@ -178,6 +193,7 @@ def networklayout_tablevlans_edit():
|
|||
'radius_default': radius_default,
|
||||
'mdns_reflection': mdns_reflection,
|
||||
'use_blocklists': use_blocklists,
|
||||
'server_identities': new_identities,
|
||||
})
|
||||
errors = validate.validate_config(cfg)
|
||||
if errors:
|
||||
|
|
|
|||
|
|
@ -305,6 +305,9 @@ def _config_datasource(name):
|
|||
row['use_blocklists'] = json.dumps([
|
||||
{'n': bl, 'd': bl_desc.get(bl, bl)} for bl in v.get('use_blocklists', [])
|
||||
])
|
||||
row['server_identity_ips'] = json.dumps([
|
||||
s.get('ip', '') for s in v.get('server_identities', []) if s.get('ip')
|
||||
])
|
||||
rows.append(row)
|
||||
return rows
|
||||
|
||||
|
|
|
|||
|
|
@ -1521,6 +1521,11 @@
|
|||
"field": "subnet_mask",
|
||||
"class": "col-mono col-narrow"
|
||||
},
|
||||
{
|
||||
"label": "Self Ident(s)",
|
||||
"field": "server_identity_ips",
|
||||
"render": "tag_list"
|
||||
},
|
||||
{
|
||||
"label": "Blocklists",
|
||||
"field": "use_blocklists",
|
||||
|
|
@ -1572,6 +1577,10 @@
|
|||
"min": 1,
|
||||
"max": 30
|
||||
},
|
||||
{
|
||||
"col": "server_identity_ips",
|
||||
"input_type": "textarea"
|
||||
},
|
||||
{
|
||||
"col": "radius_default",
|
||||
"input_type": "checkbox",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue