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",
|
||||
"empty_message": "No credentials configured.",
|
||||
"toolbar": {
|
||||
"client_requirement": "client_is_viewer+",
|
||||
"items": [
|
||||
{
|
||||
"type": "select",
|
||||
|
|
@ -60,23 +61,21 @@
|
|||
"field": "vlan",
|
||||
"class": "col-narrow col-mono"
|
||||
},
|
||||
{
|
||||
"label": "Session",
|
||||
"field": "expires_label",
|
||||
"class": "col-narrow"
|
||||
},
|
||||
{
|
||||
"label": "Expiration",
|
||||
"field": "expiration_label",
|
||||
"class": "col-narrow"
|
||||
},
|
||||
{
|
||||
"label": "Enabled",
|
||||
"field": "enabled",
|
||||
"label": "Active",
|
||||
"field": "active",
|
||||
"class": "col-narrow",
|
||||
"render": "badge_toggle",
|
||||
"toggle_action": "/action/clientcredentials/toggle",
|
||||
"client_requirement": "client_is_administrator+"
|
||||
},
|
||||
{
|
||||
"label": "Session",
|
||||
"field": "expires_label",
|
||||
"class": "col-narrow"
|
||||
"render": "badge_yes_no"
|
||||
}
|
||||
],
|
||||
"row_actions": [
|
||||
|
|
@ -114,7 +113,7 @@
|
|||
},
|
||||
{
|
||||
"type": "field",
|
||||
"label": "Account Active",
|
||||
"label": "Account Enabled",
|
||||
"name": "enabled",
|
||||
"input_type": "checkbox",
|
||||
"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['expires_label'] = _format_session(r.get('session_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)
|
||||
|
||||
content = factory.load_json(f'{factory.PAGES_DIR}/clientcredentials/content.json')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue