diff --git a/ase_user_nodered.json b/ase_user_nodered.json index fec0a3b..59a03a5 100644 --- a/ase_user_nodered.json +++ b/ase_user_nodered.json @@ -72,9 +72,7 @@ "y": 240, "wires": [ [ - "3711eb142a27fd31", - "49e737145eab4f54", - "ca48c155d446edb2" + "3711eb142a27fd31" ] ], "inputLabels": [ @@ -84,26 +82,6 @@ "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", "type": "mqtt out", @@ -118,8 +96,8 @@ "correl": "", "expiry": "", "broker": "6c0c13a328d2378c", - "x": 1286, - "y": 480, + "x": 1274, + "y": 552, "wires": [] }, { @@ -130,7 +108,7 @@ "scope": null, "uncaught": false, "x": 84, - "y": 88, + "y": 176, "wires": [ [ "8669f263b392e9db" @@ -153,7 +131,7 @@ "topic": "", "name": "Error Notification", "x": 698, - "y": 88, + "y": 176, "wires": [ [] ] @@ -179,7 +157,7 @@ "to": "", "reg": false, "x": 386, - "y": 88, + "y": 176, "wires": [ [ "30603217455d8705" @@ -200,7 +178,7 @@ "rh": 0, "inputs": 0, "x": 84, - "y": 856, + "y": 616, "wires": [ [ "4f1d82b81f042382", @@ -230,8 +208,8 @@ "payloadType": "json", "topic": "$CONTROL/dynamic-security/v1", "topicType": "msg", - "x": 702, - "y": 760, + "x": 698, + "y": 800, "wires": [ [ "2aecbce52ca97912", @@ -252,7 +230,7 @@ "finalize": "", "libs": [], "x": 396, - "y": 816, + "y": 496, "wires": [ [ "06393fdc9c737c57" @@ -278,8 +256,8 @@ "topic": "options", "topicType": "msg", "className": "", - "x": 336, - "y": 896, + "x": 456, + "y": 552, "wires": [ [ "1d4c2df0e173d2e3", @@ -308,10 +286,9 @@ "topic": "topic", "topicType": "msg", "x": 94, - "y": 536, + "y": 432, "wires": [ [ - "545442acdd0b1a0d", "4798c117a3d42c70" ] ] @@ -329,122 +306,51 @@ "finalize": "", "libs": [], "x": 688, - "y": 920, + "y": 496, "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", "type": "function", "z": "9fbdd3f57deafc08", - "name": "Format new role payload ", - "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;", + "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.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, "timeout": 0, "noerr": 0, "initialize": "", "finalize": "", "libs": [], - "x": 718, - "y": 216, + "x": 778, + "y": 240, "wires": [ [ "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", "type": "function", "z": "9fbdd3f57deafc08", - "name": "Format delete user payload", - "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;", + "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 {\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": 536, + "x": 768, + "y": 432, "wires": [ [ "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", "type": "ui_button", @@ -466,7 +372,7 @@ "topic": "topic", "topicType": "msg", "x": 94, - "y": 424, + "y": 304, "wires": [ [ "b97f2e66e9ea4702" @@ -477,7 +383,7 @@ "id": "b97f2e66e9ea4702", "type": "function", "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;", "outputs": 1, "timeout": 0, @@ -485,8 +391,8 @@ "initialize": "", "finalize": "", "libs": [], - "x": 728, - "y": 424, + "x": 748, + "y": 304, "wires": [ [ "2aecbce52ca97912" @@ -514,7 +420,7 @@ "topic": "topic", "topicType": "msg", "x": 94, - "y": 480, + "y": 368, "wires": [ [ "1b7e77253c8b385d" @@ -525,7 +431,7 @@ "id": "1b7e77253c8b385d", "type": "function", "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;", "outputs": 1, "timeout": 0, @@ -533,8 +439,8 @@ "initialize": "", "finalize": "", "libs": [], - "x": 728, - "y": 480, + "x": 748, + "y": 368, "wires": [ [ "2aecbce52ca97912" @@ -545,7 +451,7 @@ "id": "8bef671fa22d9d07", "type": "function", "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;", "outputs": 1, "timeout": 0, @@ -553,8 +459,8 @@ "initialize": "", "finalize": "", "libs": [], - "x": 708, - "y": 872, + "x": 748, + "y": 552, "wires": [ [ "2aecbce52ca97912" @@ -574,7 +480,7 @@ "finalize": "", "libs": [], "x": 386, - "y": 976, + "y": 680, "wires": [ [ "934816df4e8f7fe2" @@ -594,7 +500,7 @@ "finalize": "", "libs": [], "x": 346, - "y": 760, + "y": 800, "wires": [ [ "377b761521508bb9" @@ -613,8 +519,8 @@ "initialize": "", "finalize": "", "libs": [], - "x": 688, - "y": 816, + "x": 336, + "y": 736, "wires": [ [ "934816df4e8f7fe2" @@ -636,52 +542,12 @@ "resendOnRefresh": false, "templateScope": "local", "className": "", - "x": 944, - "y": 976, + "x": 668, + "y": 680, "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", "type": "ui_ui_control", @@ -689,7 +555,7 @@ "name": "UI action", "events": "all", "x": 84, - "y": 704, + "y": 864, "wires": [ [ "377b761521508bb9", @@ -718,7 +584,7 @@ "topic": "$CONTROL/dynamic-security/v1", "topicType": "msg", "x": 698, - "y": 648, + "y": 864, "wires": [ [ "2aecbce52ca97912" @@ -738,7 +604,7 @@ "finalize": "", "libs": [], "x": 386, - "y": 1032, + "y": 616, "wires": [ [ "b711bce152685dec" @@ -760,8 +626,8 @@ "resendOnRefresh": false, "templateScope": "local", "className": "", - "x": 980, - "y": 1032, + "x": 708, + "y": 616, "wires": [ [] ]