add roles & acl info

This commit is contained in:
2024-12-15 17:11:47 +01:00
parent da1d756ad8
commit a62724841e

View File

@@ -96,7 +96,7 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 646, "x": 718,
"y": 320, "y": 320,
"wires": [ "wires": [
[ [
@@ -118,7 +118,7 @@
"correl": "", "correl": "",
"expiry": "", "expiry": "",
"broker": "6c0c13a328d2378c", "broker": "6c0c13a328d2378c",
"x": 1210, "x": 1286,
"y": 480, "y": 480,
"wires": [] "wires": []
}, },
@@ -130,7 +130,7 @@
"scope": null, "scope": null,
"uncaught": false, "uncaught": false,
"x": 84, "x": 84,
"y": 160, "y": 88,
"wires": [ "wires": [
[ [
"8669f263b392e9db" "8669f263b392e9db"
@@ -152,8 +152,8 @@
"className": "msg.error.message", "className": "msg.error.message",
"topic": "", "topic": "",
"name": "Error Notification", "name": "Error Notification",
"x": 626, "x": 698,
"y": 160, "y": 88,
"wires": [ "wires": [
[] []
] ]
@@ -178,8 +178,8 @@
"from": "", "from": "",
"to": "", "to": "",
"reg": false, "reg": false,
"x": 346, "x": 386,
"y": 160, "y": 88,
"wires": [ "wires": [
[ [
"30603217455d8705" "30603217455d8705"
@@ -200,12 +200,13 @@
"rh": 0, "rh": 0,
"inputs": 0, "inputs": 0,
"x": 84, "x": 84,
"y": 744, "y": 856,
"wires": [ "wires": [
[ [
"4f1d82b81f042382", "4f1d82b81f042382",
"a5fdabb1abae1a6e", "a5fdabb1abae1a6e",
"f070ff4b26975684" "f070ff4b26975684",
"8b53a58acf784065"
] ]
] ]
}, },
@@ -229,8 +230,8 @@
"payloadType": "json", "payloadType": "json",
"topic": "$CONTROL/dynamic-security/v1", "topic": "$CONTROL/dynamic-security/v1",
"topicType": "msg", "topicType": "msg",
"x": 626, "x": 702,
"y": 648, "y": 760,
"wires": [ "wires": [
[ [
"2aecbce52ca97912", "2aecbce52ca97912",
@@ -250,8 +251,8 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 356, "x": 396,
"y": 704, "y": 816,
"wires": [ "wires": [
[ [
"06393fdc9c737c57" "06393fdc9c737c57"
@@ -262,8 +263,8 @@
"id": "06393fdc9c737c57", "id": "06393fdc9c737c57",
"type": "ui_dropdown", "type": "ui_dropdown",
"z": "9fbdd3f57deafc08", "z": "9fbdd3f57deafc08",
"name": "", "name": "Existing users",
"label": "Existing users dropdown ui", "label": "Existing users",
"tooltip": "", "tooltip": "",
"place": "Select user", "place": "Select user",
"group": "ab99b1708f72e425", "group": "ab99b1708f72e425",
@@ -278,7 +279,7 @@
"topicType": "msg", "topicType": "msg",
"className": "", "className": "",
"x": 336, "x": 336,
"y": 784, "y": 896,
"wires": [ "wires": [
[ [
"1d4c2df0e173d2e3", "1d4c2df0e173d2e3",
@@ -327,8 +328,8 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 626, "x": 688,
"y": 808, "y": 920,
"wires": [ "wires": [
[] []
] ]
@@ -345,7 +346,7 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 656, "x": 728,
"y": 592, "y": 592,
"wires": [ "wires": [
[ [
@@ -365,7 +366,7 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 646, "x": 718,
"y": 216, "y": 216,
"wires": [ "wires": [
[ [
@@ -390,7 +391,7 @@
"drop": false, "drop": false,
"allowrate": false, "allowrate": false,
"outputs": 1, "outputs": 1,
"x": 336, "x": 376,
"y": 344, "y": 344,
"wires": [ "wires": [
[ [
@@ -411,7 +412,7 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 656, "x": 728,
"y": 536, "y": 536,
"wires": [ "wires": [
[ [
@@ -436,7 +437,7 @@
"drop": false, "drop": false,
"allowrate": false, "allowrate": false,
"outputs": 1, "outputs": 1,
"x": 326, "x": 366,
"y": 592, "y": 592,
"wires": [ "wires": [
[ [
@@ -484,7 +485,7 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 656, "x": 728,
"y": 424, "y": 424,
"wires": [ "wires": [
[ [
@@ -532,7 +533,7 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 656, "x": 728,
"y": 480, "y": 480,
"wires": [ "wires": [
[ [
@@ -552,8 +553,8 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 636, "x": 708,
"y": 760, "y": 872,
"wires": [ "wires": [
[ [
"2aecbce52ca97912" "2aecbce52ca97912"
@@ -572,8 +573,8 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 346, "x": 386,
"y": 864, "y": 976,
"wires": [ "wires": [
[ [
"934816df4e8f7fe2" "934816df4e8f7fe2"
@@ -592,8 +593,8 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 306, "x": 346,
"y": 648, "y": 760,
"wires": [ "wires": [
[ [
"377b761521508bb9" "377b761521508bb9"
@@ -612,8 +613,8 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 888, "x": 688,
"y": 808, "y": 816,
"wires": [ "wires": [
[ [
"934816df4e8f7fe2" "934816df4e8f7fe2"
@@ -635,8 +636,8 @@
"resendOnRefresh": false, "resendOnRefresh": false,
"templateScope": "local", "templateScope": "local",
"className": "", "className": "",
"x": 868, "x": 944,
"y": 864, "y": 976,
"wires": [ "wires": [
[] []
] ]
@@ -653,7 +654,7 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 656, "x": 728,
"y": 264, "y": 264,
"wires": [ "wires": [
[ [
@@ -673,7 +674,7 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 666, "x": 738,
"y": 368, "y": 368,
"wires": [ "wires": [
[ [
@@ -681,6 +682,90 @@
] ]
] ]
}, },
{
"id": "5cc1500ac9ea0f30",
"type": "ui_ui_control",
"z": "9fbdd3f57deafc08",
"name": "UI action",
"events": "all",
"x": 84,
"y": 704,
"wires": [
[
"377b761521508bb9",
"87774004a047169f"
]
]
},
{
"id": "87774004a047169f",
"type": "ui_button",
"z": "9fbdd3f57deafc08",
"name": "Refresh roles info",
"group": "550aa2ca318ab1ad",
"order": 1,
"width": 0,
"height": 0,
"passthru": true,
"label": "Refresh roles info",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "mi-refresh",
"payload": "{\"commands\":[{\"command\":\"listRoles\",\"verbose\":true,\"count\":-1,\"offset\":0}]}",
"payloadType": "json",
"topic": "$CONTROL/dynamic-security/v1",
"topicType": "msg",
"x": 698,
"y": 648,
"wires": [
[
"2aecbce52ca97912"
]
]
},
{
"id": "8b53a58acf784065",
"type": "function",
"z": "9fbdd3f57deafc08",
"name": "Extract roles info & fill text field",
"func": "let response_of = msg.payload.responses[0].command;\nif (response_of == \"listRoles\") {\n const roles = msg.payload.responses[0].data.roles;\n // Creazione della struttura HTML per la tabella\n let html = `<table border=\"1\" cellpadding=\"5\" cellspacing=\"0\">\n <thead>\n <tr>\n <th>Role Name</th>\n <th>ACL Type</th>\n <th>Topic</th>\n <th>Priority</th>\n <th>Allow</th>\n </tr>\n </thead>\n <tbody>`;\n\n // Iterazione sui ruoli\n roles.forEach(role => {\n const rowCount = role.acls.length; // Numero di ACL per il ruolo\n role.acls.forEach((acl, index) => {\n html += `<tr>`;\n\n // Solo la prima riga include il nome del ruolo con rowspan\n if (index === 0) {\n html += `<td rowspan=\"${rowCount}\">${role.rolename}</td>`;\n }\n\n // Aggiunta dei dettagli ACL\n html += `<td>${acl.acltype}</td>\n <td>${acl.topic}</td>\n <td>${acl.priority}</td>\n <td>${acl.allow}</td>\n </tr>`;\n });\n });\n\n html += `</tbody></table>`;\n return msg = {\n payload: {\n \"table\": html\n }\n }\n}\n\nreturn null;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 386,
"y": 1032,
"wires": [
[
"b711bce152685dec"
]
]
},
{
"id": "b711bce152685dec",
"type": "ui_template",
"z": "9fbdd3f57deafc08",
"group": "550aa2ca318ab1ad",
"name": "Roles and ACLs table",
"order": 1,
"width": "0",
"height": "0",
"format": "<div ng-bind-html=\"msg.payload.table\"></div>\n<title>Tabella JSON con celle unite</title>\n<style>\n table {\n border-collapse: collapse;\n width: 100%;\n }\n\n th,\n td {\n border: 1px solid #ddd;\n text-align: left;\n padding: 8px;\n }\n\n th {\n background-color: #097479;\n }\n</style>",
"storeOutMessages": false,
"fwdInMessages": false,
"resendOnRefresh": false,
"templateScope": "local",
"className": "",
"x": 980,
"y": 1032,
"wires": [
[]
]
},
{ {
"id": "69ae86190d4eadd7", "id": "69ae86190d4eadd7",
"type": "ui_group", "type": "ui_group",
@@ -688,7 +773,7 @@
"tab": "f47c763c366069c9", "tab": "f47c763c366069c9",
"order": 1, "order": 1,
"disp": true, "disp": true,
"width": 8, "width": "6",
"collapse": false, "collapse": false,
"className": "" "className": ""
}, },
@@ -730,7 +815,18 @@
"tab": "204076c20d6cbcab", "tab": "204076c20d6cbcab",
"order": 2, "order": 2,
"disp": true, "disp": true,
"width": "8", "width": "6",
"collapse": false,
"className": ""
},
{
"id": "550aa2ca318ab1ad",
"type": "ui_group",
"name": "Roles and ACLs table ",
"tab": "ff03baaa9b35bf68",
"order": 1,
"disp": true,
"width": "14",
"collapse": false, "collapse": false,
"className": "" "className": ""
}, },
@@ -739,6 +835,7 @@
"type": "ui_tab", "type": "ui_tab",
"name": "Define new user", "name": "Define new user",
"icon": "fa-user", "icon": "fa-user",
"order": 1,
"disabled": false, "disabled": false,
"hidden": false "hidden": false
}, },
@@ -750,5 +847,14 @@
"order": 2, "order": 2,
"disabled": false, "disabled": false,
"hidden": false "hidden": false
},
{
"id": "ff03baaa9b35bf68",
"type": "ui_tab",
"name": "Roles and ACLs table informations",
"icon": "fa-info",
"order": 3,
"disabled": false,
"hidden": false
} }
] ]