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": "",
"finalize": "",
"libs": [],
"x": 646,
"x": 718,
"y": 320,
"wires": [
[
@@ -118,7 +118,7 @@
"correl": "",
"expiry": "",
"broker": "6c0c13a328d2378c",
"x": 1210,
"x": 1286,
"y": 480,
"wires": []
},
@@ -130,7 +130,7 @@
"scope": null,
"uncaught": false,
"x": 84,
"y": 160,
"y": 88,
"wires": [
[
"8669f263b392e9db"
@@ -152,8 +152,8 @@
"className": "msg.error.message",
"topic": "",
"name": "Error Notification",
"x": 626,
"y": 160,
"x": 698,
"y": 88,
"wires": [
[]
]
@@ -178,8 +178,8 @@
"from": "",
"to": "",
"reg": false,
"x": 346,
"y": 160,
"x": 386,
"y": 88,
"wires": [
[
"30603217455d8705"
@@ -200,12 +200,13 @@
"rh": 0,
"inputs": 0,
"x": 84,
"y": 744,
"y": 856,
"wires": [
[
"4f1d82b81f042382",
"a5fdabb1abae1a6e",
"f070ff4b26975684"
"f070ff4b26975684",
"8b53a58acf784065"
]
]
},
@@ -229,8 +230,8 @@
"payloadType": "json",
"topic": "$CONTROL/dynamic-security/v1",
"topicType": "msg",
"x": 626,
"y": 648,
"x": 702,
"y": 760,
"wires": [
[
"2aecbce52ca97912",
@@ -250,8 +251,8 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 356,
"y": 704,
"x": 396,
"y": 816,
"wires": [
[
"06393fdc9c737c57"
@@ -262,8 +263,8 @@
"id": "06393fdc9c737c57",
"type": "ui_dropdown",
"z": "9fbdd3f57deafc08",
"name": "",
"label": "Existing users dropdown ui",
"name": "Existing users",
"label": "Existing users",
"tooltip": "",
"place": "Select user",
"group": "ab99b1708f72e425",
@@ -278,7 +279,7 @@
"topicType": "msg",
"className": "",
"x": 336,
"y": 784,
"y": 896,
"wires": [
[
"1d4c2df0e173d2e3",
@@ -327,8 +328,8 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 626,
"y": 808,
"x": 688,
"y": 920,
"wires": [
[]
]
@@ -345,7 +346,7 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 656,
"x": 728,
"y": 592,
"wires": [
[
@@ -365,7 +366,7 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 646,
"x": 718,
"y": 216,
"wires": [
[
@@ -390,7 +391,7 @@
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 336,
"x": 376,
"y": 344,
"wires": [
[
@@ -411,7 +412,7 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 656,
"x": 728,
"y": 536,
"wires": [
[
@@ -436,7 +437,7 @@
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 326,
"x": 366,
"y": 592,
"wires": [
[
@@ -484,7 +485,7 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 656,
"x": 728,
"y": 424,
"wires": [
[
@@ -532,7 +533,7 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 656,
"x": 728,
"y": 480,
"wires": [
[
@@ -552,8 +553,8 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 636,
"y": 760,
"x": 708,
"y": 872,
"wires": [
[
"2aecbce52ca97912"
@@ -572,8 +573,8 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 346,
"y": 864,
"x": 386,
"y": 976,
"wires": [
[
"934816df4e8f7fe2"
@@ -592,8 +593,8 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 306,
"y": 648,
"x": 346,
"y": 760,
"wires": [
[
"377b761521508bb9"
@@ -612,8 +613,8 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 888,
"y": 808,
"x": 688,
"y": 816,
"wires": [
[
"934816df4e8f7fe2"
@@ -635,8 +636,8 @@
"resendOnRefresh": false,
"templateScope": "local",
"className": "",
"x": 868,
"y": 864,
"x": 944,
"y": 976,
"wires": [
[]
]
@@ -653,7 +654,7 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 656,
"x": 728,
"y": 264,
"wires": [
[
@@ -673,7 +674,7 @@
"initialize": "",
"finalize": "",
"libs": [],
"x": 666,
"x": 738,
"y": 368,
"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",
"type": "ui_group",
@@ -688,7 +773,7 @@
"tab": "f47c763c366069c9",
"order": 1,
"disp": true,
"width": 8,
"width": "6",
"collapse": false,
"className": ""
},
@@ -730,7 +815,18 @@
"tab": "204076c20d6cbcab",
"order": 2,
"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,
"className": ""
},
@@ -739,6 +835,7 @@
"type": "ui_tab",
"name": "Define new user",
"icon": "fa-user",
"order": 1,
"disabled": false,
"hidden": false
},
@@ -750,5 +847,14 @@
"order": 2,
"disabled": false,
"hidden": false
},
{
"id": "ff03baaa9b35bf68",
"type": "ui_tab",
"name": "Roles and ACLs table informations",
"icon": "fa-info",
"order": 3,
"disabled": false,
"hidden": false
}
]