From 58954059fab2a0fc544e334ea709f7355b5861ab Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 30 Dec 2024 10:50:22 +0100 Subject: [PATCH] corretto gestione clientid --- ase_user_nodered.json | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/ase_user_nodered.json b/ase_user_nodered.json index 45064a8..15b9644 100644 --- a/ase_user_nodered.json +++ b/ase_user_nodered.json @@ -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": "
\n
\n
Topic patterns:
\n
are case-sensitive
\n
level separator is: /
\n
single level wildcard is: +
\n
multi level wildcard is: #
\n
if not specified is defined as: username/#
\n
Client ID:
\n
specifying a client ID is really restrictive and binding\n
\n
", + "storeOutMessages": false, + "fwdInMessages": false, + "resendOnRefresh": false, + "templateScope": "local", + "className": "", + "x": 94, + "y": 208, + "wires": [ + [] + ] + }, { "id": "69ae86190d4eadd7", "type": "ui_group",