optimized

This commit is contained in:
2024-12-16 09:29:13 +01:00
parent a62724841e
commit 25b3368911

View File

@@ -72,9 +72,7 @@
"y": 240, "y": 240,
"wires": [ "wires": [
[ [
"3711eb142a27fd31", "3711eb142a27fd31"
"49e737145eab4f54",
"ca48c155d446edb2"
] ]
], ],
"inputLabels": [ "inputLabels": [
@@ -84,26 +82,6 @@
"aa" "aa"
] ]
}, },
{
"id": "88376950bf613f47",
"type": "function",
"z": "9fbdd3f57deafc08",
"name": "Format new user payload ",
"func": "var msg = {\n payload: {\n commands: [\n {\n \"command\": \"createClient\",\n \"username\": msg.payload.Username,\n \"password\": msg.payload.Password,\n \"clientid\": msg.payload.ClientID,\n\t\t\t \"textname\": msg.payload.Textname, \n \"textdescription\": msg.payload.Textdescription,\n\t\t\t \"groups\": [\n\t\t\t ],\n\t\t\t \"roles\": [\n\t\t\t\t { \"rolename\": msg.payload.Username.concat(\"_role\"), \"priority\": 0 }\n\t\t\t ]\n }\n ]\n }\n};\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 718,
"y": 320,
"wires": [
[
"2aecbce52ca97912"
]
]
},
{ {
"id": "2aecbce52ca97912", "id": "2aecbce52ca97912",
"type": "mqtt out", "type": "mqtt out",
@@ -118,8 +96,8 @@
"correl": "", "correl": "",
"expiry": "", "expiry": "",
"broker": "6c0c13a328d2378c", "broker": "6c0c13a328d2378c",
"x": 1286, "x": 1274,
"y": 480, "y": 552,
"wires": [] "wires": []
}, },
{ {
@@ -130,7 +108,7 @@
"scope": null, "scope": null,
"uncaught": false, "uncaught": false,
"x": 84, "x": 84,
"y": 88, "y": 176,
"wires": [ "wires": [
[ [
"8669f263b392e9db" "8669f263b392e9db"
@@ -153,7 +131,7 @@
"topic": "", "topic": "",
"name": "Error Notification", "name": "Error Notification",
"x": 698, "x": 698,
"y": 88, "y": 176,
"wires": [ "wires": [
[] []
] ]
@@ -179,7 +157,7 @@
"to": "", "to": "",
"reg": false, "reg": false,
"x": 386, "x": 386,
"y": 88, "y": 176,
"wires": [ "wires": [
[ [
"30603217455d8705" "30603217455d8705"
@@ -200,7 +178,7 @@
"rh": 0, "rh": 0,
"inputs": 0, "inputs": 0,
"x": 84, "x": 84,
"y": 856, "y": 616,
"wires": [ "wires": [
[ [
"4f1d82b81f042382", "4f1d82b81f042382",
@@ -230,8 +208,8 @@
"payloadType": "json", "payloadType": "json",
"topic": "$CONTROL/dynamic-security/v1", "topic": "$CONTROL/dynamic-security/v1",
"topicType": "msg", "topicType": "msg",
"x": 702, "x": 698,
"y": 760, "y": 800,
"wires": [ "wires": [
[ [
"2aecbce52ca97912", "2aecbce52ca97912",
@@ -252,7 +230,7 @@
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 396, "x": 396,
"y": 816, "y": 496,
"wires": [ "wires": [
[ [
"06393fdc9c737c57" "06393fdc9c737c57"
@@ -278,8 +256,8 @@
"topic": "options", "topic": "options",
"topicType": "msg", "topicType": "msg",
"className": "", "className": "",
"x": 336, "x": 456,
"y": 896, "y": 552,
"wires": [ "wires": [
[ [
"1d4c2df0e173d2e3", "1d4c2df0e173d2e3",
@@ -308,10 +286,9 @@
"topic": "topic", "topic": "topic",
"topicType": "msg", "topicType": "msg",
"x": 94, "x": 94,
"y": 536, "y": 432,
"wires": [ "wires": [
[ [
"545442acdd0b1a0d",
"4798c117a3d42c70" "4798c117a3d42c70"
] ]
] ]
@@ -329,122 +306,51 @@
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 688, "x": 688,
"y": 920, "y": 496,
"wires": [ "wires": [
[] []
] ]
}, },
{
"id": "d82c6b29558cbc01",
"type": "function",
"z": "9fbdd3f57deafc08",
"name": "Format delete role payload",
"func": "let user = flow.get(\"user\");\nvar msg = {\n payload: {\n commands: [\n {\n \"command\": \"deleteRole\",\n\t\t\t\t\"rolename\": user.concat(\"_role\")\n\t\t\t}\n\t\t]\n\t}\n}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 728,
"y": 592,
"wires": [
[
"2aecbce52ca97912"
]
]
},
{ {
"id": "3711eb142a27fd31", "id": "3711eb142a27fd31",
"type": "function", "type": "function",
"z": "9fbdd3f57deafc08", "z": "9fbdd3f57deafc08",
"name": "Format new role payload ", "name": "Make msg payload to create roles and users",
"func": "var msg = {\n payload: {\n commands: [\n {\n \"command\": \"createRole\",\n \"rolename\": msg.payload.Username.concat(\"_role\"),\n \"textname\": \"\", \n\t\t\t \"textdescription\": \"\", \n\t\t\t \"acls\": [\n { \"acltype\": \"publishClientSend\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true }\n ]\n }\n ]\n }\n};\nreturn msg;", "func": "var msg = {\n payload: {\n commands: [\n {\n \"command\": \"createRole\",\n \"rolename\": msg.payload.Username.concat(\"_role\"),\n \"textname\": \"\", \n\t\t\t \"textdescription\": \"\", \n\t\t\t \"acls\": [\n { \"acltype\": \"publishClientSend\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true }\n ]\n },\n {\n \"command\": \"createRole\",\n \"rolename\": msg.payload.Username.concat(\"_ase_role\"),\n \"textname\": \"\", \n\t\t\t \"textdescription\": \"\", \n\t\t\t \"acls\": [\n { \"acltype\": \"publishClientSend\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"publishClientReceive\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"subscribeLiteral\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"subscribePattern\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"unsubscribeLiteral\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"unsubscribePattern\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true }\n ]\n },\n {\n \"command\": \"createClient\",\n \"username\": msg.payload.Username,\n \"password\": msg.payload.Password,\n \"clientid\": msg.payload.ClientID,\n\t\t\t \"textname\": msg.payload.Textname, \n \"textdescription\": msg.payload.Textdescription,\n\t\t\t \"groups\": [\n\t\t\t ],\n\t\t\t \"roles\": [\n\t\t\t\t { \"rolename\": msg.payload.Username.concat(\"_role\"), \"priority\": 0 }\n\t\t\t ]\n },\n {\n \"command\": \"createClient\",\n \"username\": msg.payload.Username.concat(\"_ase\"),\n \"password\": msg.payload.Password.concat(\"AsE\"),\n \"clientid\": msg.payload.ClientID.concat(\"_ase\"),\n \"textname\": msg.payload.Textname.concat(\" ASE subscriber\"), \n \"textdescription\": msg.payload.Textdescription.concat(\" ASE subscriber\"),\n\t\t\t \"groups\": [\n\t\t\t ],\n\t\t\t \"roles\": [\n\t\t\t\t { \"rolename\": msg.payload.Username.concat(\"_ase_role\"), \"priority\": 0 }\n\t\t\t ]\n }\n ]\n }\n};\nreturn msg;",
"outputs": 1, "outputs": 1,
"timeout": 0, "timeout": 0,
"noerr": 0, "noerr": 0,
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 718, "x": 778,
"y": 216, "y": 240,
"wires": [ "wires": [
[ [
"2aecbce52ca97912" "2aecbce52ca97912"
] ]
] ]
}, },
{
"id": "49e737145eab4f54",
"type": "delay",
"z": "9fbdd3f57deafc08",
"name": "Delay user def. after group",
"pauseType": "delay",
"timeout": "500",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 376,
"y": 344,
"wires": [
[
"88376950bf613f47",
"94124ffc77e8335d"
]
]
},
{ {
"id": "4798c117a3d42c70", "id": "4798c117a3d42c70",
"type": "function", "type": "function",
"z": "9fbdd3f57deafc08", "z": "9fbdd3f57deafc08",
"name": "Format delete user payload", "name": "Make msg payload to delete role and user",
"func": "let user = flow.get(\"user\");\nvar msg = {\n payload: {\n commands: [\n {\n \"command\": \"deleteClient\",\n\t\t\t\t\"username\": user\n\t\t\t}\n\t\t]\n\t}\n}\nreturn msg;", "func": "let user = flow.get(\"user\");\nvar msg = {\n payload: {\n commands: [\n {\n \"command\": \"deleteClient\",\n\t\t\t\t\"username\": user\n\t\t\t},\n {\n \"command\": \"deleteRole\",\n\t\t\t\t\"rolename\": user.concat(\"_role\")\n\t\t\t}\n\t\t]\n\t}\n}\nreturn msg;",
"outputs": 1, "outputs": 1,
"timeout": 0, "timeout": 0,
"noerr": 0, "noerr": 0,
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 728, "x": 768,
"y": 536, "y": 432,
"wires": [ "wires": [
[ [
"2aecbce52ca97912" "2aecbce52ca97912"
] ]
] ]
}, },
{
"id": "545442acdd0b1a0d",
"type": "delay",
"z": "9fbdd3f57deafc08",
"name": "Delay role dele. after user",
"pauseType": "delay",
"timeout": "500",
"timeoutUnits": "milliseconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 366,
"y": 592,
"wires": [
[
"d82c6b29558cbc01"
]
]
},
{ {
"id": "8d3eb0f225aaba0e", "id": "8d3eb0f225aaba0e",
"type": "ui_button", "type": "ui_button",
@@ -466,7 +372,7 @@
"topic": "topic", "topic": "topic",
"topicType": "msg", "topicType": "msg",
"x": 94, "x": 94,
"y": 424, "y": 304,
"wires": [ "wires": [
[ [
"b97f2e66e9ea4702" "b97f2e66e9ea4702"
@@ -477,7 +383,7 @@
"id": "b97f2e66e9ea4702", "id": "b97f2e66e9ea4702",
"type": "function", "type": "function",
"z": "9fbdd3f57deafc08", "z": "9fbdd3f57deafc08",
"name": "Format disable user payload", "name": "Make msg payload to disable user",
"func": "let user = flow.get(\"user\");\nvar msg = {\n payload: {\n commands: [\n {\n \"command\": \"disableClient\",\n\t\t\t\t\"username\": user\n\t\t\t}\n\t\t]\n\t}\n}\nreturn msg;", "func": "let user = flow.get(\"user\");\nvar msg = {\n payload: {\n commands: [\n {\n \"command\": \"disableClient\",\n\t\t\t\t\"username\": user\n\t\t\t}\n\t\t]\n\t}\n}\nreturn msg;",
"outputs": 1, "outputs": 1,
"timeout": 0, "timeout": 0,
@@ -485,8 +391,8 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 728, "x": 748,
"y": 424, "y": 304,
"wires": [ "wires": [
[ [
"2aecbce52ca97912" "2aecbce52ca97912"
@@ -514,7 +420,7 @@
"topic": "topic", "topic": "topic",
"topicType": "msg", "topicType": "msg",
"x": 94, "x": 94,
"y": 480, "y": 368,
"wires": [ "wires": [
[ [
"1b7e77253c8b385d" "1b7e77253c8b385d"
@@ -525,7 +431,7 @@
"id": "1b7e77253c8b385d", "id": "1b7e77253c8b385d",
"type": "function", "type": "function",
"z": "9fbdd3f57deafc08", "z": "9fbdd3f57deafc08",
"name": "Format enable user payload", "name": "make msg payload to enable user",
"func": "let user = flow.get(\"user\");\nvar msg = {\n payload: {\n commands: [\n {\n \"command\": \"enableClient\",\n\t\t\t\t\"username\": user\n\t\t\t}\n\t\t]\n\t}\n}\nreturn msg;", "func": "let user = flow.get(\"user\");\nvar msg = {\n payload: {\n commands: [\n {\n \"command\": \"enableClient\",\n\t\t\t\t\"username\": user\n\t\t\t}\n\t\t]\n\t}\n}\nreturn msg;",
"outputs": 1, "outputs": 1,
"timeout": 0, "timeout": 0,
@@ -533,8 +439,8 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 728, "x": 748,
"y": 480, "y": 368,
"wires": [ "wires": [
[ [
"2aecbce52ca97912" "2aecbce52ca97912"
@@ -545,7 +451,7 @@
"id": "8bef671fa22d9d07", "id": "8bef671fa22d9d07",
"type": "function", "type": "function",
"z": "9fbdd3f57deafc08", "z": "9fbdd3f57deafc08",
"name": "Format get client info", "name": "Make msg payload to get client info",
"func": "let user = msg.payload;\nvar msg = {\n payload: {\n commands: [\n {\n \"command\": \"getClient\",\n\t\t\t\t\"username\": user\n\t\t\t}\n\t\t]\n\t}\n}\nreturn msg;", "func": "let user = msg.payload;\nvar msg = {\n payload: {\n commands: [\n {\n \"command\": \"getClient\",\n\t\t\t\t\"username\": user\n\t\t\t}\n\t\t]\n\t}\n}\nreturn msg;",
"outputs": 1, "outputs": 1,
"timeout": 0, "timeout": 0,
@@ -553,8 +459,8 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 708, "x": 748,
"y": 872, "y": 552,
"wires": [ "wires": [
[ [
"2aecbce52ca97912" "2aecbce52ca97912"
@@ -574,7 +480,7 @@
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 386, "x": 386,
"y": 976, "y": 680,
"wires": [ "wires": [
[ [
"934816df4e8f7fe2" "934816df4e8f7fe2"
@@ -594,7 +500,7 @@
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 346, "x": 346,
"y": 760, "y": 800,
"wires": [ "wires": [
[ [
"377b761521508bb9" "377b761521508bb9"
@@ -613,8 +519,8 @@
"initialize": "", "initialize": "",
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 688, "x": 336,
"y": 816, "y": 736,
"wires": [ "wires": [
[ [
"934816df4e8f7fe2" "934816df4e8f7fe2"
@@ -636,52 +542,12 @@
"resendOnRefresh": false, "resendOnRefresh": false,
"templateScope": "local", "templateScope": "local",
"className": "", "className": "",
"x": 944, "x": 668,
"y": 976, "y": 680,
"wires": [ "wires": [
[] []
] ]
}, },
{
"id": "ca48c155d446edb2",
"type": "function",
"z": "9fbdd3f57deafc08",
"name": "Format new ase role payload ",
"func": "var msg = {\n payload: {\n commands: [\n {\n \"command\": \"createRole\",\n \"rolename\": msg.payload.Username.concat(\"_ase_role\"),\n \"textname\": \"\", \n\t\t\t \"textdescription\": \"\", \n\t\t\t \"acls\": [\n { \"acltype\": \"publishClientSend\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"publishClientReceive\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"subscribeLiteral\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"subscribePattern\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"unsubscribeLiteral\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true },\n { \"acltype\": \"unsubscribePattern\", \"topic\": msg.payload.Username.concat(\"/#\"), \"priority\": 0, \"allow\": true }\n ]\n }\n ]\n }\n};\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 728,
"y": 264,
"wires": [
[
"2aecbce52ca97912"
]
]
},
{
"id": "94124ffc77e8335d",
"type": "function",
"z": "9fbdd3f57deafc08",
"name": "Format new ase user payload ",
"func": "var msg = {\n payload: {\n commands: [\n {\n \"command\": \"createClient\",\n \"username\": msg.payload.Username.concat(\"_ase\"),\n \"password\": msg.payload.Password.concat(\"AsE\"),\n \"clientid\": msg.payload.ClientID.concat(\"_ase\"),\n \"textname\": msg.payload.Textname.concat(\" ASE subscriber\"), \n \"textdescription\": msg.payload.Textdescription.concat(\" ASE subscriber\"),\n\t\t\t \"groups\": [\n\t\t\t ],\n\t\t\t \"roles\": [\n\t\t\t\t { \"rolename\": msg.payload.Username.concat(\"_ase_role\"), \"priority\": 0 }\n\t\t\t ]\n }\n ]\n }\n};\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 738,
"y": 368,
"wires": [
[
"2aecbce52ca97912"
]
]
},
{ {
"id": "5cc1500ac9ea0f30", "id": "5cc1500ac9ea0f30",
"type": "ui_ui_control", "type": "ui_ui_control",
@@ -689,7 +555,7 @@
"name": "UI action", "name": "UI action",
"events": "all", "events": "all",
"x": 84, "x": 84,
"y": 704, "y": 864,
"wires": [ "wires": [
[ [
"377b761521508bb9", "377b761521508bb9",
@@ -718,7 +584,7 @@
"topic": "$CONTROL/dynamic-security/v1", "topic": "$CONTROL/dynamic-security/v1",
"topicType": "msg", "topicType": "msg",
"x": 698, "x": 698,
"y": 648, "y": 864,
"wires": [ "wires": [
[ [
"2aecbce52ca97912" "2aecbce52ca97912"
@@ -738,7 +604,7 @@
"finalize": "", "finalize": "",
"libs": [], "libs": [],
"x": 386, "x": 386,
"y": 1032, "y": 616,
"wires": [ "wires": [
[ [
"b711bce152685dec" "b711bce152685dec"
@@ -760,8 +626,8 @@
"resendOnRefresh": false, "resendOnRefresh": false,
"templateScope": "local", "templateScope": "local",
"className": "", "className": "",
"x": 980, "x": 708,
"y": 1032, "y": 616,
"wires": [ "wires": [
[] []
] ]