Development
This commit is contained in:
parent
f30c4d5d79
commit
09beba8889
3 changed files with 17 additions and 5 deletions
|
|
@ -84,7 +84,7 @@
|
|||
{
|
||||
"type": "card",
|
||||
"id": "add-form",
|
||||
"label": "Add Reservation/Authorization",
|
||||
"label": "Add Reservation/Authorization Rule",
|
||||
"client_requirement": "client_is_administrator+",
|
||||
"items": [
|
||||
{
|
||||
|
|
@ -158,7 +158,8 @@
|
|||
"type": "field",
|
||||
"label": "Enabled",
|
||||
"name": "enabled",
|
||||
"input_type": "checkbox"
|
||||
"input_type": "checkbox",
|
||||
"hint": "Enable or disable this reservation/authorization rule."
|
||||
},
|
||||
{
|
||||
"type": "button_row",
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "info_bar",
|
||||
"variant": "info",
|
||||
"text": "%RADIUS_CLIENT_STATUS_TEXT%"
|
||||
},
|
||||
{
|
||||
"type": "card",
|
||||
"label": "Shared Secret",
|
||||
|
|
|
|||
|
|
@ -68,10 +68,16 @@ def collect_tokens(cfg):
|
|||
tokens['RADIUS_APPLY_TO'] = fr_opts.get('apply_to', 'all')
|
||||
tokens['RADIUS_AP_IPS'] = json.dumps(fr_opts.get('ap_ips', []))
|
||||
|
||||
all_radius_clients = [r for r in cfg.get('dhcp_reservations', []) if r.get('radius_client') is True]
|
||||
n = len(all_radius_clients)
|
||||
if n > 0:
|
||||
tokens['RADIUS_CLIENT_STATUS_TEXT'] = f"RADIUS will be disabled if there are no RADIUS Clients specified on the DHCP Reservations page. There are currently {n} RADIUS Client{'s' if n != 1 else ''}. RADIUS is enabled."
|
||||
else:
|
||||
tokens['RADIUS_CLIENT_STATUS_TEXT'] = "RADIUS will be disabled if there are no RADIUS Clients specified on the DHCP Reservations page. There are currently 0 RADIUS Clients. RADIUS is disabled."
|
||||
|
||||
radius_client_reservations = [
|
||||
r for r in cfg.get('dhcp_reservations', [])
|
||||
if r.get('radius_client') is True
|
||||
and r.get('ip') and r.get('ip') not in ('', 'dynamic')
|
||||
r for r in all_radius_clients
|
||||
if r.get('ip') and r.get('ip') not in ('', 'dynamic')
|
||||
]
|
||||
tokens['RADIUS_AP_IPS_OPTIONS'] = json.dumps([
|
||||
{'value': r['ip'], 'label': f"{r.get('description', r['ip'])} ({r['ip']})"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue