Development
This commit is contained in:
parent
8aa4373a6b
commit
923600eef9
2 changed files with 14 additions and 11 deletions
|
|
@ -23,6 +23,7 @@
|
||||||
"datasource": "sqlite:client_credentials",
|
"datasource": "sqlite:client_credentials",
|
||||||
"empty_message": "No credentials configured.",
|
"empty_message": "No credentials configured.",
|
||||||
"toolbar": {
|
"toolbar": {
|
||||||
|
"client_requirement": "client_is_viewer+",
|
||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"type": "select",
|
"type": "select",
|
||||||
|
|
@ -60,23 +61,21 @@
|
||||||
"field": "vlan",
|
"field": "vlan",
|
||||||
"class": "col-narrow col-mono"
|
"class": "col-narrow col-mono"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"label": "Session",
|
||||||
|
"field": "expires_label",
|
||||||
|
"class": "col-narrow"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"label": "Expiration",
|
"label": "Expiration",
|
||||||
"field": "expiration_label",
|
"field": "expiration_label",
|
||||||
"class": "col-narrow"
|
"class": "col-narrow"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": "Enabled",
|
"label": "Active",
|
||||||
"field": "enabled",
|
"field": "active",
|
||||||
"class": "col-narrow",
|
"class": "col-narrow",
|
||||||
"render": "badge_toggle",
|
"render": "badge_yes_no"
|
||||||
"toggle_action": "/action/clientcredentials/toggle",
|
|
||||||
"client_requirement": "client_is_administrator+"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Session",
|
|
||||||
"field": "expires_label",
|
|
||||||
"class": "col-narrow"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"row_actions": [
|
"row_actions": [
|
||||||
|
|
@ -114,7 +113,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "field",
|
"type": "field",
|
||||||
"label": "Account Active",
|
"label": "Account Enabled",
|
||||||
"name": "enabled",
|
"name": "enabled",
|
||||||
"input_type": "checkbox",
|
"input_type": "checkbox",
|
||||||
"value": "true"
|
"value": "true"
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,10 @@ def collect_tokens(cfg):
|
||||||
r['user_type_label'] = USER_TYPE_LABELS.get(r.get('user_type'), str(r.get('user_type', '')))
|
r['user_type_label'] = USER_TYPE_LABELS.get(r.get('user_type'), str(r.get('user_type', '')))
|
||||||
r['expires_label'] = _format_session(r.get('session_seconds', 0))
|
r['expires_label'] = _format_session(r.get('session_seconds', 0))
|
||||||
r['expiration_label'] = _format_expiration(r.get('date_set', 0), r.get('expires_seconds', 0))
|
r['expiration_label'] = _format_expiration(r.get('date_set', 0), r.get('expires_seconds', 0))
|
||||||
|
expires_seconds = r.get('expires_seconds', 0)
|
||||||
|
is_expired = (expires_seconds > 0 and
|
||||||
|
(r.get('date_set', 0) + expires_seconds) <= int(time.time()))
|
||||||
|
r['active'] = r.get('enabled', 0) == 1 and not is_expired
|
||||||
display_rows.append(r)
|
display_rows.append(r)
|
||||||
|
|
||||||
content = factory.load_json(f'{factory.PAGES_DIR}/clientcredentials/content.json')
|
content = factory.load_json(f'{factory.PAGES_DIR}/clientcredentials/content.json')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue