corretto gestione clientid

This commit is contained in:
2024-12-30 10:50:22 +01:00
parent 3366c7d4af
commit 58954059fa

View File

@@ -14,7 +14,7 @@
"name": "New user",
"label": "",
"group": "69ae86190d4eadd7",
"order": 2,
"order": 1,
"width": 0,
"height": 0,
"options": [
@@ -32,6 +32,20 @@
"required": true,
"rows": null
},
{
"label": "Topic patterns",
"value": "Topic",
"type": "text",
"required": false,
"rows": null
},
{
"label": "Client ID",
"value": "Client_id",
"type": "text",
"required": false,
"rows": null
},
{
"label": "Description title",
"value": "Textname",
@@ -50,6 +64,8 @@
"formValue": {
"Username": "",
"Password": "",
"Topic": "",
"Client_id": "",
"Textname": "",
"Textdescription": ""
},
@@ -310,7 +326,7 @@
"type": "function",
"z": "9fbdd3f57deafc08",
"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 \"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.Username.concat(\"_client\"),\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.Username.concat(\"_client_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;",
"func": "let Topic = \"\";\nif (msg.payload.Topic !== \"\") {\n Topic = msg.payload.Topic;\n} else {\n Topic = msg.payload.Username.concat(\"/#\");\n}\nlet Client_id = \"\";\nlet Client_id_ase = \"\";\nif (msg.payload.Client_id !== \"\") {\n Client_id = msg.payload.Client_id;\n Client_id_ase = msg.payload.Client_id.concat(\"_ase\");\n}\nvar 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\": Topic, \"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\": Topic, \"priority\": 0, \"allow\": true },\n { \"acltype\": \"publishClientReceive\", \"topic\": Topic, \"priority\": 0, \"allow\": true },\n { \"acltype\": \"subscribeLiteral\", \"topic\": Topic, \"priority\": 0, \"allow\": true },\n { \"acltype\": \"subscribePattern\", \"topic\": Topic, \"priority\": 0, \"allow\": true },\n { \"acltype\": \"unsubscribeLiteral\", \"topic\": Topic, \"priority\": 0, \"allow\": true },\n { \"acltype\": \"unsubscribePattern\", \"topic\": Topic, \"priority\": 0, \"allow\": true }\n ]\n },\n {\n \"command\": \"createClient\",\n \"username\": msg.payload.Username,\n \"password\": msg.payload.Password,\n \"clientid\": Client_id,\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\": Client_id_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,
@@ -662,7 +678,7 @@
"type": "function",
"z": "9fbdd3f57deafc08",
"name": "Make msg payload to add password to wallet",
"func": "var msg = {\n payload: {\n \"master_password\": \"Ase#2024@wallet!\",\n \"site\": msg.payload.Username.concat(\"_ase_site\"),\n \"username\": msg.payload.Username.concat(\"_ase\"),\n \"password\": msg.payload.Password.concat(\"AsE\")\n }\n}\nreturn msg;",
"func": "var msg = {\n payload: {\n \"master_password\": \"Ase#2024@wallet!\",\n \"site\": msg.payload.Username.concat(\"_ase_site\"),\n \"username\": msg.payload.Username.concat(\"_ase\"),\n \"password\": msg.payload.Password.concat(\"AsE\"),\n \"client_id\": msg.payload.Client_id.concat(\"_ase\")\n }\n}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
@@ -749,6 +765,27 @@
[]
]
},
{
"id": "344a6f33022692f2",
"type": "ui_template",
"z": "9fbdd3f57deafc08",
"group": "69ae86190d4eadd7",
"name": "Informations",
"order": 2,
"width": 0,
"height": 0,
"format": "<h6 style=\"font-weight: normal;\">\n <dl>\n <dt>Topic patterns:</dt>\n <dd>are case-sensitive</dd>\n <dd>level separator is: /</dd>\n <dd>single level wildcard is: +</dd>\n <dd>multi level wildcard is: #</dd>\n <dd>if not specified is defined as: username/#</dd>\n <dt>Client ID:</dt>\n <dd>specifying a client ID is really restrictive and binding\n </dl>\n</h6>",
"storeOutMessages": false,
"fwdInMessages": false,
"resendOnRefresh": false,
"templateScope": "local",
"className": "",
"x": 94,
"y": 208,
"wires": [
[]
]
},
{
"id": "69ae86190d4eadd7",
"type": "ui_group",