Development
This commit is contained in:
parent
4734eb41a0
commit
d8ae7b8ce4
2 changed files with 49 additions and 10 deletions
|
|
@ -38,12 +38,26 @@ def regenerate():
|
||||||
@require_level('administrator')
|
@require_level('administrator')
|
||||||
def options_save():
|
def options_save():
|
||||||
mac_format = request.form.get('mac_format', 'aabbccddeeff')
|
mac_format = request.form.get('mac_format', 'aabbccddeeff')
|
||||||
apply_to = request.form.get('apply_to', 'all')
|
|
||||||
ap_ips = request.form.getlist('ap_ips')
|
|
||||||
|
|
||||||
if mac_format not in VALID_MAC_FORMATS:
|
if mac_format not in VALID_MAC_FORMATS:
|
||||||
flash('Invalid MAC format.', 'error')
|
flash('Invalid MAC format.', 'error')
|
||||||
return redirect(f'/{_PAGE}')
|
return redirect(f'/{_PAGE}')
|
||||||
|
|
||||||
|
cfg = load_config()
|
||||||
|
before = copy.deepcopy(cfg.get('radius', {}).get('options', {}))
|
||||||
|
after = {**before, 'mac_format': mac_format}
|
||||||
|
cfg.setdefault('radius', {})['options'] = after
|
||||||
|
|
||||||
|
changes = diff_fields(before, after)
|
||||||
|
flash(record_group(cfg, 'radius.options', 'setting', 'radius', changes, 'core apply'), 'success')
|
||||||
|
return redirect(f'/{_PAGE}')
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/action/radius/default_rule_save', methods=['POST'])
|
||||||
|
@require_level('administrator')
|
||||||
|
def default_rule_save():
|
||||||
|
apply_to = request.form.get('apply_to', 'all')
|
||||||
|
ap_ips = request.form.getlist('ap_ips')
|
||||||
|
|
||||||
if apply_to not in ('all', 'wireless', 'huntgroup'):
|
if apply_to not in ('all', 'wireless', 'huntgroup'):
|
||||||
flash('Invalid apply_to value.', 'error')
|
flash('Invalid apply_to value.', 'error')
|
||||||
return redirect(f'/{_PAGE}')
|
return redirect(f'/{_PAGE}')
|
||||||
|
|
@ -60,11 +74,11 @@ def options_save():
|
||||||
return redirect(f'/{_PAGE}')
|
return redirect(f'/{_PAGE}')
|
||||||
|
|
||||||
before = copy.deepcopy(cfg.get('radius', {}).get('options', {}))
|
before = copy.deepcopy(cfg.get('radius', {}).get('options', {}))
|
||||||
after = {'mac_format': mac_format, 'apply_to': apply_to, 'ap_ips': ap_ips}
|
after = {**before, 'apply_to': apply_to, 'ap_ips': ap_ips}
|
||||||
cfg.setdefault('radius', {})['options'] = after
|
cfg.setdefault('radius', {})['options'] = after
|
||||||
|
|
||||||
changes = diff_fields(before, after)
|
changes = diff_fields(before, after)
|
||||||
flash(record_group(cfg, 'radius.options', 'setting', 'radius', changes, 'core apply'), 'success')
|
flash(record_group(cfg, 'radius.options', 'default_rule', 'radius', changes, 'core apply'), 'success')
|
||||||
return redirect(f'/{_PAGE}')
|
return redirect(f'/{_PAGE}')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,31 @@
|
||||||
],
|
],
|
||||||
"hint": "Must match your AP/controller's expected format."
|
"hint": "Must match your AP/controller's expected format."
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "button_row",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"type": "button_primary",
|
||||||
|
"action": "/action/radius/options_save",
|
||||||
|
"method": "post",
|
||||||
|
"text": "Save"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "card",
|
||||||
|
"label": "DEFAULT Rule Scope",
|
||||||
|
"client_requirement": "client_is_administrator+",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"type": "form",
|
||||||
|
"action": "/action/radius/default_rule_save",
|
||||||
|
"method": "post",
|
||||||
|
"items": [
|
||||||
{
|
{
|
||||||
"type": "field",
|
"type": "field",
|
||||||
"label": "Apply DEFAULT Rule To",
|
"label": "Apply DEFAULT Rule To",
|
||||||
|
|
@ -77,15 +102,15 @@
|
||||||
"input_type": "select",
|
"input_type": "select",
|
||||||
"value": "%RADIUS_APPLY_TO%",
|
"value": "%RADIUS_APPLY_TO%",
|
||||||
"options": [
|
"options": [
|
||||||
{"value": "all", "label": "All clients"},
|
{"value": "all", "label": "All authenticators"},
|
||||||
{"value": "wireless", "label": "Wireless clients only (NAS-Port-Type = Wireless-802.11)"},
|
{"value": "wireless", "label": "Wireless authenticators only (NAS-Port-Type = Wireless-802.11)"},
|
||||||
{"value": "huntgroup", "label": "Wireless clients only (AP huntgroup by IP)"}
|
{"value": "huntgroup", "label": "Wireless authenticators only (AP huntgroup by IP)"}
|
||||||
],
|
],
|
||||||
"hint": "Scoping to wireless only prevents the DEFAULT rule from assigning a VLAN to unknown wired switch ports. Huntgroup is more precise but requires AP IPs below."
|
"hint": "Scoping to wireless only prevents the DEFAULT rule from assigning a VLAN to unknown wired switch ports. Huntgroup is more precise but requires AP IPs below."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "field",
|
"type": "field",
|
||||||
"label": "Which of the following RADIUS Clients are Wireless Access Points that you wish to add to the huntgroup?",
|
"label": "Which of the following RADIUS Authenticators are Wireless Access Points that you wish to add to the huntgroup?",
|
||||||
"name": "ap_ips",
|
"name": "ap_ips",
|
||||||
"input_type": "checkbox_group",
|
"input_type": "checkbox_group",
|
||||||
"options": "%RADIUS_AP_IPS_OPTIONS%",
|
"options": "%RADIUS_AP_IPS_OPTIONS%",
|
||||||
|
|
@ -97,7 +122,7 @@
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"type": "button_primary",
|
"type": "button_primary",
|
||||||
"action": "/action/radius/options_save",
|
"action": "/action/radius/default_rule_save",
|
||||||
"method": "post",
|
"method": "post",
|
||||||
"text": "Save"
|
"text": "Save"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue