Files
nodered_ldap_self_service/flows.json
2023-08-13 12:02:41 +00:00

13763 lines
365 KiB
JSON

[
{
"id": "379c65a27117b46c",
"type": "tab",
"label": "Home",
"disabled": false,
"info": "\n"
},
{
"id": "42b9663b67dbd983",
"type": "tab",
"label": "Files",
"disabled": false,
"info": ""
},
{
"id": "4b5e055cd6b1e387",
"type": "tab",
"label": "Form Processing",
"disabled": false,
"info": ""
},
{
"id": "8179bf22c4c31682",
"type": "tab",
"label": "Functions",
"disabled": false,
"info": "# Functions\n\nContained within are reusable functions.",
"env": [
{
"name": "oidc",
"value": "false",
"type": "bool"
}
]
},
{
"id": "104f7938a23fe82f",
"type": "tab",
"label": "ITSM: GLPI",
"disabled": false,
"info": "",
"env": []
},
{
"id": "f6f2187d.f17ca8",
"type": "tab",
"label": "GLPI: FormCreator Automation",
"disabled": false,
"info": "# GLPI: FormCreator Automation\nThis flow search for the forms from the GLPI Plugin formcreator.\nOn finding a form, creates a ticket from that form."
},
{
"id": "24deed6b10f37f8f",
"type": "tab",
"label": "Cron",
"disabled": false,
"info": "# Cron\n\nThis flow contains any tasks that need to be run automagically",
"env": []
},
{
"id": "8ad5fe68ad170e2d",
"type": "group",
"z": "42b9663b67dbd983",
"name": "Form: Password Reset Questions",
"style": {
"stroke": "#0070c0",
"fill": "#bfdbef",
"label": true
},
"nodes": [
"02c4b9524d361ade",
"365ba07c1f4721ec",
"50339f503fd4878d",
"591e68e90f876dd1",
"7e95892f2f3454b7",
"9b89c2da58fccb8d",
"99a3fa75430c37f7",
"b2c917da9e845f7a",
"5798e39cbc3730ae",
"52dc13e1fdbf064d",
"d460346f6ae1673b"
],
"x": 154,
"y": 819,
"w": 1912,
"h": 122
},
{
"id": "ad0235dd3aa9eb7d",
"type": "group",
"z": "42b9663b67dbd983",
"name": "Form: Password Reset",
"style": {
"stroke": "#0070c0",
"fill": "#bfdbef",
"label": true
},
"nodes": [
"2dc375bf57ad8daa",
"1ce803b83ecf1593",
"f3b55ea2.f4d51",
"bf098463143ac8ad",
"457583335831f826",
"317930c679e833d1"
],
"x": 154,
"y": 679,
"w": 1092,
"h": 82
},
{
"id": "1c5c6c543ef047b6",
"type": "group",
"z": "42b9663b67dbd983",
"name": "Home Page",
"style": {
"stroke": "#0070c0",
"fill": "#bfdbef",
"label": true
},
"nodes": [
"0172c4a240b566fd",
"2106525aa2ebda7d",
"4ecc0631139b51e0",
"2f628eec7ca4b343"
],
"x": 154,
"y": 299,
"w": 812,
"h": 82
},
{
"id": "a64f4a2c837d5c3c",
"type": "group",
"z": "42b9663b67dbd983",
"name": "Error Page",
"style": {
"stroke": "#ffC000",
"fill": "#ffefbf",
"label": true
},
"nodes": [
"fd80fd11fc971e2c",
"274e4e6606cb379a",
"50d19d3ce5cf88f2",
"e5ae19af5f6d6561",
"781d23c946457b30"
],
"x": 1314,
"y": 19,
"w": 812,
"h": 122
},
{
"id": "a8e6ecf8ae37659e",
"type": "group",
"z": "42b9663b67dbd983",
"name": "HTML Page Template",
"style": {
"stroke": "#6f2fa0",
"fill": "#dbcbe7",
"label": true
},
"nodes": [
"3ec10e706b7bdc9d",
"8bdcaea510dbad1e",
"6fc3fe2eef3733b0"
],
"x": 154,
"y": 19,
"w": 692,
"h": 82
},
{
"id": "0abe2cea5975dcfd",
"type": "group",
"z": "42b9663b67dbd983",
"name": "Account Details",
"style": {
"stroke": "#0070c0",
"fill": "#bfdbef",
"label": true
},
"nodes": [
"e50f46892eabd2a5",
"46ef4f0739d6c1b8",
"1d661b2385de4b4a",
"c9323e9dc74c9203"
],
"x": 154,
"y": 419,
"w": 812,
"h": 82
},
{
"id": "07f2249ad4b7ccd0",
"type": "group",
"z": "42b9663b67dbd983",
"name": "Change Password",
"style": {
"stroke": "#0070c0",
"fill": "#bfdbef",
"label": true
},
"nodes": [
"b5cedc58894f707e",
"54b1149ed3d047fe",
"0c2e73371d4238a1",
"dcfa3cfba4eb1356"
],
"x": 154,
"y": 539,
"w": 812,
"h": 82
},
{
"id": "d3393ec35cb20a93",
"type": "group",
"z": "42b9663b67dbd983",
"name": "",
"style": {
"label": true,
"stroke": "#92d04f",
"fill": "#e3f3d3"
},
"nodes": [
"a702d39f0f3180de",
"3502d9cf69680b66",
"f1dcd5b6e32fb905"
],
"x": 164,
"y": 139,
"w": 462,
"h": 82
},
{
"id": "3e330505ea1e9cba",
"type": "group",
"z": "42b9663b67dbd983",
"name": "",
"style": {
"stroke": "#ff0000",
"fill": "#ffbfbf",
"label": true
},
"nodes": [
"c8c3f9c8f2ee35ee",
"602e7197835bba91",
"b664f0b9e6c17ad6"
],
"x": 674,
"y": 139,
"w": 492,
"h": 82
},
{
"id": "b447a1f691eb02df",
"type": "group",
"z": "42b9663b67dbd983",
"name": "Logout",
"style": {
"stroke": "#0070c0",
"fill": "#bfdbef",
"label": true
},
"nodes": [
"fb5301abffede979",
"1102d30391c745a6",
"988765ea19236af0",
"b19bd0621d479d66"
],
"x": 154,
"y": 999,
"w": 812,
"h": 82
},
{
"id": "0d96945ec7d069cb",
"type": "group",
"z": "8179bf22c4c31682",
"name": "Returns: dict, msg.hash",
"style": {
"label": true
},
"nodes": [
"0eeaba70b043a226",
"9c9c7bbd71c78d8e",
"43eebf1623f29074",
"8fadd3c4294a6939",
"540882a95f65754c"
],
"x": 94,
"y": 159,
"w": 972,
"h": 109.5
},
{
"id": "bcd2727d77a80ce3",
"type": "group",
"z": "8179bf22c4c31682",
"name": "Returns: string, msg.filename",
"style": {
"label": true
},
"nodes": [
"8c13bbcc86d93be8",
"a35b8cc53c276d62",
"858268a5d48a4486",
"998b007182d85455",
"0f2ff2f433d17eef"
],
"x": 94,
"y": 319,
"w": 912,
"h": 82
},
{
"id": "3b96ab15b1a54e33",
"type": "group",
"z": "4b5e055cd6b1e387",
"name": "Save Password Reset Questions",
"style": {
"stroke": "#ff0000",
"fill": "#7fb7df",
"label": true,
"color": "#ffff00"
},
"nodes": [
"bb8102ee0c070ff2",
"629b7df0515c7d83",
"a712f5e2056bbb1b",
"e9f50265154e4b83",
"1e3c2b23420d6e40",
"cee76f9f914dd0fa",
"fba98a197970c6ee",
"edf62fa2ca3cd812",
"5210f540af1eb2e5",
"96836f5a4c7c756c",
"6ec9911b7ad7d042",
"3f128f23d72e0492",
"7ce13238fa87d636",
"8b70b96b1f62a785",
"05accf0d9a6f0aa8"
],
"x": 134,
"y": 119
},
{
"id": "10a6c6b12749dda9",
"type": "group",
"z": "8179bf22c4c31682",
"name": "Returns: string msg.payload",
"style": {
"label": true
},
"nodes": [
"804feccd90b3276c",
"869469819396a632",
"c4e40d6f6678bb55",
"e62119d30db09cce"
],
"x": 94,
"y": 459,
"w": 832,
"h": 122
},
{
"id": "9b1493c4ae19a935",
"type": "group",
"z": "8179bf22c4c31682",
"name": "Workflow: ITSM Selection",
"style": {
"fill": "#e3f3d3",
"label": true
},
"nodes": [
"b8c9f1cf125efd2e",
"f5cae04225998e3b",
"002457f33834fc91",
"d4d1ce730aa1c15b",
"9858d84dc9d001be",
"6840ab77f76439db"
],
"x": 94,
"y": 639,
"w": 4744,
"h": 834,
"info": "# Input Format\n\n``` json\n{\n \"data\": {\n // contains the data for the action\n },\n \"action\": \"search\",\n \"action_for\": \"user\"\n}\n```"
},
{
"id": "a9d52eb951c5f037",
"type": "group",
"z": "4b5e055cd6b1e387",
"name": "Password Reset",
"style": {
"stroke": "#ff0000",
"fill": "#7fb7df",
"label": true,
"color": "#ffff00"
},
"nodes": [
"aea0a3398dafab4c",
"4cdbeaa8f5f3ddb7",
"82ccba0e0a13970a",
"d0dc259791aed430",
"d1b4f7ad9e8ea4f0",
"4cdebccc4a1f08ed",
"9926c0ba3f91aca8",
"02dc457b6549ba4e"
],
"x": 128,
"y": 333,
"info": "# Password Reset Form Processing\n\nThis group is responsible for processing the data from the password reset form. the basic workflow is as follows:\n\n- Form validation\n\n- LDAP User Search\n\n- ITSM User Search: if enabled searches for user within itsm system\n\n- ITSM Ticket: if enabled, creates ticket within ITSM system\n\n- Response: User notification\n"
},
{
"id": "bbd929c437c592ea",
"type": "group",
"z": "8179bf22c4c31682",
"name": "Authentication",
"style": {
"stroke": "#6f2fa0",
"fill": "#ffbfbf",
"label": true,
"color": "#777777"
},
"nodes": [
"f17afdbfc8c07889",
"6c790a65bbdc61a5",
"bc039e4b516adf37",
"627a72eee1e26ae6",
"177a7aba70483ccb",
"7225c45ad941c14f",
"e80aabc47c664088",
"724a142f28c3b6e4",
"f9550cdd015b52ae",
"cc33365c2aa59e35"
],
"x": 88,
"y": 1513,
"w": 2398,
"h": 954,
"info": "# Authentication\n\nThis group is responsible for ensuring the user is authorized to access the system. \nAny valid user account that authenticates to the system is authorized.\n\nFrom entry the next step in the process is cookie validation.\n\n## Input Data\n\nThis group has two paths for entry: \n\n1. Cookie Found - `msg.req.cookies.auth` key exists\n\n > Value is the session name.\n\n1. No Cookie Found - `msg.req.cookies.auth` key does not exist\n\n > User to be redirected to authentication method\n\n\n## Output Data\n\nThis group does not always not return data. \nData returned is only stored in `msg.session`.\n\n### Authenticated User\n\n`msg.session` is returned with the Authentication data contained. \n\nThis data will either be from a stored session (user authenticated previously) or be created via the authentication method.\nThere are two session types and they are `token` and `oauth2`. Session types are directly tied to the method of authentication.\n\n`msg.session` structure\n\n``` json\n{\n \"session\": {\n \"datetime\": \"{session expiry}\",\n \"type\": \"token\",\n \"user\"{\n \"username\": \"barny.gumble\",\n \"fname\": \"Barny\",\n \"lname\": \"Gumble\",\n \"mail\": \"barney.gumble@dinomail.com\"\n },\n \"oauth2\": {\n // Only if type=oauth2\n }\n }\n}\n\n```\n\n### Non-Authenticated User\n\nNo data is returned if the user is not authenticated. The absense of `msg.session` denotes an unauthenticated user.\n"
},
{
"id": "8a2206d682028469",
"type": "group",
"z": "42b9663b67dbd983",
"name": "Deveopment: Create Config File",
"style": {
"stroke": "#0070c0",
"fill": "#b797cf",
"label": true,
"color": "#000000"
},
"nodes": [
"e36b580c48d33ca0",
"497a482f9881a318",
"170b86b633c5ccd7",
"befac3bb99b2c2cc"
],
"x": 1314,
"y": 199,
"w": 752,
"h": 82
},
{
"id": "b994fe21efb223a9",
"type": "group",
"z": "379c65a27117b46c",
"name": "Automagic: Read Config file",
"style": {
"stroke": "#6f2fa0",
"fill": "#92d04f",
"label": true,
"color": "#ffff00"
},
"nodes": [
"c7ca92d48206b4b2",
"7df31641fc2fe59a",
"d109fc9821987d4f",
"e9127065159b9f0f",
"de01a4559aecf1c4",
"36cf43c754570ebd",
"1fb718bcdd65dc23",
"b73763bef878743f",
"a42b269766d80f74",
"842ade29052f7e66",
"3a543f0ac74f2891",
"f7ac866b468babe1",
"330ab008da58ac93",
"30efda375178f75f",
"8e72ce414e21b54f"
],
"x": 154,
"y": 99,
"w": 1142,
"h": 162
},
{
"id": "690ee27cf3eee484",
"type": "group",
"z": "42b9663b67dbd983",
"name": "Development: Create GLPI Config File",
"style": {
"stroke": "#0070c0",
"fill": "#b797cf",
"label": true,
"color": "#000000"
},
"nodes": [
"742f2f88646c543a",
"b54ff25c1e83a094",
"da2cb448945babee",
"d5627c7a12528006"
],
"x": 1314,
"y": 319,
"w": 772,
"h": 82
},
{
"id": "3b247f5e5d90963e",
"type": "group",
"z": "4b5e055cd6b1e387",
"name": "Change Password",
"style": {
"stroke": "#ff0000",
"fill": "#7fb7df",
"label": true,
"color": "#ffff00"
},
"nodes": [
"f8ec4a6290dc7e20",
"b75415bd2541b6df",
"a6c8721721fc267e",
"dba3741d6cc275c9",
"1e614fa32322f125",
"0c16bf9634323276"
],
"x": 128,
"y": 1133,
"info": "# Change User Password\n\nThis group contains the workflow to change a users password within LDAP.\n\nThe workflow has th following steps:\n\n1. Validate the form input\n\n1. Check that the new password fields match\n\n1. Confirm that the user entered \"Current Password\" matches what's in LDAP\n\n1. Change the users password within LDAP.\n"
},
{
"id": "9d9f0106c9ca9adf",
"type": "group",
"z": "379c65a27117b46c",
"name": "HTTP Server",
"style": {
"stroke": "#6f2fa0",
"fill": "#e3f3d3",
"label": true,
"color": "#000000"
},
"nodes": [
"cf2a3f84cb26a12c",
"755ff25cc29a08a1",
"ec8733df4e619869",
"8363d385051fc5c0",
"5706252b01492258",
"f3aa07300888f0a4",
"923268ee62c6a7db",
"f3aa07300888f0a4"
],
"x": 148,
"y": 313,
"w": 2944,
"h": 914,
"info": "# HTTP Server\n\nThis group provides the entrypoint for the application. it's broken down into further sub-groups that have their own individual responsibilities for processing a part of the HTTP servers workflow."
},
{
"id": "1b2783bfbb09503e",
"type": "group",
"z": "379c65a27117b46c",
"name": "Generate Auth Token",
"style": {
"stroke": "#0070c0",
"fill": "#addb7b",
"label": true,
"color": "#777777"
},
"nodes": [
"cb10034e64c15167",
"2f7615b7afa603aa",
"0107c5fd18462084",
"99a20ee6c80595d1",
"9bb0664a91ae9b97",
"f08e22fcc829d7b2",
"e350059bd801a5ab",
"702a6efc7be81391"
],
"x": 1354,
"y": 99,
"w": 1192,
"h": 122
},
{
"id": "b5d607bb9a62875f",
"type": "group",
"z": "24deed6b10f37f8f",
"name": "Trigger",
"style": {
"stroke": "#92d04f",
"fill": "#bfdbef",
"label": true,
"color": "#777777"
},
"nodes": [
"8e0d9bd8043dd53b",
"79e414f65b0e157b",
"8f313772a6e82e96",
"7e6699ce0159226a",
"61115e9c6e619dae",
"2d78bd7d0f411721",
"47f68cd20a8a528b",
"348b594ba5acb470",
"2bcdbb78b4e9181f"
],
"x": 54,
"y": 99
},
{
"id": "f7c0a5bee0e0df33",
"type": "group",
"z": "24deed6b10f37f8f",
"name": "Task: Clean Expired Tokens",
"style": {
"stroke": "#6f2fa0",
"fill": "#e3f3d3",
"label": true,
"color": "#777777"
},
"nodes": [
"8c5bb81ae0b14703",
"b2e1cdc1778fd936",
"f4da55e70a4f8c2c",
"44c01ba9bfc47ee8",
"55d7ad6e4958f882",
"bb5ccb49f1aa1036",
"f5f9e14092781e29",
"e25b155a2a29f16d",
"0f30a271d9c71f74",
"966779cca7297dec",
"a3bd692422c0fcf5",
"291408859782056d"
],
"x": 1274,
"y": 99
},
{
"id": "aea0a3398dafab4c",
"type": "group",
"z": "4b5e055cd6b1e387",
"g": "a9d52eb951c5f037",
"name": "Invalid User Response",
"style": {
"stroke": "#ff0000",
"fill": "#e3f3d3",
"label": true,
"color": "#777777"
},
"nodes": [
"72721ec69edf230f",
"8eca6e69b809790c"
],
"x": 2214,
"y": 999
},
{
"id": "9858d84dc9d001be",
"type": "group",
"z": "8179bf22c4c31682",
"g": "9b1493c4ae19a935",
"name": "GLPI",
"style": {
"fill": "#d1d1d1",
"label": true
},
"nodes": [
"160bc27f7530e52d",
"4cdb1540cd4c8744",
"0676d69c05236349",
"edbb6827a8b33085",
"ed0645c12f7435b2",
"d7dbd3970c891c33"
],
"x": 234,
"y": 813,
"w": 4578,
"h": 634
},
{
"id": "82ccba0e0a13970a",
"type": "group",
"z": "4b5e055cd6b1e387",
"g": "a9d52eb951c5f037",
"name": "Respond: Success",
"style": {
"stroke": "#6f2fa0",
"fill": "#e3f3d3",
"label": true
},
"nodes": [
"b1bc2e62654b04e2",
"f125e4c474dd2e5c"
],
"x": 2214,
"y": 899
},
{
"id": "d0dc259791aed430",
"type": "group",
"z": "4b5e055cd6b1e387",
"g": "a9d52eb951c5f037",
"name": "",
"style": {
"stroke": "#ff0000",
"fill": "#dbcbe7",
"label": true
},
"nodes": [
"9090daaf8a5892b0",
"853e6c15b5317007",
"142f9ce43cb63dd7",
"c710ba5a1416cfd8",
"073709e754dd98a3",
"ec52cbc3aa0fec25",
"13711f1826f83198"
],
"x": 574,
"y": 959
},
{
"id": "d1b4f7ad9e8ea4f0",
"type": "group",
"z": "4b5e055cd6b1e387",
"g": "a9d52eb951c5f037",
"name": "ITSM: Create Ticket",
"style": {
"stroke": "#ff0000",
"fill": "#dbcbe7",
"label": true
},
"nodes": [
"8dd7c0779eac59f0",
"00066fdae59433b8",
"93434028042529b8",
"ad66e8c05ee9a664",
"dce8db9b841faf7f",
"1a29880acc851ff5"
],
"x": 834,
"y": 819
},
{
"id": "4cdebccc4a1f08ed",
"type": "group",
"z": "4b5e055cd6b1e387",
"g": "a9d52eb951c5f037",
"name": "Search LDAP for user",
"style": {
"stroke": "#ff0000",
"fill": "#dbcbe7",
"label": true,
"color": "#777777"
},
"nodes": [
"c66c2a0c3817433c",
"c08e353c85cde934",
"311e184a2397eb19",
"faa5e7380a3092a2",
"fe1f0a50300d9224",
"b10e8a45ff44f80d",
"0308c42b587c3794",
"04818ddd8782b0a1",
"5cfc1e5277013397"
],
"x": 434,
"y": 519
},
{
"id": "9926c0ba3f91aca8",
"type": "group",
"z": "4b5e055cd6b1e387",
"g": "a9d52eb951c5f037",
"name": "ITSM Search",
"style": {
"stroke": "#ff0000",
"fill": "#dbcbe7",
"label": true
},
"nodes": [
"07ed8c85583c5a2e",
"4a4676456c27f256",
"a43bd1f944ef851c",
"eeb2b5a4e44d0c24",
"bc29c53d4ef04184",
"68628b6f32ec8b74",
"dbeedddce12963de",
"445623ba528e5df1",
"58d1108b52842808",
"f6fc2010d0af1e33"
],
"x": 574,
"y": 659
},
{
"id": "f8ec4a6290dc7e20",
"type": "group",
"z": "4b5e055cd6b1e387",
"g": "3b247f5e5d90963e",
"name": "Fetch Users Current Password",
"style": {
"stroke": "#ff0000",
"fill": "#dbcbe7",
"label": true,
"color": "#777777"
},
"nodes": [
"6ef14d9fb582d42e",
"30264cfad476079a",
"53fce6f461eec779",
"553d0da331015252",
"1619699cd34defb4",
"815ce9e0380e642f"
],
"x": 1074,
"y": 1159
},
{
"id": "cf2a3f84cb26a12c",
"type": "group",
"z": "379c65a27117b46c",
"g": "9d9f0106c9ca9adf",
"name": "Methods",
"style": {
"stroke": "#001f60",
"fill": "#ffbfbf",
"label": true,
"color": "#000000"
},
"nodes": [
"c80657a01a03012d",
"482740e98dda9d35",
"1e0841f1.ac68fe",
"5de0bbd4.6c8574",
"28713941e03e2bf5",
"adbfd4257ea1c230",
"c6360f6028e1512c"
],
"x": 174,
"y": 339,
"w": 532,
"h": 162,
"info": "# Methods\n\nThis sub-group is provides the http endpoints for the supported methods."
},
{
"id": "755ff25cc29a08a1",
"type": "group",
"z": "379c65a27117b46c",
"g": "9d9f0106c9ca9adf",
"name": "HTTP: Response",
"style": {
"stroke": "#ff0000",
"fill": "#dbcbe7",
"label": true,
"color": "#777777"
},
"nodes": [
"564400f9ec708521",
"e3043367c9a89a90",
"7db929503cf13635",
"3af3d2ae3286ffe0"
],
"x": 2494,
"y": 1079,
"w": 572,
"h": 122
},
{
"id": "ec8733df4e619869",
"type": "group",
"z": "379c65a27117b46c",
"g": "9d9f0106c9ca9adf",
"name": "Fetch Content",
"style": {
"stroke": "#0070c0",
"fill": "#bfdbef",
"label": true,
"color": "#000000"
},
"nodes": [
"5c05dcd676fcb02a",
"3ada862ebc07a99d",
"eae031f35d9a1e9e",
"4716d2916d6de31e",
"6e74b4a9a6b2dac8",
"6dc15589d8863139",
"1b121b9ecdf14084",
"ce290d371c7687b0",
"f2026962fb8dbb44",
"12a331c2a036a776",
"68f30ef53ebc2074",
"e2876b413d95adf9",
"cad86e4a717ecb58",
"333303604fa4ca01",
"52395c2abfc3c4f5",
"515f363d4f52f625",
"f4f56319a112fd86",
"1ee7757ab11df474",
"51a40870ef7d7eec",
"38b0e07a7e4cec42",
"7f4255c2cbe633a5",
"09cd31dda9fa3c50"
],
"x": 994,
"y": 559,
"w": 1292,
"h": 382,
"info": "# Fetch Content\n\nThis sub-group is the third step in the http workflow.\n\nOnce authorized, this workflow fetches the html content to be displayed within the browser.\n"
},
{
"id": "8363d385051fc5c0",
"type": "group",
"z": "379c65a27117b46c",
"g": "9d9f0106c9ca9adf",
"name": "Process Forms",
"style": {
"stroke": "#0070c0",
"fill": "#bfdbef",
"label": true,
"color": "#777777"
},
"nodes": [
"9cbf4027b4ab1c04",
"7c38c172df490c56",
"75913f37.78e6e",
"c0e5efefb8395690",
"7b62ec12651e478a",
"539d65720b0ff630",
"0eb8679ee25c4a34",
"3072b7c1fc0fd171",
"64c99b312f9c601c",
"9c92aaf02fee52b5",
"b7fde07e47cc852e",
"2189bf4e56868e51"
],
"x": 994,
"y": 979,
"w": 1292,
"h": 222,
"info": "# Process Forms\n\nThis sub-group is the third step in the http workflow.\n\nThis sub-group is responsible for processing any forms that are sent to the server.\n"
},
{
"id": "5706252b01492258",
"type": "group",
"z": "379c65a27117b46c",
"g": "9d9f0106c9ca9adf",
"name": "Fetch Styles/JS",
"style": {
"stroke": "#0070c0",
"fill": "#bfdbef",
"label": true,
"color": "#777777"
},
"nodes": [
"acd5690f3865f156",
"9f59194fecc0976a",
"15721605aaae8a86",
"eaeb9e2bfbe1dc95",
"1b1ca0bd7037ed0f",
"e72f08d8fc433bea",
"d81c931de5a63675",
"28ac8fd21056642c",
"195e7631e8660db0",
"e01b059fbd4cb54f",
"dce9621aba915bd4"
],
"x": 2374,
"y": 559,
"w": 692,
"h": 382,
"info": "# Fetch CSS / JS Files\n\nThis sub-group is the forth step in the http workflow, and specifically for HTTP/Get methods only.\n\nThis sub-group is responsible for fetching the appropriate CSS Style or JS Script that is required to fulfill the page request.\n"
},
{
"id": "f3aa07300888f0a4",
"type": "group",
"z": "379c65a27117b46c",
"g": "9d9f0106c9ca9adf",
"name": "HTTP Status Codes",
"style": {
"stroke": "#ffC000",
"fill": "#ffffbf",
"label": true,
"color": "#777777"
},
"nodes": [
"434d74f494db7cfc",
"d17512b4de05ede1",
"0ec392291c3fda2f",
"c43678f82d52004f",
"43603c3760e7ae56",
"5ad10ea406e2d3a7",
"c058f11dfd8d01b2"
],
"x": 174,
"y": 576.5,
"w": 692,
"h": 244.5
},
{
"id": "923268ee62c6a7db",
"type": "group",
"z": "379c65a27117b46c",
"g": "9d9f0106c9ca9adf",
"name": "Authorization Check",
"style": {
"stroke": "#ff0000",
"fill": "#ffcf3f",
"label": true,
"color": "#000000"
},
"nodes": [
"2f1060b185e19215",
"6728a85f5b044738",
"46d8b11bdef459aa",
"1c16492a7fe8e77b",
"e282aea37a90acdc",
"5f2f87eeebd5bf6e"
],
"x": 994,
"y": 339,
"w": 932,
"h": 162,
"info": "# Authorization Check\n\nThis group is the second step within the http workflow. \n\nThis sub-group is responsible for ensuring that **ALL** requests to the http endpoint are authorized.\n"
},
{
"id": "02dc457b6549ba4e",
"type": "group",
"z": "4b5e055cd6b1e387",
"g": "a9d52eb951c5f037",
"name": "Form Validation",
"style": {
"stroke": "#ff0000",
"fill": "#ffffbf",
"label": true,
"color": "#777777"
},
"nodes": [
"cdde8116fcac6e5d",
"0354e185d6df3087",
"c7b7522a20abbb47",
"3e44bc1a5e60ec3d"
],
"x": 154,
"y": 359,
"info": "# Password Reset Form Processing\n\nThis sub-group is the fist step in processing the password reset form.\n\nfor the form workflow to continue processing the form, the form user details entered, must match the authenticated users details. The details **must** match, as without this matching and by design this form can reset the password of any user where the details are correcct."
},
{
"id": "dba3741d6cc275c9",
"type": "group",
"z": "4b5e055cd6b1e387",
"g": "3b247f5e5d90963e",
"name": "Form Validation",
"style": {
"label": true,
"stroke": "#ff0000",
"fill": "#ffffbf",
"color": "#777777"
},
"nodes": [
"98364b7271054017",
"1df8ab6bb55ff621",
"0239e19c34a9baaa",
"0efd3333091c9999"
],
"x": 154,
"y": 1159,
"info": "# Form Validation\n\nValidate the password change form."
},
{
"id": "1e614fa32322f125",
"type": "group",
"z": "4b5e055cd6b1e387",
"g": "3b247f5e5d90963e",
"name": "Check Current Password",
"style": {
"stroke": "#ff0000",
"fill": "#dbcbe7",
"label": true,
"color": "#777777"
},
"nodes": [
"23292bc7d78b9d1d",
"ffaae19e230436cf",
"f17566766d0b5a53",
"abef97c0bb13b432",
"aab2d165deacdab6",
"c57cf198943aef16"
],
"x": 2214,
"y": 1159,
"info": "# Check Current Password\n\nConfirm that the user entered \"current password\" matches the LDAP value"
},
{
"id": "0c16bf9634323276",
"type": "group",
"z": "4b5e055cd6b1e387",
"g": "3b247f5e5d90963e",
"name": "Change User Password",
"style": {
"stroke": "#ff0000",
"fill": "#dbcbe7",
"label": true,
"color": "#777777"
},
"nodes": [
"f093762ba0afe7d2",
"53df7c8ab13e33de",
"7b9797b6bc354e56",
"e7fa19cf8785fd90",
"f16ae7601e3dce19",
"f8b9e1b1537129ec",
"5897178ac3448e41"
],
"x": 3394,
"y": 1159,
"info": "# Change User Password\n\nChange the users password within LDAP"
},
{
"id": "ed0645c12f7435b2",
"type": "group",
"z": "8179bf22c4c31682",
"g": "9858d84dc9d001be",
"name": "Create a Ticket",
"style": {
"fill": "#dbcbe7",
"label": true
},
"nodes": [
"d4de6eab89782579",
"d20869bcacd7b0fd",
"525cc01f4d41ae0b",
"45d7aa8b4b386bb7",
"2663cccd5d6ca575",
"6492bc8146326691",
"e363219f4309eedb",
"c6c64453fc61e50f",
"5eda003868c5e354",
"2545718f1853e084",
"1840577fd414a84d",
"ed5a0fab59b28faa",
"85fa24886e126df7",
"246331e1c052e1f8",
"e8f257b38aa4d749",
"f57f557a25d166b7",
"aa5626527a9df701",
"5a961504d7ca5be3"
],
"x": 754,
"y": 1051.5,
"w": 4032,
"h": 369.5
},
{
"id": "d7dbd3970c891c33",
"type": "group",
"z": "8179bf22c4c31682",
"g": "9858d84dc9d001be",
"name": "Search for User",
"style": {
"fill": "#dbcbe7",
"label": true
},
"nodes": [
"669724fdc876385d",
"65c3e138bbcd8b3a",
"269cbacf5274d6d8",
"42f157ed01b737f4",
"33d710f97adb5298",
"6aac3151138c4af9",
"587b497ce06d683f",
"f76da20ac475cf64",
"a9cfd4c1413c7ec6",
"a888a2ed9a053acc"
],
"x": 754,
"y": 839,
"w": 1412,
"h": 182
},
{
"id": "85fa24886e126df7",
"type": "group",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"name": "Ticket Solution",
"style": {
"stroke": "#6f2fa0",
"fill": "#bfdbef",
"label": true
},
"nodes": [
"40208ed719417cac",
"803a8b65fc7a5087",
"96766518a046855d",
"242b471ad711a4f1",
"1305e2f195ec5ede",
"285f57c0fee687a1"
],
"x": 2234,
"y": 1259,
"w": 1472,
"h": 82
},
{
"id": "aa5626527a9df701",
"type": "group",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"name": "Ticket Task",
"style": {
"stroke": "#6f2fa0",
"fill": "#bfdbef",
"label": true
},
"nodes": [
"351440700b3e2ecc",
"f17ccfa845461657"
],
"x": 2228,
"y": 1093,
"w": 2204,
"h": 134
},
{
"id": "351440700b3e2ecc",
"type": "group",
"z": "8179bf22c4c31682",
"g": "aa5626527a9df701",
"name": "Create",
"style": {
"stroke": "#001f60",
"fill": "#e3f3d3",
"label": true,
"color": "#777777"
},
"nodes": [
"fb6750555645b873",
"e0660324da4581dd"
],
"x": 2254,
"y": 1119,
"w": 492,
"h": 82
},
{
"id": "f17ccfa845461657",
"type": "group",
"z": "8179bf22c4c31682",
"g": "aa5626527a9df701",
"name": "Update",
"style": {
"stroke": "#001f60",
"fill": "#e3f3d3",
"label": true,
"color": "#777777"
},
"nodes": [
"eacbafc05d06b95a",
"76cd564b69443419",
"ca1b9c48c3c0c522",
"d64e9c631ee7ec87",
"cafa50da13d9e5d9",
"c2f8e99492223cfb",
"fdf014eff1962329"
],
"x": 2794,
"y": 1119,
"w": 1612,
"h": 82
},
{
"id": "177a7aba70483ccb",
"type": "group",
"z": "8179bf22c4c31682",
"g": "bbd929c437c592ea",
"name": "Cookie Validation",
"style": {
"stroke": "#ffC000",
"fill": "#ffffbf",
"label": true,
"color": "#777777"
},
"nodes": [
"bcaed4334222c14a"
],
"x": 114,
"y": 1539,
"w": 1152,
"h": 182
},
{
"id": "cc33365c2aa59e35",
"type": "group",
"z": "8179bf22c4c31682",
"g": "bbd929c437c592ea",
"name": "Token",
"style": {
"stroke": "#0070c0",
"fill": "#ffffbf",
"label": true
},
"nodes": [
"7ccb5fae05b5c6a6",
"32fbc01a34859498",
"c10e09e4bfbddfd7",
"53a5ee55ee916cec",
"95c7670ef9039295",
"75c44e5f7f101beb",
"a4bc5830daf9801a"
],
"x": 654,
"y": 1768,
"w": 1232,
"h": 338
},
{
"id": "75c44e5f7f101beb",
"type": "group",
"z": "8179bf22c4c31682",
"g": "cc33365c2aa59e35",
"name": "Token Session",
"style": {
"label": true,
"stroke": "#6f2fa0",
"fill": "#bfdbef"
},
"nodes": [
"42a1e057dda56f95",
"366892fde876296f",
"8b1fef39c34f5513",
"95f44fbb0ddd39fc"
],
"x": 894,
"y": 1799,
"w": 672,
"h": 122
},
{
"id": "7225c45ad941c14f",
"type": "group",
"z": "8179bf22c4c31682",
"g": "bbd929c437c592ea",
"name": "Oauth2",
"style": {
"stroke": "#0070c0",
"fill": "#ffffbf",
"label": true,
"color": "#777777"
},
"nodes": [
"9f416bc258c1a60c",
"dbe86357f31c79d1",
"1fe34e17a81dce9e",
"bc5ca736a6e324e5",
"8964a5bda9eb7113",
"60a97c78327c3a6a",
"8ad6190854001584",
"21ec376b58ac0c54"
],
"x": 654,
"y": 2159,
"w": 1232,
"h": 282
},
{
"id": "bcaed4334222c14a",
"type": "group",
"z": "8179bf22c4c31682",
"g": "177a7aba70483ccb",
"name": "Cookie Validation",
"style": {
"stroke": "#6f2fa0",
"fill": "#bfdbef",
"label": true,
"color": "#777777"
},
"nodes": [
"33f25da80ef87e72",
"73b63d7562fe9cce",
"e897aec8ea7c81c5",
"9c05ca2751f619a7",
"2dee51842e868755",
"2a858bd15a2d257e",
"f20711a44b43b7d4",
"9cbf4beaceba5255",
"da0811fbd7963934"
],
"x": 654,
"y": 1539,
"w": 1152,
"h": 182,
"info": "# Cookie Validation\n\nThis path is always executed and is the first step in the authentication workflow. \n\nThis groups workflow is as follows:\n\n1. fetch the value of `msg.req.cookies.auth`\n\n * if empty/null. User needs to logon\n\n * value found, goto step 2\n\n2. open the session file using the value of `msg.req.cookies.auth`\n\n3. set `msg.session` with the contents of the file\n\n4. Route for further validation based off of type `oauth2` or `token`.\n\nthe existance of path `msg.req.cookies.auth` alludes to a user that has authenticated previously. \nWhilst this value could be guessed, it is highly unlikely.\n"
},
{
"id": "dbe86357f31c79d1",
"type": "group",
"z": "8179bf22c4c31682",
"g": "7225c45ad941c14f",
"name": "Oauth2: Session",
"style": {
"stroke": "#6f2fa0",
"fill": "#bfdbef",
"label": true,
"color": "#777777"
},
"nodes": [
"20aae4d90a07f156"
],
"x": 914,
"y": 2299,
"w": 212,
"h": 82
},
{
"id": "5798e39cbc3730ae",
"type": "junction",
"z": "42b9663b67dbd983",
"g": "8ad5fe68ad170e2d",
"x": 1240,
"y": 860,
"wires": [
[
"365ba07c1f4721ec"
]
]
},
{
"id": "4ab2787bb0227121",
"type": "junction",
"z": "104f7938a23fe82f",
"x": 820,
"y": 220,
"wires": [
[
"b3adfbc257af34d9"
]
]
},
{
"id": "f48665a4a0c87ccf",
"type": "junction",
"z": "104f7938a23fe82f",
"x": 2220,
"y": 280,
"wires": [
[
"e65438fd63bf5834"
]
]
},
{
"id": "e2fdc9ac8f0f5378",
"type": "junction",
"z": "104f7938a23fe82f",
"x": 1540,
"y": 280,
"wires": [
[
"f48665a4a0c87ccf"
]
]
},
{
"id": "b365499ab7271965",
"type": "junction",
"z": "104f7938a23fe82f",
"x": 1900,
"y": 180,
"wires": [
[
"e6062222b53b3146"
]
]
},
{
"id": "e6062222b53b3146",
"type": "junction",
"z": "104f7938a23fe82f",
"x": 2140,
"y": 180,
"wires": [
[
"f48665a4a0c87ccf"
]
]
},
{
"id": "4c730b98279aaca6",
"type": "junction",
"z": "104f7938a23fe82f",
"x": 420,
"y": 220,
"wires": [
[
"4ab2787bb0227121",
"0097abc4a9b09076"
]
]
},
{
"id": "a740ac24fa947f73",
"type": "junction",
"z": "104f7938a23fe82f",
"x": 240,
"y": 220,
"wires": [
[
"ab1b24f61ae7f3bf",
"4c730b98279aaca6"
]
]
},
{
"id": "ce93ad07095d87d3",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 1120,
"y": 1920,
"wires": [
[
"d4dcc73bbe878f42"
]
]
},
{
"id": "bab95cf5ba3d6045",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 820,
"y": 1840,
"wires": [
[
"d4dcc73bbe878f42",
"836dca1c83616f32"
]
]
},
{
"id": "ce4de75bc712f124",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 820,
"y": 1900,
"wires": [
[
"ebb2a01cac9a803d",
"607f24e3f91dff90"
]
]
},
{
"id": "607f24e3f91dff90",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 880,
"y": 1920,
"wires": [
[
"ce93ad07095d87d3"
]
]
},
{
"id": "ad563b1612f320ce",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 820,
"y": 1940,
"wires": [
[
"3944fbf533097cbb",
"607f24e3f91dff90"
]
]
},
{
"id": "bf6a0883e2c6fa86",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 3520,
"y": 700,
"wires": [
[
"9b78dc70ba04be52",
"7d597c9f95237aec"
]
]
},
{
"id": "e0b3838ab709561b",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 4720,
"y": 420,
"wires": [
[
"a06872fd8512eb8d",
"7cd8e1fefd5dd694"
]
]
},
{
"id": "7d597c9f95237aec",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 3800,
"y": 700,
"wires": [
[
"7cd8e1fefd5dd694"
]
]
},
{
"id": "9b78dc70ba04be52",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 3800,
"y": 740,
"wires": [
[
"405728494cdf7f87"
]
]
},
{
"id": "7cd8e1fefd5dd694",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 4780,
"y": 700,
"wires": [
[
"bcdb9f8a74cd2414"
]
]
},
{
"id": "596b03adcd307cb4",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 4560,
"y": 540,
"wires": [
[
"7cd8e1fefd5dd694"
]
]
},
{
"id": "e5548020922347cc",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 3300,
"y": 2120,
"wires": [
[
"7bb0fa06d2b81ebf"
]
]
},
{
"id": "8fdb88fa979041c2",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 180,
"y": 1620,
"wires": [
[
"e370037f2b9ae9a6",
"109cb443e3b18552"
]
]
},
{
"id": "56d5a39010b82e94",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 500,
"y": 1420,
"wires": [
[
"d5037ce5a29693fc"
]
]
},
{
"id": "eb6eecd9d940aecb",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 80,
"y": 1500,
"wires": [
[
"8fdb88fa979041c2"
]
]
},
{
"id": "46dd694a18a599c9",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 1040,
"y": 1460,
"wires": [
[
"eb6eecd9d940aecb"
]
]
},
{
"id": "facaa6a7395e5d7f",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 2600,
"y": 2140,
"wires": [
[
"f0b8ea2876129114",
"4b51a5788a45d420",
"f710a0c68b11ee76",
"04d760f9b1988f4b",
"baa846245c4d19de",
"432e2ad61476d045"
]
]
},
{
"id": "e363219f4309eedb",
"type": "junction",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"x": 2160,
"y": 1240,
"wires": [
[
"803a8b65fc7a5087"
]
]
},
{
"id": "2545718f1853e084",
"type": "junction",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"x": 2160,
"y": 1160,
"wires": [
[
"fb6750555645b873"
]
]
},
{
"id": "53b1c5bbed90265f",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 820,
"y": 1980,
"wires": [
[
"0bf3afb49b551d9c",
"ab69851f2d76cc5e"
]
]
},
{
"id": "ab69851f2d76cc5e",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 1060,
"y": 1980,
"wires": [
[
"ce93ad07095d87d3"
]
]
},
{
"id": "f57f557a25d166b7",
"type": "junction",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"x": 4480,
"y": 1340,
"wires": [
[
"5eda003868c5e354",
"e8f257b38aa4d749"
]
]
},
{
"id": "1840577fd414a84d",
"type": "junction",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"x": 2160,
"y": 1320,
"wires": [
[
"c6c64453fc61e50f"
]
]
},
{
"id": "c6c64453fc61e50f",
"type": "junction",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"x": 2260,
"y": 1360,
"wires": [
[
"5a961504d7ca5be3"
]
]
},
{
"id": "3a543f0ac74f2891",
"type": "junction",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"x": 440,
"y": 180,
"wires": [
[
"30efda375178f75f",
"8e72ce414e21b54f"
]
]
},
{
"id": "f7ac866b468babe1",
"type": "junction",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"x": 1050,
"y": 140,
"wires": [
[
"de01a4559aecf1c4"
]
]
},
{
"id": "f4f56319a112fd86",
"type": "junction",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"x": 1980,
"y": 800,
"wires": [
[
"68f30ef53ebc2074"
]
]
},
{
"id": "1ee7757ab11df474",
"type": "junction",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"x": 1980,
"y": 820,
"wires": [
[
"12a331c2a036a776",
"f2026962fb8dbb44"
]
]
},
{
"id": "51a40870ef7d7eec",
"type": "junction",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"x": 1980,
"y": 720,
"wires": [
[
"cad86e4a717ecb58"
]
]
},
{
"id": "38b0e07a7e4cec42",
"type": "junction",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"x": 1980,
"y": 680,
"wires": [
[
"333303604fa4ca01"
]
]
},
{
"id": "7f4255c2cbe633a5",
"type": "junction",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"x": 1980,
"y": 640,
"wires": [
[
"52395c2abfc3c4f5"
]
]
},
{
"id": "09cd31dda9fa3c50",
"type": "junction",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"x": 1980,
"y": 600,
"wires": [
[
"515f363d4f52f625"
]
]
},
{
"id": "195e7631e8660db0",
"type": "junction",
"z": "379c65a27117b46c",
"g": "5706252b01492258",
"x": 2780,
"y": 680,
"wires": [
[
"eaeb9e2bfbe1dc95",
"15721605aaae8a86"
]
]
},
{
"id": "e01b059fbd4cb54f",
"type": "junction",
"z": "379c65a27117b46c",
"g": "5706252b01492258",
"x": 2780,
"y": 740,
"wires": [
[
"1b1ca0bd7037ed0f",
"e72f08d8fc433bea"
]
]
},
{
"id": "dce9621aba915bd4",
"type": "junction",
"z": "379c65a27117b46c",
"g": "5706252b01492258",
"x": 2780,
"y": 800,
"wires": [
[
"28ac8fd21056642c",
"d81c931de5a63675"
]
]
},
{
"id": "adbfd4257ea1c230",
"type": "junction",
"z": "379c65a27117b46c",
"g": "cf2a3f84cb26a12c",
"x": 360,
"y": 420,
"wires": [
[
"c6360f6028e1512c"
]
]
},
{
"id": "966779cca7297dec",
"type": "junction",
"z": "24deed6b10f37f8f",
"g": "f7c0a5bee0e0df33",
"x": 2780,
"y": 200,
"wires": [
[
"0f30a271d9c71f74"
]
]
},
{
"id": "8d9762cb45d1a09d",
"type": "junction",
"z": "f6f2187d.f17ca8",
"x": 3020,
"y": 2040,
"wires": [
[
"e5548020922347cc"
]
]
},
{
"id": "291408859782056d",
"type": "junction",
"z": "24deed6b10f37f8f",
"g": "f7c0a5bee0e0df33",
"x": 2280,
"y": 200,
"wires": [
[
"966779cca7297dec"
]
]
},
{
"id": "160d0b5ed597dc51",
"type": "ldap",
"host": "ldap://ldap",
"port": "389"
},
{
"id": "1e0841f1.ac68fe",
"type": "http in",
"z": "379c65a27117b46c",
"g": "cf2a3f84cb26a12c",
"name": "",
"url": "*",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 250,
"y": 400,
"wires": [
[
"c80657a01a03012d",
"adbfd4257ea1c230"
]
]
},
{
"id": "1b121b9ecdf14084",
"type": "switch",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "Routing",
"property": " $split(req._parsedUrl.pathname, '/', limit)[1]",
"propertyType": "jsonata",
"rules": [
{
"t": "empty"
},
{
"t": "eq",
"v": "details",
"vt": "str"
},
{
"t": "eq",
"v": "changepassword",
"vt": "str"
},
{
"t": "eq",
"v": "passwordreset",
"vt": "str"
},
{
"t": "eq",
"v": "passwordquestions",
"vt": "str"
},
{
"t": "eq",
"v": "logout",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 7,
"x": 1740,
"y": 700,
"wires": [
[
"09cd31dda9fa3c50"
],
[
"7f4255c2cbe633a5"
],
[
"38b0e07a7e4cec42"
],
[
"51a40870ef7d7eec"
],
[
"e2876b413d95adf9"
],
[
"f4f56319a112fd86"
],
[
"1ee7757ab11df474"
]
]
},
{
"id": "6dc15589d8863139",
"type": "debug",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "HTTP / Get",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1750,
"y": 620,
"wires": []
},
{
"id": "eae031f35d9a1e9e",
"type": "change",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "",
"rules": [
{
"t": "set",
"p": "client",
"pt": "msg",
"to": "req.connection.remoteAddress",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1480,
"y": 700,
"wires": [
[
"6dc15589d8863139",
"1b121b9ecdf14084"
]
]
},
{
"id": "e2876b413d95adf9",
"type": "link out",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "Page: Password Reset Questions",
"mode": "link",
"links": [
"02c4b9524d361ade",
"b202e09db45b339a"
],
"x": 2120,
"y": 760,
"wires": [],
"l": true
},
{
"id": "cad86e4a717ecb58",
"type": "link out",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "Page: Password Reset",
"mode": "link",
"links": [
"2dc375bf57ad8daa",
"86d0cb173ed572b5"
],
"x": 2160,
"y": 720,
"wires": [],
"l": true
},
{
"id": "5de0bbd4.6c8574",
"type": "http in",
"z": "379c65a27117b46c",
"g": "cf2a3f84cb26a12c",
"name": "",
"url": "*",
"method": "post",
"upload": false,
"swaggerDoc": "",
"x": 250,
"y": 440,
"wires": [
[
"482740e98dda9d35",
"adbfd4257ea1c230"
]
]
},
{
"id": "75913f37.78e6e",
"type": "json",
"z": "379c65a27117b46c",
"g": "8363d385051fc5c0",
"name": "",
"property": "payload",
"action": "obj",
"pretty": false,
"x": 1490,
"y": 1080,
"wires": [
[
"539d65720b0ff630"
]
]
},
{
"id": "482740e98dda9d35",
"type": "debug",
"z": "379c65a27117b46c",
"g": "cf2a3f84cb26a12c",
"name": "HTTP / Post",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 430,
"y": 460,
"wires": []
},
{
"id": "3072b7c1fc0fd171",
"type": "debug",
"z": "379c65a27117b46c",
"g": "8363d385051fc5c0",
"name": "debug 69",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1900,
"y": 1140,
"wires": []
},
{
"id": "539d65720b0ff630",
"type": "change",
"z": "379c65a27117b46c",
"g": "8363d385051fc5c0",
"name": "",
"rules": [
{
"t": "set",
"p": "http",
"pt": "msg",
"to": "{}",
"tot": "jsonata"
},
{
"t": "set",
"p": "http.client",
"pt": "msg",
"to": "req.connection.remoteAddress",
"tot": "msg"
},
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "http.form",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1640,
"y": 1080,
"wires": [
[
"0eb8679ee25c4a34",
"3072b7c1fc0fd171"
]
]
},
{
"id": "0eb8679ee25c4a34",
"type": "switch",
"z": "379c65a27117b46c",
"g": "8363d385051fc5c0",
"name": "Routing",
"property": " $split(req._parsedUrl.pathname, '/')[1]",
"propertyType": "jsonata",
"rules": [
{
"t": "eq",
"v": "passwordreset",
"vt": "str"
},
{
"t": "eq",
"v": "passwordquestions",
"vt": "str"
},
{
"t": "eq",
"v": "passwordchange",
"vt": "str"
},
{
"t": "eq",
"v": "updatedetails",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 5,
"x": 1900,
"y": 1100,
"wires": [
[
"b7fde07e47cc852e",
"2189bf4e56868e51"
],
[
"9c92aaf02fee52b5"
],
[
"64c99b312f9c601c"
],
[],
[]
]
},
{
"id": "b7fde07e47cc852e",
"type": "link out",
"z": "379c65a27117b46c",
"g": "8363d385051fc5c0",
"name": "Password Reset",
"mode": "link",
"links": [
"cdde8116fcac6e5d"
],
"x": 2100,
"y": 1060,
"wires": [],
"l": true
},
{
"id": "9c92aaf02fee52b5",
"type": "link out",
"z": "379c65a27117b46c",
"g": "8363d385051fc5c0",
"name": "Password Reset Questions",
"mode": "link",
"links": [
"bb8102ee0c070ff2"
],
"x": 2140,
"y": 1100,
"wires": [],
"l": true
},
{
"id": "7db929503cf13635",
"type": "link in",
"z": "379c65a27117b46c",
"g": "755ff25cc29a08a1",
"name": "HTTP: Response",
"links": [
"0c2e73371d4238a1",
"1d661b2385de4b4a",
"4ecc0631139b51e0",
"50339f503fd4878d",
"96836f5a4c7c756c",
"988765ea19236af0",
"b664f0b9e6c17ad6",
"bf098463143ac8ad",
"e5ae19af5f6d6561",
"f1dcd5b6e32fb905",
"4cdbeaa8f5f3ddb7",
"b54c063d6519c463",
"a6c8721721fc267e",
"960bf96fa54c65c0"
],
"x": 2600,
"y": 1160,
"wires": [
[
"3af3d2ae3286ffe0"
]
],
"l": true
},
{
"id": "e3043367c9a89a90",
"type": "http response",
"z": "379c65a27117b46c",
"g": "755ff25cc29a08a1",
"name": "HTTP Response",
"statusCode": "",
"headers": {},
"x": 2940,
"y": 1160,
"wires": []
},
{
"id": "564400f9ec708521",
"type": "debug",
"z": "379c65a27117b46c",
"g": "755ff25cc29a08a1",
"name": "HTTP / Response",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2930,
"y": 1120,
"wires": []
},
{
"id": "9f59194fecc0976a",
"type": "switch",
"z": "379c65a27117b46c",
"g": "5706252b01492258",
"name": "File Name",
"property": "$split(req.url, '/', limit)[$count($split(req.url, '/', limit)) + 1]\t\t",
"propertyType": "jsonata",
"rules": [
{
"t": "eq",
"v": "style.css",
"vt": "str"
},
{
"t": "eq",
"v": "common.js",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 3,
"x": 2650,
"y": 740,
"wires": [
[
"195e7631e8660db0"
],
[
"e01b059fbd4cb54f"
],
[
"dce9621aba915bd4"
]
]
},
{
"id": "eaeb9e2bfbe1dc95",
"type": "link out",
"z": "379c65a27117b46c",
"g": "5706252b01492258",
"name": "style.css",
"mode": "link",
"links": [
"3502d9cf69680b66"
],
"x": 2940,
"y": 640,
"wires": [],
"l": true
},
{
"id": "d81c931de5a63675",
"type": "link out",
"z": "379c65a27117b46c",
"g": "5706252b01492258",
"name": "HTTP/404",
"mode": "link",
"links": [
"4d40709eea926ab1"
],
"x": 2950,
"y": 860,
"wires": [],
"l": true
},
{
"id": "15721605aaae8a86",
"type": "debug",
"z": "379c65a27117b46c",
"g": "5706252b01492258",
"name": "CSS File",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2940,
"y": 600,
"wires": []
},
{
"id": "28ac8fd21056642c",
"type": "debug",
"z": "379c65a27117b46c",
"g": "5706252b01492258",
"name": "HTTP / 404",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2950,
"y": 900,
"wires": []
},
{
"id": "12a331c2a036a776",
"type": "link out",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "Fetch Files",
"mode": "link",
"links": [
"acd5690f3865f156"
],
"x": 2190,
"y": 860,
"wires": [],
"l": true
},
{
"id": "acd5690f3865f156",
"type": "link in",
"z": "379c65a27117b46c",
"g": "5706252b01492258",
"name": "Fetch File",
"links": [
"12a331c2a036a776"
],
"x": 2460,
"y": 860,
"wires": [
[
"9f59194fecc0976a"
]
],
"l": true
},
{
"id": "e72f08d8fc433bea",
"type": "link out",
"z": "379c65a27117b46c",
"g": "5706252b01492258",
"name": "common.js",
"mode": "link",
"links": [
"602e7197835bba91"
],
"x": 2950,
"y": 760,
"wires": [],
"l": true
},
{
"id": "1b1ca0bd7037ed0f",
"type": "debug",
"z": "379c65a27117b46c",
"g": "5706252b01492258",
"name": "JS File",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2930,
"y": 720,
"wires": []
},
{
"id": "515f363d4f52f625",
"type": "link out",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "Home",
"mode": "link",
"links": [
"0172c4a240b566fd",
"d810b86dc7c722cd"
],
"x": 2210,
"y": 600,
"wires": [],
"l": true
},
{
"id": "333303604fa4ca01",
"type": "link out",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "Page: Change Password",
"mode": "link",
"links": [
"b5cedc58894f707e",
"2ccbf2d475489da8"
],
"x": 2150,
"y": 680,
"wires": [],
"l": true
},
{
"id": "52395c2abfc3c4f5",
"type": "link out",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "Page: Account Details",
"mode": "link",
"links": [
"e50f46892eabd2a5",
"a28d15c7a8dfdc85"
],
"x": 2160,
"y": 640,
"wires": [],
"l": true
},
{
"id": "68f30ef53ebc2074",
"type": "link out",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "Page: Logout",
"mode": "link",
"links": [
"fb5301abffede979"
],
"x": 2190,
"y": 800,
"wires": [],
"l": true
},
{
"id": "2189bf4e56868e51",
"type": "debug",
"z": "379c65a27117b46c",
"g": "8363d385051fc5c0",
"name": "debug 95",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2080,
"y": 1020,
"wires": []
},
{
"id": "f2026962fb8dbb44",
"type": "debug",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "debug 99",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2180,
"y": 900,
"wires": []
},
{
"id": "ce290d371c7687b0",
"type": "debug",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "Not-Authorized",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1760,
"y": 780,
"wires": []
},
{
"id": "c7ca92d48206b4b2",
"type": "inject",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "Auto Read Config",
"props": [
{
"p": "filename",
"v": "config.json",
"vt": "str"
}
],
"repeat": "300",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"x": 290,
"y": 180,
"wires": [
[
"3a543f0ac74f2891"
]
]
},
{
"id": "7df31641fc2fe59a",
"type": "file in",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "Open Config File",
"filename": "filename",
"filenameType": "msg",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 630,
"y": 140,
"wires": [
[
"d109fc9821987d4f"
]
]
},
{
"id": "d109fc9821987d4f",
"type": "json",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "",
"property": "payload",
"action": "obj",
"pretty": false,
"x": 770,
"y": 140,
"wires": [
[
"e9127065159b9f0f"
]
]
},
{
"id": "e9127065159b9f0f",
"type": "change",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "global.config",
"rules": [
{
"t": "set",
"p": "config",
"pt": "global",
"to": "payload",
"tot": "msg"
},
{
"t": "set",
"p": "CurrentGlobalConfig",
"pt": "msg",
"to": "config",
"tot": "global"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 890,
"y": 140,
"wires": [
[
"f7ac866b468babe1"
]
]
},
{
"id": "de01a4559aecf1c4",
"type": "debug",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "Config read",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1180,
"y": 180,
"wires": []
},
{
"id": "36cf43c754570ebd",
"type": "watch",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "",
"files": "config.json",
"recursive": "",
"x": 320,
"y": 140,
"wires": [
[
"3a543f0ac74f2891"
]
]
},
{
"id": "1fb718bcdd65dc23",
"type": "watch",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "",
"files": "config.glpi.json",
"recursive": "",
"x": 300,
"y": 220,
"wires": [
[
"3a543f0ac74f2891"
]
]
},
{
"id": "b73763bef878743f",
"type": "file in",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "Open GLPI Config File",
"filename": "filename",
"filenameType": "msg",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 670,
"y": 220,
"wires": [
[
"a42b269766d80f74"
]
]
},
{
"id": "a42b269766d80f74",
"type": "json",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "",
"property": "payload",
"action": "obj",
"pretty": false,
"x": 820,
"y": 220,
"wires": [
[
"842ade29052f7e66"
]
]
},
{
"id": "842ade29052f7e66",
"type": "change",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "global.config.glpi",
"rules": [
{
"t": "set",
"p": "config.glpi",
"pt": "global",
"to": "payload",
"tot": "msg"
},
{
"t": "set",
"p": "CurrentGlobalConfig",
"pt": "msg",
"to": "config",
"tot": "global"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 960,
"y": 220,
"wires": [
[
"de01a4559aecf1c4"
]
]
},
{
"id": "330ab008da58ac93",
"type": "change",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "",
"rules": [
{
"t": "set",
"p": "filename",
"pt": "msg",
"to": "config.glpi.json",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 555,
"y": 220,
"wires": [
[
"b73763bef878743f"
]
],
"l": false
},
{
"id": "30efda375178f75f",
"type": "delay",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "",
"pauseType": "delay",
"timeout": "2",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 525,
"y": 220,
"wires": [
[
"330ab008da58ac93"
]
],
"l": false
},
{
"id": "8e72ce414e21b54f",
"type": "change",
"z": "379c65a27117b46c",
"g": "b994fe21efb223a9",
"name": "",
"rules": [
{
"t": "set",
"p": "filename",
"pt": "msg",
"to": "config.json",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 525,
"y": 140,
"wires": [
[
"7df31641fc2fe59a"
]
],
"l": false
},
{
"id": "64c99b312f9c601c",
"type": "link out",
"z": "379c65a27117b46c",
"g": "8363d385051fc5c0",
"name": "Password: Change",
"mode": "link",
"links": [
"1df8ab6bb55ff621",
"a36e4f9e4921b12a"
],
"x": 2110,
"y": 1140,
"wires": [],
"l": true
},
{
"id": "3ada862ebc07a99d",
"type": "function",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "Valid Path?",
"func": "var validPath = null;\nvar http_404 = null;\n\n//msg.http = {};\n\n// node.warn(String(msg.req.originalUrl).indexOf('.'));\n// node.warn(String(msg.req.originalUrl).indexOf('?'))\n// node.warn(String(msg.req.originalUrl).split('?')[0].split('/'));\n\nif ( String(msg.req.originalUrl).indexOf('?') > 0 ) {\n\n msg.http.path = String(msg.req.originalUrl).split('?')[0].split('/');\n node.warn('boo1');\n\n}else{\n msg.http.path = String(msg.req.originalUrl).split('/');\n node.warn('boo2');\n}\n\n// if ('/' in msg.req.params[\"0\"] && msg.req.params[\"0\"] != \"\" ) {\n\n// msg.checkpath = String(msg.req.params[\"0\"]).split('/')[0];\n\n// } else if ( msg.req.params[\"0\"] == \"\" ) {\n\n// msg.checkpath = \"\";\n\n// }\n\n// node.warn(msg.http.path[0]);\n// node.warn(global.get('config.http_path'));\n// node.warn(String(msg.req.originalUrl).indexOf('.'));\n\nif (\n msg.http.path[0] == global.get('config.http_path') ||\n msg.http.path[0] + '/' == global.get('config.http_path')\n) {\n\n validPath = msg;\n // node.warn(\"here1\");\n\n} else if (String(msg.req.originalUrl).indexOf('.') > 0 ) {\n\n validPath = msg;\n // node.warn(\"here2\");\n \n} else {\n\n http_404 = msg;\n // node.warn(\"here3\");\n\n}\n\nnode.send([validPath, http_404])\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1270,
"y": 720,
"wires": [
[
"eae031f35d9a1e9e"
],
[
"4716d2916d6de31e",
"6e74b4a9a6b2dac8"
]
],
"outputLabels": [
"SelfService",
"HTTP/404"
]
},
{
"id": "4716d2916d6de31e",
"type": "link out",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "HTTP/404",
"mode": "link",
"links": [
"4d40709eea926ab1"
],
"x": 1470,
"y": 740,
"wires": [],
"l": true
},
{
"id": "6e74b4a9a6b2dac8",
"type": "debug",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "HTTP / 404",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1470,
"y": 780,
"wires": []
},
{
"id": "c80657a01a03012d",
"type": "debug",
"z": "379c65a27117b46c",
"g": "cf2a3f84cb26a12c",
"name": "HTTP / Get",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 430,
"y": 380,
"wires": []
},
{
"id": "7c38c172df490c56",
"type": "function",
"z": "379c65a27117b46c",
"g": "8363d385051fc5c0",
"name": "Valid Path?",
"func": "var validPath = null;\nvar http_404 = null;\n\nmsg.http = {};\n\nmsg.http.path = String(msg.req.originalUrl).split('/');\n\n// if ('/' in msg.req.params[\"0\"] && msg.req.params[\"0\"] != \"\" ) {\n\n// msg.checkpath = String(msg.req.params[\"0\"]).split('/')[0];\n\n// } else if ( msg.req.params[\"0\"] == \"\" ) {\n\n// msg.checkpath = \"\";\n\n// }\n\nif ( msg.http.path[0] == global.get('config.http_path') ) {\n\n validPath = msg;\n\n} else {\n\n http_404 = msg;\n\n}\n\nnode.send([validPath, http_404])\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1310,
"y": 1100,
"wires": [
[
"75913f37.78e6e"
],
[
"c0e5efefb8395690",
"7b62ec12651e478a"
]
],
"outputLabels": [
"SelfService",
"HTTP/404"
]
},
{
"id": "c0e5efefb8395690",
"type": "link out",
"z": "379c65a27117b46c",
"g": "8363d385051fc5c0",
"name": "HTTP/404",
"mode": "link",
"links": [
"4d40709eea926ab1"
],
"x": 1510,
"y": 1120,
"wires": [],
"l": true
},
{
"id": "7b62ec12651e478a",
"type": "debug",
"z": "379c65a27117b46c",
"g": "8363d385051fc5c0",
"name": "HTTP / 404",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1510,
"y": 1160,
"wires": []
},
{
"id": "1c16492a7fe8e77b",
"type": "link out",
"z": "379c65a27117b46c",
"g": "923268ee62c6a7db",
"name": "HTTP/GET",
"mode": "link",
"links": [
"5c05dcd676fcb02a"
],
"x": 1810,
"y": 380,
"wires": [],
"icon": "font-awesome/fa-unlock",
"l": true
},
{
"id": "5c05dcd676fcb02a",
"type": "link in",
"z": "379c65a27117b46c",
"g": "ec8733df4e619869",
"name": "Process: HTTP/GET",
"links": [
"1c16492a7fe8e77b"
],
"x": 1110,
"y": 720,
"wires": [
[
"3ada862ebc07a99d"
]
],
"icon": "font-awesome/fa-unlock",
"l": true
},
{
"id": "e282aea37a90acdc",
"type": "link out",
"z": "379c65a27117b46c",
"g": "923268ee62c6a7db",
"name": "HTTP/POST",
"mode": "link",
"links": [
"9cbf4027b4ab1c04"
],
"x": 1810,
"y": 420,
"wires": [],
"icon": "font-awesome/fa-unlock",
"l": true
},
{
"id": "9cbf4027b4ab1c04",
"type": "link in",
"z": "379c65a27117b46c",
"g": "8363d385051fc5c0",
"name": "Process: HTTP/POST",
"links": [
"e282aea37a90acdc"
],
"x": 1120,
"y": 1100,
"wires": [
[
"7c38c172df490c56"
]
],
"icon": "font-awesome/fa-unlock",
"l": true
},
{
"id": "d17512b4de05ede1",
"type": "link out",
"z": "379c65a27117b46c",
"g": "f3aa07300888f0a4",
"name": "HTTP/401",
"mode": "link",
"links": [
"fd80fd11fc971e2c"
],
"x": 770,
"y": 740,
"wires": [],
"icon": "font-awesome/fa-lock",
"l": true
},
{
"id": "434d74f494db7cfc",
"type": "link out",
"z": "379c65a27117b46c",
"g": "f3aa07300888f0a4",
"name": "HTTP/404",
"mode": "link",
"links": [
"fd80fd11fc971e2c"
],
"x": 770,
"y": 780,
"wires": [],
"icon": "font-awesome/fa-question",
"l": true
},
{
"id": "cb10034e64c15167",
"type": "inject",
"z": "379c65a27117b46c",
"g": "1b2783bfbb09503e",
"name": "Create Auth Token",
"props": [
{
"p": "auth",
"v": "true",
"vt": "bool"
},
{
"p": "datetime",
"v": "",
"vt": "date"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 1490,
"y": 180,
"wires": [
[
"e350059bd801a5ab"
]
]
},
{
"id": "2f7615b7afa603aa",
"type": "function",
"z": "379c65a27117b46c",
"g": "1b2783bfbb09503e",
"name": "Build: Hash Details",
"func": "msg.hash = {};\nmsg.hash.string = msg.datetime;\nmsg.hash.type = 'sha256';\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1910,
"y": 180,
"wires": [
[
"0107c5fd18462084"
]
]
},
{
"id": "0107c5fd18462084",
"type": "link call",
"z": "379c65a27117b46c",
"g": "1b2783bfbb09503e",
"name": "",
"links": [
"43eebf1623f29074"
],
"linkType": "static",
"timeout": "30",
"x": 2070,
"y": 180,
"wires": [
[
"99a20ee6c80595d1"
]
]
},
{
"id": "99a20ee6c80595d1",
"type": "function",
"z": "379c65a27117b46c",
"g": "1b2783bfbb09503e",
"name": "Data",
"func": "\nvar date = new Date();\nvar timestamp = date.getTime();\nmsg.timestamp = timestamp;\n\nmsg.expires = timestamp + (86400 * 1000);\n\nmsg.payload = { \n \"datetime\": msg.expires,\n \"type\": \"token\",\n \"user\": msg.auth.user\n };\nmsg.filename = global.get('config.paths.token_sessions') + msg.hash.value + '.json';\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2190,
"y": 180,
"wires": [
[
"9bb0664a91ae9b97"
]
]
},
{
"id": "9bb0664a91ae9b97",
"type": "file",
"z": "379c65a27117b46c",
"g": "1b2783bfbb09503e",
"name": "",
"filename": "filename",
"filenameType": "msg",
"appendNewline": true,
"createDir": true,
"overwriteFile": "true",
"encoding": "none",
"x": 2300,
"y": 180,
"wires": [
[
"f08e22fcc829d7b2"
]
]
},
{
"id": "f08e22fcc829d7b2",
"type": "debug",
"z": "379c65a27117b46c",
"g": "1b2783bfbb09503e",
"name": "Auth Token",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2430,
"y": 180,
"wires": []
},
{
"id": "e350059bd801a5ab",
"type": "function",
"z": "379c65a27117b46c",
"g": "1b2783bfbb09503e",
"name": "Development: User Details",
"func": "msg.auth = {};\n\nmsg.auth.user = {\n \"username\": \"barny.gumble\",\n \"fname\": \"Barny\",\n \"lname\": \"Gumble\",\n \"mail\": \"barney.gumble@dinomail.com\"\n };\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1700,
"y": 180,
"wires": [
[
"2f7615b7afa603aa"
]
]
},
{
"id": "702a6efc7be81391",
"type": "comment",
"z": "379c65a27117b46c",
"g": "1b2783bfbb09503e",
"name": "ToDo: add random salt to hash generation",
"info": "",
"x": 1840,
"y": 140,
"wires": []
},
{
"id": "6728a85f5b044738",
"type": "link call",
"z": "379c65a27117b46c",
"g": "923268ee62c6a7db",
"name": "Authentication",
"links": [
"33f25da80ef87e72"
],
"linkType": "static",
"timeout": "30",
"x": 1310,
"y": 420,
"wires": [
[
"46d8b11bdef459aa"
]
],
"icon": "font-awesome/fa-lock"
},
{
"id": "46d8b11bdef459aa",
"type": "function",
"z": "379c65a27117b46c",
"g": "923268ee62c6a7db",
"name": "HTTP Method Routing",
"func": "var http_get = null;\nvar http_post = null;\nvar statuscode = null;\n\nvar status = { fill: \"red\", shape: \"ring\", text: \"Incomplete\" };\n\nif (msg.hasOwnProperty('statusCode') ) {\n\n status.fill = \"yellow\";\n status.text = \"HTTP/\"+ msg.statusCode;\n\n statuscode = msg;\n\n \n} else {\n\n if (msg.hasOwnPropertiy('session')) {\n\n switch (String(msg.req.method).toLocaleLowerCase()) {\n\n case 'get':\n status.fill = \"green\";\n status.text = \"GET\";\n\n http_get = msg;\n break;\n\n case 'post':\n status.fill = \"green\";\n status.text = \"POST\";\n\n http_post = msg;\n break;\n\n default:\n status.fill = \"yellow\";\n status.text = \"unsupported\";\n\n msg.statusCode = 400;\n statuscode = msg;\n break;\n\n };\n\n } else { // no msg.session, force logon\n status.fill = \"yellow\";\n status.text = \"Not Authorized\";\n\n\n if (!msg.hasOwnProperty('statusCode')) {\n msg.statusCode = 401;\n // ToDo: add location header to auth method\n }\n\n statuscode = msg;\n\n }\n}\n\nnode.status(status);\n\nnode.send([\n http_get,\n http_post,\n statuscode\n]);\n",
"outputs": 3,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1540,
"y": 420,
"wires": [
[
"1c16492a7fe8e77b"
],
[
"e282aea37a90acdc"
],
[
"5f2f87eeebd5bf6e"
]
],
"outputLabels": [
"Get",
"Post",
"Non HTTP/20x"
],
"icon": "node-red/arrow-in.svg"
},
{
"id": "2f1060b185e19215",
"type": "link in",
"z": "379c65a27117b46c",
"g": "923268ee62c6a7db",
"name": "Process: Authorized",
"links": [
"28713941e03e2bf5"
],
"x": 1110,
"y": 420,
"wires": [
[
"6728a85f5b044738"
]
],
"icon": "font-awesome/fa-lock",
"l": true
},
{
"id": "0ec392291c3fda2f",
"type": "link out",
"z": "379c65a27117b46c",
"g": "f3aa07300888f0a4",
"name": "HTTP/400",
"mode": "link",
"links": [
"fd80fd11fc971e2c"
],
"x": 770,
"y": 700,
"wires": [],
"icon": "font-awesome/fa-exclamation-triangle",
"l": true
},
{
"id": "5f2f87eeebd5bf6e",
"type": "link out",
"z": "379c65a27117b46c",
"g": "923268ee62c6a7db",
"name": "Non HTTP/20x",
"mode": "link",
"links": [
"5ad10ea406e2d3a7"
],
"x": 1820,
"y": 460,
"wires": [],
"icon": "font-awesome/fa-warning",
"l": true
},
{
"id": "28713941e03e2bf5",
"type": "link out",
"z": "379c65a27117b46c",
"g": "cf2a3f84cb26a12c",
"name": "Authorized?",
"mode": "link",
"links": [
"2f1060b185e19215"
],
"x": 610,
"y": 420,
"wires": [],
"icon": "font-awesome/fa-lock",
"l": true
},
{
"id": "3af3d2ae3286ffe0",
"type": "change",
"z": "379c65a27117b46c",
"g": "755ff25cc29a08a1",
"name": "",
"rules": [
{
"t": "delete",
"p": "_event",
"pt": "msg"
},
{
"t": "set",
"p": "http.response_size",
"pt": "msg",
"to": "$length(msg.payload)\t",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2760,
"y": 1160,
"wires": [
[
"e3043367c9a89a90",
"564400f9ec708521"
]
]
},
{
"id": "c6360f6028e1512c",
"type": "function",
"z": "379c65a27117b46c",
"g": "cf2a3f84cb26a12c",
"name": "Details",
"func": "msg.http = {\n \"client\": msg.req.connection.remoteAddress,\n \"headers\": msg.req.headers,\n \"timestamp\": Date.now()\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 430,
"y": 420,
"wires": [
[
"28713941e03e2bf5"
]
],
"icon": "font-awesome/fa-info-circle",
"info": "# Details\n\nAdds the HTTP request details to object `msg.http`."
},
{
"id": "c43678f82d52004f",
"type": "link out",
"z": "379c65a27117b46c",
"g": "f3aa07300888f0a4",
"name": "HTTP/302",
"mode": "link",
"links": [
"fd80fd11fc971e2c"
],
"x": 770,
"y": 620,
"wires": [],
"icon": "font-awesome/fa-refresh",
"l": true
},
{
"id": "43603c3760e7ae56",
"type": "link out",
"z": "379c65a27117b46c",
"g": "f3aa07300888f0a4",
"name": "HTTP/303",
"mode": "link",
"links": [
"fd80fd11fc971e2c"
],
"x": 770,
"y": 660,
"wires": [],
"icon": "font-awesome/fa-refresh",
"l": true
},
{
"id": "5ad10ea406e2d3a7",
"type": "link in",
"z": "379c65a27117b46c",
"g": "f3aa07300888f0a4",
"name": "HTTP/StatusCode",
"links": [
"5f2f87eeebd5bf6e"
],
"x": 290,
"y": 640,
"wires": [
[
"c058f11dfd8d01b2"
]
],
"icon": "node-red/arrow-in.svg",
"l": true
},
{
"id": "c058f11dfd8d01b2",
"type": "switch",
"z": "379c65a27117b46c",
"g": "f3aa07300888f0a4",
"name": "Route",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "302",
"vt": "num"
},
{
"t": "eq",
"v": "303",
"vt": "num"
},
{
"t": "eq",
"v": "400",
"vt": "num"
},
{
"t": "eq",
"v": "401",
"vt": "num"
},
{
"t": "eq",
"v": "404",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 5,
"x": 490,
"y": 640,
"wires": [
[
"c43678f82d52004f"
],
[
"43603c3760e7ae56"
],
[
"0ec392291c3fda2f"
],
[
"d17512b4de05ede1"
],
[
"434d74f494db7cfc"
]
]
},
{
"id": "02c4b9524d361ade",
"type": "link in",
"z": "42b9663b67dbd983",
"g": "8ad5fe68ad170e2d",
"name": "HTML: Password Reset Questions",
"links": [
"e2876b413d95adf9",
"28c74c7b39a06100"
],
"x": 320,
"y": 880,
"wires": [
[
"7e95892f2f3454b7"
]
],
"icon": "node-red/file.svg",
"l": true
},
{
"id": "365ba07c1f4721ec",
"type": "template",
"z": "42b9663b67dbd983",
"g": "8ad5fe68ad170e2d",
"name": "HTML",
"field": "html.body",
"fieldType": "msg",
"format": "html",
"syntax": "mustache",
"template": " <fieldset id=\"form\" style=\"width: 800px;\">\n <legend style=\"text-align: left;\"><h2>Password reset Questions</h2></legend>\n\n <form method=\"post\" action=\"{{{ global.config.http_path }}}passwordquestions\" ajax=\"true\">\n <p>For ensuring that only you can reset your password, you are required to provide three questions and answers. These questions will then as part of the self-service password reset process to confirm that it's you who is requesting the password reset.</p>\n <p>When choosing your questions, it's important to ensure that the questions that you use, only you would know the answers. This is to ensure that no one could guess the answers as only you would know the answers.</p>\n <p>In the fields below type out your question and answer, don't include punctuation or the use of any special characters. Valid characters are A-Z, a-z and 0-9. Any character entered into the form that are not part of this list will be removed.</p>\n <div id=\"question_multicolumn\">\n <label for=\"q1\">Question One</label>\n <label for=\"a1\">Answer One</label>\n <input type=\"text\" id=\"q1\" name=\"q1\" value=\"{{{ payload.0.question }}}\" placeholder=\"Type Question one here\">\n <input type=\"text\" id=\"a1\" name=\"a1\">\n </div>\n\n <div id=\"question_multicolumn\">\n <label for=\"q2\">Question Two</label>\n <label for=\"a2\">Answer Two</label>\n <input type=\"text\" id=\"q2\" name=\"q2\" value=\"{{{ payload.1.question }}}\">\n <input type=\"text\" id=\"a2\" name=\"a2\">\n </div>\n\n <div id=\"question_multicolumn\">\n <label for=\"q3\">Question Three</label>\n <label for=\"a3\">Answer One</label>\n <input type=\"text\" id=\"q3\" name=\"q3\" value=\"{{{ payload.2.question }}}\">\n <input type=\"text\" id=\"a3\" name=\"a3\">\n </div>\n\n <p>On Form submission, your answers will be hashed before storage. As such, no one will be able to view the answers, this includes you. This method however, still enables us to confirm an answer to a question as would occur during the password reset process.</p>\n\n <input type=\"submit\" value=\"Submit\">\n </form>\n <button id=\"navigation\" onclick=\"window.location.href='/{{{ global.config.http_path }}}';\">Home</button>\n </fieldset>\n\n <fieldset id=\"response\">\n <legend style=\"text-align: left;\">Results</legend>\n <span id=\"result\"></span>\n </fieldset>\n <div >\n <span id=\"result\"></span>\n </div>\n",
"output": "str",
"x": 1670,
"y": 860,
"wires": [
[
"591e68e90f876dd1"
]
]
},
{
"id": "50339f503fd4878d",
"type": "link out",
"z": "42b9663b67dbd983",
"g": "8ad5fe68ad170e2d",
"name": "HTML Response",
"mode": "link",
"links": [
"7db929503cf13635"
],
"x": 1950,
"y": 860,
"wires": [],
"l": true
},
{
"id": "2dc375bf57ad8daa",
"type": "link in",
"z": "42b9663b67dbd983",
"g": "ad0235dd3aa9eb7d",
"name": "HTML: Password Reset",
"links": [
"cad86e4a717ecb58"
],
"x": 280,
"y": 720,
"wires": [
[
"317930c679e833d1"
]
],
"icon": "node-red/file.svg",
"l": true
},
{
"id": "1ce803b83ecf1593",
"type": "change",
"z": "42b9663b67dbd983",
"g": "ad0235dd3aa9eb7d",
"name": "",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "random",
"tot": "msg"
},
{
"t": "set",
"p": "client",
"pt": "msg",
"to": "req.connection.remoteAddress",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 720,
"y": 720,
"wires": [
[
"f3b55ea2.f4d51"
]
]
},
{
"id": "f3b55ea2.f4d51",
"type": "template",
"z": "42b9663b67dbd983",
"g": "ad0235dd3aa9eb7d",
"name": "HTML",
"field": "html.body",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<fieldset id=\"form\" style=\"width: 400px;\">\n <legend style=\"text-align: left;\"><h2>Self-Service Password Reset</h2></legend>\n\n <form method=\"post\" action=\"/{{{ global.config.http_path }}}passwordreset\" ajax=\"true\">\n <p style=\"padding: 15px;\">To reset your password, ALL fields are Mandatory. On completing this form click 'submit' below. Results will be posted in the results window underneath the submit button.</p>\n <label for=\"fname\">First Name</label>\n <input type=\"text\" id=\"givenName\" name=\"givenName\"{{#auth.user}} value=\"{{auth.user.fname}}\" readonly{{/auth.user}}>\n\n <label for=\"lname\">Last Name</label>\n <input type=\"text\" id=\"sn\" name=\"sn\"{{#auth.user}} value=\"{{auth.user.lname}}\" readonly{{/auth.user}}>\n\n <label for=\"lname\">E-Mail Address</label>\n <input type=\"text\" id=\"mail\" name=\"mail\"{{#auth.user}} value=\"{{auth.user.mail}}\" readonly{{/auth.user}}>\n\n <label for=\"lname\">User Name</label>\n <input type=\"text\" id=\"uid\" name=\"uid\"{{#auth.user}} value=\"{{auth.user.username}}\" readonly{{/auth.user}}>\n\n <label for=\"random\">First half</label><p id=\"labelDescription\">This is the first half of your password</p>\n <input style=\"font-size: 14pt\" type=\"text\" id=\"random\" name=\"random\" value=\"{{{random}}}\" readonly>\n\n <input type=\"submit\" value=\"Submit\">\n </form>\n <button id=\"navigation\" onclick=\"window.location.href='/{{{ global.config.http_path }}}';\">Home</button>\n </fieldset>\n\n<fieldset id=\"response\">\n <legend style=\"text-align: left;\">Results</legend>\n <span id=\"result\"></span>\n</fieldset>\n<div >\n <span id=\"result\"></span>\n</div>\n",
"x": 850,
"y": 720,
"wires": [
[
"457583335831f826"
]
]
},
{
"id": "bf098463143ac8ad",
"type": "link out",
"z": "42b9663b67dbd983",
"g": "ad0235dd3aa9eb7d",
"name": "HTML Response",
"mode": "link",
"links": [
"7db929503cf13635"
],
"x": 1130,
"y": 720,
"wires": [],
"l": true
},
{
"id": "a702d39f0f3180de",
"type": "template",
"z": "42b9663b67dbd983",
"g": "d3393ec35cb20a93",
"name": "CSS",
"field": "payload",
"fieldType": "msg",
"format": "css",
"syntax": "mustache",
"template": "body {\n text-align: center;\n}\n\nfieldset {\n border-radius: 5px;\n /* background-color: #f2f2f2; */\n border-color: #ffffff;\n border-style: groove;\n /* padding: 20px; */\n}\n\nbody fieldset[id=form] {\n margin: 0 auto;\n background-color: #f2f2f2;\n}\n\nform {\n text-align: left;\n padding: 0px;\n}\n\nh2 {\n font-size: 20px;\n text-align: center;\n margin: 0;\n padding: 0;\n}\n\nform p {\n text-align: justify;\n margin: 0;\n padding: 10px;\n}\n\ninput[type=text], input[type=password], select {\n width: 100%;\n padding: 12px 20px;\n margin: 8px 0 20px 0;\n display: inline-block;\n border: 1px solid #ccc;\n border-radius: 4px;\n box-sizing: border-box;\n}\n\ninput[type=submit], button[id=navigation] {\n width: 100%;\n background-color: #4CAF50;\n color: white;\n padding: 14px 20px;\n margin: 8px 0;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n}\n\ninput[type=submit]:hover, button[id=navigation]:hover {\n background-color: #45a049;\n}\n\ninput[type=submit]:disabled {\n background-color: #455da0;\n pointer-events: none;\n}\n\nbody fieldset[id=response] {\n height: auto;\n min-height: 25px;\n width: 400px;\n margin: 0 auto;\n background-color: rgb(247, 240, 228);\n \n}\n\nlabel {\n font-size: 12pt;\n font-style: normal;\n font-weight: bold;\n color: #000000;\n text-align: left;\n}\n\n\n#labelDescription {\n color: #414141;\n\n}\n\ndiv[id=question_multicolumn] {\n margin: 0;\n padding: 0px;\n display: grid;\n grid-template-columns: 600px 200px;\n grid-template-rows: 25px;\n}",
"x": 410,
"y": 180,
"wires": [
[
"f1dcd5b6e32fb905"
]
]
},
{
"id": "3502d9cf69680b66",
"type": "link in",
"z": "42b9663b67dbd983",
"g": "d3393ec35cb20a93",
"name": "style.css",
"links": [
"eaeb9e2bfbe1dc95"
],
"x": 250,
"y": 180,
"wires": [
[
"a702d39f0f3180de"
]
],
"l": true
},
{
"id": "f1dcd5b6e32fb905",
"type": "link out",
"z": "42b9663b67dbd983",
"g": "d3393ec35cb20a93",
"name": "Return",
"mode": "link",
"links": [
"7db929503cf13635"
],
"x": 550,
"y": 180,
"wires": [],
"l": true
},
{
"id": "c8c3f9c8f2ee35ee",
"type": "template",
"z": "42b9663b67dbd983",
"g": "3e330505ea1e9cba",
"name": "JavaScript",
"field": "payload",
"fieldType": "msg",
"format": "javascript",
"syntax": "plain",
"template": "\n$(document).ready(function(e) {\n \n $(\"form[ajax=true]\").submit(function(e) {\n\n $(\"input[type=submit]\").attr(\"disabled\", true);\n $(\"input[type=submit]\").attr(\"value\", \"Sent\");\n\n e.preventDefault();\n \n var form_data = $(this).serialize();\n var form_url = $(this).attr(\"action\");\n var form_method = $(this).attr(\"method\").toUpperCase();\n \n $(\"#loadingimg\").show();\n\n $.ajax({\n url: form_url, \n type: form_method, \n data: form_data, \n cache: false,\n success: function(returnhtml){ \n \n $(\"#result\").html(returnhtml); \n $(\"#loadingimg\").hide(); \n } \n }); \n \n });\n \n});\n",
"x": 930,
"y": 180,
"wires": [
[
"b664f0b9e6c17ad6"
]
]
},
{
"id": "602e7197835bba91",
"type": "link in",
"z": "42b9663b67dbd983",
"g": "3e330505ea1e9cba",
"name": "common.js",
"links": [
"e72f08d8fc433bea"
],
"x": 760,
"y": 180,
"wires": [
[
"c8c3f9c8f2ee35ee"
]
],
"l": true
},
{
"id": "b664f0b9e6c17ad6",
"type": "link out",
"z": "42b9663b67dbd983",
"g": "3e330505ea1e9cba",
"name": "Return",
"mode": "link",
"links": [
"7db929503cf13635"
],
"x": 1090,
"y": 180,
"wires": [],
"l": true
},
{
"id": "457583335831f826",
"type": "link call",
"z": "42b9663b67dbd983",
"g": "ad0235dd3aa9eb7d",
"name": "Build HTML",
"links": [
"3ec10e706b7bdc9d"
],
"linkType": "static",
"timeout": "30",
"x": 970,
"y": 720,
"wires": [
[
"bf098463143ac8ad"
]
]
},
{
"id": "591e68e90f876dd1",
"type": "link call",
"z": "42b9663b67dbd983",
"g": "8ad5fe68ad170e2d",
"name": "Build HTML",
"links": [
"3ec10e706b7bdc9d"
],
"linkType": "static",
"timeout": "30",
"x": 1790,
"y": 860,
"wires": [
[
"50339f503fd4878d"
]
]
},
{
"id": "0172c4a240b566fd",
"type": "link in",
"z": "42b9663b67dbd983",
"g": "1c5c6c543ef047b6",
"name": "HTML: Home",
"links": [
"515f363d4f52f625"
],
"x": 250,
"y": 340,
"wires": [
[
"2106525aa2ebda7d"
]
],
"icon": "node-red/file.svg",
"l": true
},
{
"id": "2106525aa2ebda7d",
"type": "template",
"z": "42b9663b67dbd983",
"g": "1c5c6c543ef047b6",
"name": "HTML",
"field": "html.body",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<fieldset id=\"form\" style=\"width: 400px;\">\n <legend style=\"text-align: left;\"><h2>Main Menu</h2></legend>\n\n <p style=\"text-align: left;\">G'Day {{{ auth.user.fname}}}</p>\n\n <button id=\"navigation\" onclick=\"window.location.href='{{{ global.config.http_path }}}details';\">My Details</button>\n <button id=\"navigation\" onclick=\"window.location.href='{{{ global.config.http_path }}}changepassword';\">Change Password</button>\n <button id=\"navigation\" onclick=\"window.location.href='{{{ global.config.http_path }}}passwordreset';\">Password Reset</button>\n{{#global.config.developer_mode}}\n <button id=\"navigation\" onclick=\"window.location.href='{{{ global.config.http_path }}}passwordquestions';\">Password Reset Questions</button>\n <button id=\"navigation\" onclick=\"window.location.href='{{{ global.config.http_path }}}logout';\">Log Out</button>\n{{/global.config.developer_mode}}\n\n</fieldset>",
"x": 450,
"y": 340,
"wires": [
[
"2f628eec7ca4b343"
]
]
},
{
"id": "4ecc0631139b51e0",
"type": "link out",
"z": "42b9663b67dbd983",
"g": "1c5c6c543ef047b6",
"name": "HTML Response",
"mode": "link",
"links": [
"7db929503cf13635"
],
"x": 850,
"y": 340,
"wires": [],
"l": true
},
{
"id": "2f628eec7ca4b343",
"type": "link call",
"z": "42b9663b67dbd983",
"g": "1c5c6c543ef047b6",
"name": "Build HTML",
"links": [
"3ec10e706b7bdc9d"
],
"linkType": "static",
"timeout": "30",
"x": 630,
"y": 340,
"wires": [
[
"4ecc0631139b51e0"
]
]
},
{
"id": "fd80fd11fc971e2c",
"type": "link in",
"z": "42b9663b67dbd983",
"g": "a64f4a2c837d5c3c",
"name": "HTML: Error",
"links": [
"d17512b4de05ede1",
"434d74f494db7cfc",
"0ec392291c3fda2f",
"c43678f82d52004f",
"43603c3760e7ae56"
],
"x": 1410,
"y": 100,
"wires": [
[
"274e4e6606cb379a"
]
],
"icon": "node-red/file.svg",
"l": true
},
{
"id": "274e4e6606cb379a",
"type": "template",
"z": "42b9663b67dbd983",
"g": "a64f4a2c837d5c3c",
"name": "HTML",
"field": "html.body",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<h1>{{ statusCode }}: {{ http.error }}<h1>",
"output": "str",
"x": 1610,
"y": 100,
"wires": [
[
"781d23c946457b30"
]
]
},
{
"id": "50d19d3ce5cf88f2",
"type": "debug",
"z": "42b9663b67dbd983",
"g": "a64f4a2c837d5c3c",
"name": "debug 82",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1980,
"y": 60,
"wires": []
},
{
"id": "e5ae19af5f6d6561",
"type": "link out",
"z": "42b9663b67dbd983",
"g": "a64f4a2c837d5c3c",
"name": "HTML Response",
"mode": "link",
"links": [
"7db929503cf13635"
],
"x": 2010,
"y": 100,
"wires": [],
"l": true
},
{
"id": "781d23c946457b30",
"type": "link call",
"z": "42b9663b67dbd983",
"g": "a64f4a2c837d5c3c",
"name": "Build HTML",
"links": [
"3ec10e706b7bdc9d"
],
"linkType": "static",
"timeout": "30",
"x": 1790,
"y": 100,
"wires": [
[
"e5ae19af5f6d6561",
"50d19d3ce5cf88f2"
]
]
},
{
"id": "3ec10e706b7bdc9d",
"type": "link in",
"z": "42b9663b67dbd983",
"g": "a8e6ecf8ae37659e",
"name": "Page Template",
"links": [],
"x": 260,
"y": 60,
"wires": [
[
"6fc3fe2eef3733b0"
]
],
"l": true
},
{
"id": "8bdcaea510dbad1e",
"type": "link out",
"z": "42b9663b67dbd983",
"g": "a8e6ecf8ae37659e",
"name": "Return Content",
"mode": "return",
"links": [],
"x": 740,
"y": 60,
"wires": [],
"l": true
},
{
"id": "6fc3fe2eef3733b0",
"type": "template",
"z": "42b9663b67dbd983",
"g": "a8e6ecf8ae37659e",
"name": "HTML",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<html>\n <head>\n <title>No Fuss Computing</title>\n <meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\">\n <meta charset=\"utf-8\">\n <meta name=\"robots\" content=\"noindex,nofollow\">\n <script src=\"http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.0/jquery.min.js\"></script>\n <script src=\"{{{ global.config.http_path }}}common.js\"></script>\n <link rel=\"stylesheet\" href=\"{{{ global.config.http_path }}}style.css\">\n </head>\n \n<body>\n <div>\n\n <div style=\"background: url({{{ global.config.html.logo }}}) no-repeat center top; background-size: {{ global.config.html.logo_width }}px {{ global.config.html.logo_height }}px; width: 100%; height: 120px; display: flex;\"></div>\n\n {{{ html.body }}}\n\n </div>\n</body>\n</html>\n",
"x": 510,
"y": 60,
"wires": [
[
"8bdcaea510dbad1e"
]
]
},
{
"id": "e50f46892eabd2a5",
"type": "link in",
"z": "42b9663b67dbd983",
"g": "0abe2cea5975dcfd",
"name": "HTML: Account Details",
"links": [
"52395c2abfc3c4f5"
],
"x": 280,
"y": 460,
"wires": [
[
"46ef4f0739d6c1b8"
]
],
"icon": "node-red/file.svg",
"l": true
},
{
"id": "46ef4f0739d6c1b8",
"type": "template",
"z": "42b9663b67dbd983",
"g": "0abe2cea5975dcfd",
"name": "HTML",
"field": "html.body",
"fieldType": "msg",
"format": "html",
"syntax": "mustache",
"template": "\n <fieldset id=\"form\" style=\"width: 400px;\">\n <legend style=\"text-align: left;\"><h2>Account Details</h2></legend>\n\n <form method=\"post\" action=\"/{{{ global.config.http_path }}}updatedetails\" ajax=\"true\">\n <p style=\"padding: 15px;\"></p>\n\n <label for=\"givenName\">First Name</label>\n <input type=\"text\" id=\"givenName\" name=\"givenName\" disabled value=\"{{{ auth.user.fname }}}\">\n\n <label for=\"sn\">Last Name</label>\n <input type=\"text\" id=\"sn\" name=\"sn\" disabled value=\"{{{ auth.user.lname }}}\">\n\n <label for=\"uid\">User Name</label>\n <input type=\"text\" id=\"uid\" name=\"uid\" disabled value=\"{{{ auth.user.username }}}\">\n\n <label for=\"mail\">E-Mail</label>\n <input type=\"text\" id=\"mail\" name=\"mail\" disabled value=\"{{{ auth.user.mail }}}\">\n\n <input type=\"submit\" value=\"Updating Not Available\" disabled>\n </form>\n <button id=\"navigation\" onclick=\"window.location.href='{{{ global.config.http_path }}}/';\">Home</button>\n </fieldset>\n\n <fieldset id=\"response\">\n <legend style=\"text-align: left;\">Results</legend>\n <span id=\"result\"></span>\n </fieldset>\n <div >\n <span id=\"result\"></span>\n </div>\n",
"x": 450,
"y": 460,
"wires": [
[
"c9323e9dc74c9203"
]
]
},
{
"id": "1d661b2385de4b4a",
"type": "link out",
"z": "42b9663b67dbd983",
"g": "0abe2cea5975dcfd",
"name": "HTML Response",
"mode": "link",
"links": [
"7db929503cf13635"
],
"x": 850,
"y": 460,
"wires": [],
"l": true
},
{
"id": "c9323e9dc74c9203",
"type": "link call",
"z": "42b9663b67dbd983",
"g": "0abe2cea5975dcfd",
"name": "Build HTML",
"links": [
"3ec10e706b7bdc9d"
],
"linkType": "static",
"timeout": "30",
"x": 630,
"y": 460,
"wires": [
[
"1d661b2385de4b4a"
]
]
},
{
"id": "b5cedc58894f707e",
"type": "link in",
"z": "42b9663b67dbd983",
"g": "07f2249ad4b7ccd0",
"name": "HTML: Change Password",
"links": [
"333303604fa4ca01"
],
"x": 290,
"y": 580,
"wires": [
[
"54b1149ed3d047fe"
]
],
"icon": "node-red/file.svg",
"l": true
},
{
"id": "54b1149ed3d047fe",
"type": "template",
"z": "42b9663b67dbd983",
"g": "07f2249ad4b7ccd0",
"name": "HTML",
"field": "html.body",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "\n <fieldset id=\"form\" style=\"width: 400px;\">\n <legend style=\"text-align: left;\"><h2>Change Password</h2></legend>\n \n <form method=\"post\" action=\"/{{{ global.config.http_path }}}passwordchange\" ajax=\"true\">\n <p style=\"padding: 15px;\">To change your password, Complete the fields below. On completing this form click 'Change Password'. Results will be posted in the results window at the bottom of the page.</p>\n \n <label for=\"c_password\">Current Password</label>\n <input type=\"password\" id=\"c_password\" name=\"c_password\" placeholder=\"current password\">\n \n <label for=\"n_password_1\">New Password</label>\n <input type=\"password\" id=\"n_password_1\" name=\"n_password_1\" placeholder=\"new password\">\n \n <label for=\"n_password_2\">Confirm New Password</label>\n <input type=\"password\" id=\"n_password_2\" name=\"n_password_2\" placeholder=\"re-type new password\">\n \n <input type=\"submit\" value=\"Change Password\">\n </form>\n\n <button id=\"navigation\" onclick=\"window.location.href='{{{ global.config.http_path }}}/';\">Home</button>\n \n </fieldset>\n \n <fieldset id=\"response\">\n <legend style=\"text-align: left;\">Results</legend>\n <span id=\"result\"></span>\n </fieldset>\n <div >\n <span id=\"result\"></span>\n </div>\n",
"x": 470,
"y": 580,
"wires": [
[
"dcfa3cfba4eb1356"
]
]
},
{
"id": "0c2e73371d4238a1",
"type": "link out",
"z": "42b9663b67dbd983",
"g": "07f2249ad4b7ccd0",
"name": "HTML Response",
"mode": "link",
"links": [
"7db929503cf13635"
],
"x": 850,
"y": 580,
"wires": [],
"l": true
},
{
"id": "dcfa3cfba4eb1356",
"type": "link call",
"z": "42b9663b67dbd983",
"g": "07f2249ad4b7ccd0",
"name": "Build HTML",
"links": [
"3ec10e706b7bdc9d"
],
"linkType": "static",
"timeout": "30",
"x": 630,
"y": 580,
"wires": [
[
"0c2e73371d4238a1"
]
]
},
{
"id": "fb5301abffede979",
"type": "link in",
"z": "42b9663b67dbd983",
"g": "b447a1f691eb02df",
"name": "HTML: Logout",
"links": [
"68f30ef53ebc2074"
],
"x": 250,
"y": 1040,
"wires": [
[
"1102d30391c745a6"
]
],
"icon": "node-red/file.svg",
"l": true
},
{
"id": "1102d30391c745a6",
"type": "template",
"z": "42b9663b67dbd983",
"g": "b447a1f691eb02df",
"name": "HTML",
"field": "html.body",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "logout",
"x": 470,
"y": 1040,
"wires": [
[
"b19bd0621d479d66"
]
]
},
{
"id": "988765ea19236af0",
"type": "link out",
"z": "42b9663b67dbd983",
"g": "b447a1f691eb02df",
"name": "HTML Response",
"mode": "link",
"links": [
"7db929503cf13635"
],
"x": 850,
"y": 1040,
"wires": [],
"l": true
},
{
"id": "b19bd0621d479d66",
"type": "link call",
"z": "42b9663b67dbd983",
"g": "b447a1f691eb02df",
"name": "Build HTML",
"links": [
"3ec10e706b7bdc9d"
],
"linkType": "static",
"timeout": "30",
"x": 630,
"y": 1040,
"wires": [
[
"988765ea19236af0"
]
]
},
{
"id": "52dc13e1fdbf064d",
"type": "file in",
"z": "42b9663b67dbd983",
"g": "8ad5fe68ad170e2d",
"name": "Fetch Password Questions",
"filename": "filename",
"filenameType": "msg",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 1360,
"y": 900,
"wires": [
[
"d460346f6ae1673b"
]
]
},
{
"id": "d460346f6ae1673b",
"type": "json",
"z": "42b9663b67dbd983",
"g": "8ad5fe68ad170e2d",
"name": "",
"property": "payload",
"action": "obj",
"pretty": false,
"x": 1530,
"y": 900,
"wires": [
[
"365ba07c1f4721ec"
]
]
},
{
"id": "b2c917da9e845f7a",
"type": "switch",
"z": "42b9663b67dbd983",
"g": "8ad5fe68ad170e2d",
"name": "No / Yes",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "0",
"vt": "num"
},
{
"t": "eq",
"v": "1",
"vt": "num"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 1120,
"y": 880,
"wires": [
[
"5798e39cbc3730ae"
],
[
"52dc13e1fdbf064d"
]
]
},
{
"id": "99a3fa75430c37f7",
"type": "function",
"z": "42b9663b67dbd983",
"g": "8ad5fe68ad170e2d",
"name": "Questions Exist",
"func": "\nfs.stat(msg.filename, function (err) {\n if (err) {\n msg.payload = 0\n } else {\n msg.payload = 1\n }\n});\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [
{
"var": "fs",
"module": "fs"
}
],
"x": 980,
"y": 880,
"wires": [
[
"b2c917da9e845f7a"
]
]
},
{
"id": "7e95892f2f3454b7",
"type": "function",
"z": "42b9663b67dbd983",
"g": "8ad5fe68ad170e2d",
"name": "Fetch: User Name",
"func": "msg.user = 'john.smith';\n\n//msg.payload = 'echo -n $(echo -n ' + msg.user + '| sha256sum) | awk \\'{print $1 }\\'';\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 550,
"y": 880,
"wires": [
[
"9b89c2da58fccb8d"
]
]
},
{
"id": "9b89c2da58fccb8d",
"type": "link call",
"z": "42b9663b67dbd983",
"g": "8ad5fe68ad170e2d",
"name": "",
"links": [
"8c13bbcc86d93be8"
],
"linkType": "static",
"timeout": "30",
"x": 770,
"y": 880,
"wires": [
[
"99a3fa75430c37f7"
]
]
},
{
"id": "317930c679e833d1",
"type": "link call",
"z": "42b9663b67dbd983",
"g": "ad0235dd3aa9eb7d",
"name": "Fetch First Half of the password",
"links": [
"869469819396a632"
],
"linkType": "static",
"timeout": "30",
"x": 510,
"y": 720,
"wires": [
[
"1ce803b83ecf1593"
]
]
},
{
"id": "e36b580c48d33ca0",
"type": "template",
"z": "42b9663b67dbd983",
"g": "8a2206d682028469",
"name": "Content",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "mustache",
"template": "{\n \"developer_mode\": false,\n \"html\": {\n \"logo\": \"http://nofusscomputing.com/assets/nfc_revamp_dark.png\",\n \"logo_width\": 282,\n \"logo_height\": 90\n },\n \"http_path\": \"/\",\n \"itsm\": {\n \"api_url\": \"http://glpi/apirest.php/\",\n \"create_ticket\": true,\n \"create_ticket_task\": true,\n \"platform\": \"glpi\",\n \"search\": true,\n \"human_task_duration_time\": 300,\n \"ticket\": {\n \"approval_required\": 0,\n \"category_id\": 6,\n \"entity_id\": 1,\n \"requesttype_id\": 6,\n \"task_category_id\": 2\n }\n },\n \"paths\": {\n \"user_data\": \"data/users/\",\n \"token_sessions\": \"data/sessions/\"\n }\n}\n",
"output": "json",
"x": 1580,
"y": 240,
"wires": [
[
"170b86b633c5ccd7"
]
]
},
{
"id": "497a482f9881a318",
"type": "inject",
"z": "42b9663b67dbd983",
"g": "8a2206d682028469",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 1430,
"y": 240,
"wires": [
[
"e36b580c48d33ca0"
]
]
},
{
"id": "170b86b633c5ccd7",
"type": "file",
"z": "42b9663b67dbd983",
"g": "8a2206d682028469",
"name": "",
"filename": "config.json",
"filenameType": "str",
"appendNewline": true,
"createDir": false,
"overwriteFile": "true",
"encoding": "none",
"x": 1770,
"y": 240,
"wires": [
[
"befac3bb99b2c2cc"
]
]
},
{
"id": "befac3bb99b2c2cc",
"type": "debug",
"z": "42b9663b67dbd983",
"g": "8a2206d682028469",
"name": "Config Written",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1940,
"y": 240,
"wires": []
},
{
"id": "742f2f88646c543a",
"type": "template",
"z": "42b9663b67dbd983",
"g": "690ee27cf3eee484",
"name": "Content",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "mustache",
"template": "{\n \"api_url\": \"http://glpi/apirest.php/\",\n \"authorization\": \"user_token W6Ay7cdu38KuQCpYaZw5E7fxk4q8dYSrz38EsPuK\",\n \"app_token\": \"SwiMCd61d6qcfCoFCziotpJgBafl15vQCdRwHJ47\",\n \"category_id_automation_task\": \"2\",\n \"debug_on\": false\n}",
"output": "json",
"x": 1580,
"y": 360,
"wires": [
[
"da2cb448945babee"
]
]
},
{
"id": "b54ff25c1e83a094",
"type": "inject",
"z": "42b9663b67dbd983",
"g": "690ee27cf3eee484",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 1430,
"y": 360,
"wires": [
[
"742f2f88646c543a"
]
]
},
{
"id": "da2cb448945babee",
"type": "file",
"z": "42b9663b67dbd983",
"g": "690ee27cf3eee484",
"name": "",
"filename": "config.glpi.json",
"filenameType": "str",
"appendNewline": true,
"createDir": false,
"overwriteFile": "true",
"encoding": "none",
"x": 1780,
"y": 360,
"wires": [
[
"d5627c7a12528006"
]
]
},
{
"id": "d5627c7a12528006",
"type": "debug",
"z": "42b9663b67dbd983",
"g": "690ee27cf3eee484",
"name": "Config Written",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1960,
"y": 360,
"wires": []
},
{
"id": "bb8102ee0c070ff2",
"type": "link in",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"name": "Process: Password Reset Questions",
"links": [
"9c92aaf02fee52b5"
],
"x": 300,
"y": 240,
"wires": [
[
"a712f5e2056bbb1b"
]
],
"l": true
},
{
"id": "629b7df0515c7d83",
"type": "debug",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"name": "STDERR",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 980,
"y": 260,
"wires": []
},
{
"id": "a712f5e2056bbb1b",
"type": "function",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"name": "Process Questions",
"func": "\nmsg.cleaned = \"cat <<EOF\\n\\n[\";\n\n// let keys = Object.keys(msg.http.form); \n// var values = msg.http.form\n\n// var exec = childProcess.exec;\n\n// function my_exec(command, callback) {\n// var proc = exec(command, { shell: \"/bin/bash\" });\n\n// var list = [];\n// proc.stdout.setEncoding('utf8');\n\n// proc.stdout.on('data', function (chunk) {\n// list.push(chunk);\n// });\n\n// proc.stdout.on('end', function () {\n// callback(list.join());\n// });\n\n// node.warn(`stderr: ${proc}`);\n// }\n\n\n// function sha256( value ) {\n// var hash;\n// //my_exec(\"echo - n '\" + value + \"' | openssl dgst - sha256 | awk '{print $2}'\", function (stdout) {\n// //my_exec(\"echo - n 88\" + value + \"\", function (stdout) {\n// my_exec(\"openssl --help\", function (stdout) {\n// node.warn(`stdout: ${stdout}`);\n// return String(stdout).replace(/\\s/g, '');\n// })\n\n// //return String(hash);\n// }\n\nfunction Sanitize( value ) {\n\n value = String(value).toLowerCase();\n\n var keep = \"abcdefghijklmnopqrstuvwxyz0123456789 \";\n const allowed = new Set(keep.split(\"\"));\n\n value = value\n .split(\"\")\n .filter(char => allowed.has(char))\n .join(\"\");\n\n\n return String(value);\n}\n\n\nfor (var i = 1; i < 4; i++) {\n\n //let key = keys[i];\n\n msg.cleaned += String(\n '{\"question\": \"' + Sanitize(msg.http.form['q' + String(i)]) + \n '\", \"answer\": \"$(echo -n ' + Sanitize(msg.http.form['a' + String(i)]).replace(' ', '') + ' | openssl dgst -sha256 | awk \\'{print $2}\\')\" }');\n\n if( i < 3) {\n msg.cleaned += String(',')\n }\n\n}\n\nmsg.payload = msg.cleaned + \"]\\n\\nEOF\";\n\ndelete msg.cleaned;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [
{
"var": "childProcess",
"module": "child_process"
}
],
"x": 530,
"y": 240,
"wires": [
[
"e9f50265154e4b83"
]
]
},
{
"id": "e9f50265154e4b83",
"type": "exec",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"command": "",
"addpay": "payload",
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": false,
"oldrc": false,
"name": "Expand bash variables",
"x": 760,
"y": 240,
"wires": [
[
"1e3c2b23420d6e40"
],
[],
[
"629b7df0515c7d83"
]
]
},
{
"id": "1e3c2b23420d6e40",
"type": "json",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"name": "",
"property": "payload",
"action": "obj",
"pretty": false,
"x": 970,
"y": 200,
"wires": [
[
"fba98a197970c6ee"
]
]
},
{
"id": "cee76f9f914dd0fa",
"type": "function",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"name": "Response message",
"func": "msg.payload = 'Your Password Questions have been saved';\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2140,
"y": 200,
"wires": [
[
"96836f5a4c7c756c",
"8b70b96b1f62a785"
]
]
},
{
"id": "fba98a197970c6ee",
"type": "json",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"name": "",
"property": "payload",
"action": "str",
"pretty": false,
"x": 1070,
"y": 200,
"wires": [
[
"6ec9911b7ad7d042"
]
]
},
{
"id": "edf62fa2ca3cd812",
"type": "file",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"name": "Save Questions",
"filename": "filename",
"filenameType": "msg",
"appendNewline": true,
"createDir": false,
"overwriteFile": "true",
"encoding": "utf8",
"x": 1840,
"y": 200,
"wires": [
[
"5210f540af1eb2e5"
]
]
},
{
"id": "5210f540af1eb2e5",
"type": "change",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"name": "Cleanup",
"rules": [
{
"t": "delete",
"p": "rc",
"pt": "msg"
},
{
"t": "delete",
"p": "payload",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1980,
"y": 200,
"wires": [
[
"cee76f9f914dd0fa"
]
]
},
{
"id": "96836f5a4c7c756c",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"name": "HTTP Response",
"mode": "link",
"links": [
"7db929503cf13635"
],
"x": 2320,
"y": 200,
"wires": [],
"l": true
},
{
"id": "6ec9911b7ad7d042",
"type": "function",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"name": "Fetch: User Name",
"func": "msg.user = 'john.smith';\nmsg.file_contents = msg.payload;\n\n//msg.payload = 'echo -n $(echo -n ' + msg.user + '| sha256sum) | awk \\'{print $1 }\\'';\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1210,
"y": 200,
"wires": [
[
"3f128f23d72e0492",
"7ce13238fa87d636"
]
]
},
{
"id": "3f128f23d72e0492",
"type": "link call",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"name": "",
"links": [
"8c13bbcc86d93be8"
],
"linkType": "static",
"timeout": "30",
"x": 1430,
"y": 200,
"wires": [
[
"05accf0d9a6f0aa8"
]
]
},
{
"id": "7ce13238fa87d636",
"type": "debug",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"name": "Fetch: UserName",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1450,
"y": 160,
"wires": []
},
{
"id": "8b70b96b1f62a785",
"type": "debug",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"name": "debug 94",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2340,
"y": 160,
"wires": []
},
{
"id": "311e184a2397eb19",
"type": "ldap-search in",
"z": "4b5e055cd6b1e387",
"g": "4cdebccc4a1f08ed",
"name": "Find LDAP User",
"ldap": "160d0b5ed597dc51",
"baseDn": "dc=nww",
"searchScope": "sub",
"filter": "",
"attributes": "dn,cn,givenName,sn,uid,mail",
"x": 980,
"y": 580,
"wires": [
[
"fe1f0a50300d9224"
]
]
},
{
"id": "faa5e7380a3092a2",
"type": "template",
"z": "4b5e055cd6b1e387",
"g": "4cdebccc4a1f08ed",
"name": "Create LDAP Search Filter",
"field": "filter",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "(&(objectclass=*)(cn={{ auth.user.fname }} {{ auth.user.lname }})(givenName={{ auth.user.fname }})(sn={{ auth.user.lname }})(uid={{ auth.user.username }})(mail={{ auth.user.mail }}))",
"output": "str",
"x": 760,
"y": 580,
"wires": [
[
"311e184a2397eb19"
]
]
},
{
"id": "fe1f0a50300d9224",
"type": "switch",
"z": "4b5e055cd6b1e387",
"g": "4cdebccc4a1f08ed",
"name": "User Found",
"property": "$count(msg.payload)",
"propertyType": "jsonata",
"rules": [
{
"t": "eq",
"v": "1\t",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 1130,
"y": 580,
"wires": [
[
"04818ddd8782b0a1"
],
[
"0308c42b587c3794"
]
]
},
{
"id": "b10e8a45ff44f80d",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "4cdebccc4a1f08ed",
"name": "LDAP: User Found",
"mode": "link",
"links": [
"4a4676456c27f256"
],
"x": 2070,
"y": 560,
"wires": [],
"l": true
},
{
"id": "0308c42b587c3794",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "4cdebccc4a1f08ed",
"name": "Response: Invalid User",
"mode": "link",
"links": [
"72721ec69edf230f"
],
"x": 1350,
"y": 600,
"wires": [],
"l": true
},
{
"id": "cdde8116fcac6e5d",
"type": "link in",
"z": "4b5e055cd6b1e387",
"g": "02dc457b6549ba4e",
"name": "Process: Password Reset",
"links": [
"b7fde07e47cc852e"
],
"x": 290,
"y": 420,
"wires": [
[
"f0a7ae298ec9e423",
"0354e185d6df3087"
]
],
"l": true
},
{
"id": "72721ec69edf230f",
"type": "link in",
"z": "4b5e055cd6b1e387",
"g": "aea0a3398dafab4c",
"name": "Respond: Invalid User",
"links": [
"0308c42b587c3794",
"58d1108b52842808",
"c7b7522a20abbb47"
],
"x": 2340,
"y": 1040,
"wires": [
[
"8eca6e69b809790c"
]
],
"l": true
},
{
"id": "8eca6e69b809790c",
"type": "function",
"z": "4b5e055cd6b1e387",
"g": "aea0a3398dafab4c",
"name": "Give impression of success",
"func": "msg.payload = 'Your Password has been reset';\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2580,
"y": 1040,
"wires": [
[
"4cdbeaa8f5f3ddb7",
"23439ba609bdc6d9"
]
]
},
{
"id": "4cdbeaa8f5f3ddb7",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "a9d52eb951c5f037",
"name": "Response",
"mode": "link",
"links": [
"7db929503cf13635"
],
"x": 2840,
"y": 940,
"wires": [],
"l": true
},
{
"id": "4a4676456c27f256",
"type": "link in",
"z": "4b5e055cd6b1e387",
"g": "9926c0ba3f91aca8",
"name": "ITSM: Search for User",
"links": [
"b10e8a45ff44f80d"
],
"x": 700,
"y": 740,
"wires": [
[
"a43bd1f944ef851c"
]
],
"l": true
},
{
"id": "a43bd1f944ef851c",
"type": "switch",
"z": "4b5e055cd6b1e387",
"g": "9926c0ba3f91aca8",
"name": "Conduct ITSM Search?",
"property": "config.itsm.search",
"propertyType": "global",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 910,
"y": 740,
"wires": [
[
"bc29c53d4ef04184"
],
[
"dbeedddce12963de"
]
]
},
{
"id": "eeb2b5a4e44d0c24",
"type": "link call",
"z": "4b5e055cd6b1e387",
"g": "9926c0ba3f91aca8",
"name": "",
"links": [
"b8c9f1cf125efd2e"
],
"linkType": "static",
"timeout": "30",
"x": 1350,
"y": 720,
"wires": [
[
"445623ba528e5df1"
]
]
},
{
"id": "04818ddd8782b0a1",
"type": "change",
"z": "4b5e055cd6b1e387",
"g": "4cdebccc4a1f08ed",
"name": "",
"rules": [
{
"t": "move",
"p": "payload[0]",
"pt": "msg",
"to": "ldap",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1340,
"y": 560,
"wires": [
[
"c66c2a0c3817433c"
]
]
},
{
"id": "bc29c53d4ef04184",
"type": "template",
"z": "4b5e055cd6b1e387",
"g": "9926c0ba3f91aca8",
"name": "ITSM User SearchData",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "mustache",
"template": "{\n \"data\": {\n \"givenName\": \"{{ ldap.givenName }}\",\n \"sn\": \"{{ ldap.sn }}\",\n \"uid\": \"{{ ldap.uid }}\"\n },\n \"action\": \"search\",\n \"action_for\": \"user\"\n}",
"output": "json",
"x": 1190,
"y": 720,
"wires": [
[
"eeb2b5a4e44d0c24"
]
]
},
{
"id": "b1bc2e62654b04e2",
"type": "function",
"z": "4b5e055cd6b1e387",
"g": "82ccba0e0a13970a",
"name": "return msg.payload to client",
"func": "msg.payload = msg.payload = 'Your Password has been reset, dont forget to take note of the first half of your password!!';\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2580,
"y": 940,
"wires": [
[
"4cdbeaa8f5f3ddb7",
"23439ba609bdc6d9"
]
]
},
{
"id": "f125e4c474dd2e5c",
"type": "link in",
"z": "4b5e055cd6b1e387",
"g": "82ccba0e0a13970a",
"name": "Respond: Success",
"links": [
"07ed8c85583c5a2e"
],
"x": 2330,
"y": 940,
"wires": [
[
"b1bc2e62654b04e2"
]
],
"l": true
},
{
"id": "68628b6f32ec8b74",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "9926c0ba3f91aca8",
"name": "LDAP: User Found",
"mode": "link",
"links": [
"1a29880acc851ff5"
],
"x": 1910,
"y": 740,
"wires": [],
"l": true
},
{
"id": "dbeedddce12963de",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "9926c0ba3f91aca8",
"name": "Continue",
"mode": "link",
"links": [
"073709e754dd98a3"
],
"x": 1140,
"y": 760,
"wires": [],
"l": true
},
{
"id": "1a29880acc851ff5",
"type": "link in",
"z": "4b5e055cd6b1e387",
"g": "d1b4f7ad9e8ea4f0",
"name": "ITSM: Create Ticket",
"links": [
"68628b6f32ec8b74"
],
"x": 950,
"y": 880,
"wires": [
[
"dce8db9b841faf7f"
]
],
"l": true
},
{
"id": "dce8db9b841faf7f",
"type": "switch",
"z": "4b5e055cd6b1e387",
"g": "d1b4f7ad9e8ea4f0",
"name": "Create Ticket?",
"property": "config.itsm.create_ticket",
"propertyType": "global",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 1120,
"y": 880,
"wires": [
[
"93434028042529b8"
],
[
"ad66e8c05ee9a664"
]
]
},
{
"id": "ad66e8c05ee9a664",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "d1b4f7ad9e8ea4f0",
"name": "Continue",
"mode": "link",
"links": [
"073709e754dd98a3"
],
"x": 1300,
"y": 900,
"wires": [],
"l": true
},
{
"id": "93434028042529b8",
"type": "template",
"z": "4b5e055cd6b1e387",
"g": "d1b4f7ad9e8ea4f0",
"name": "ITSM Ticket Data",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "mustache",
"template": "{\n \"data\": {\n \"task\": {\n \"body\": {\n \"name\": \"LDAP Password Reset\",\n \"human_task_duration\": {{ global.config.itsm.human_task_duration_time }},\n \"platform\": \"NodeRed\",\n \"details\": {\n \"url\": \"{{{ req.url }}}\",\n \"client_address\": \"{{{ req.connection.remoteAddress }}}\",\n \"request_method\": \"{{{ req.method }}}\"\n },\n \"form\": {\n \"fname\": \"{{{ http.form.givenName }}}\",\n \"lname\": \"{{{ http.form.sn }}}\",\n \"mail\": \"{{{ http.form.mail }}}\",\n \"username\": \"{{{ http.form.uid }}}\"\n }\n },\n \"category\": 6\n },\n \"ticket\": {\n \"approval_required\": {{ global.config.itsm.ticket.approval_required }},\n \"category_id\": {{ global.config.itsm.ticket.category_id }},\n \"entity_id\": {{ global.config.itsm.ticket.entity_id }},\n \"requester_id\": {{ itsm.user.id }},\n \"requesttype_id\":{{ global.config.itsm.ticket.requesttype_id }},\n \"task_category_id\": {{ global.config.itsm.ticket.task_category_id }}\n }\n \n },\n \"platform\": \"{{ global.config.itsm.platform }}\",\n \"action\": \"create\",\n \"action_for\": \"ticket\"\n}\n",
"output": "json",
"x": 1330,
"y": 860,
"wires": [
[
"00066fdae59433b8"
]
]
},
{
"id": "8dd7c0779eac59f0",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "d1b4f7ad9e8ea4f0",
"name": "Ticket Created",
"mode": "link",
"links": [
"073709e754dd98a3"
],
"x": 1640,
"y": 860,
"wires": [],
"l": true
},
{
"id": "00066fdae59433b8",
"type": "link call",
"z": "4b5e055cd6b1e387",
"g": "d1b4f7ad9e8ea4f0",
"name": "",
"links": [
"b8c9f1cf125efd2e"
],
"linkType": "static",
"timeout": "30",
"x": 1510,
"y": 860,
"wires": [
[
"8dd7c0779eac59f0"
]
]
},
{
"id": "445623ba528e5df1",
"type": "switch",
"z": "4b5e055cd6b1e387",
"g": "9926c0ba3f91aca8",
"name": "Found User",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "hask",
"v": "id",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 1470,
"y": 720,
"wires": [
[
"f6fc2010d0af1e33"
],
[
"58d1108b52842808"
]
]
},
{
"id": "58d1108b52842808",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "9926c0ba3f91aca8",
"name": "Response: Invalid User",
"mode": "link",
"links": [
"72721ec69edf230f"
],
"x": 1690,
"y": 760,
"wires": [],
"l": true
},
{
"id": "f6fc2010d0af1e33",
"type": "change",
"z": "4b5e055cd6b1e387",
"g": "9926c0ba3f91aca8",
"name": "Store User Data",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "itsm.user",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1660,
"y": 700,
"wires": [
[
"68628b6f32ec8b74",
"07ed8c85583c5a2e"
]
]
},
{
"id": "853e6c15b5317007",
"type": "ldap-update in",
"z": "4b5e055cd6b1e387",
"g": "d0dc259791aed430",
"name": "Update Password",
"ldap": "160d0b5ed597dc51",
"operation": "replace",
"dn": "",
"attribute": "userPassword",
"value": "",
"x": 1450,
"y": 1020,
"wires": [
[
"9090daaf8a5892b0"
]
]
},
{
"id": "073709e754dd98a3",
"type": "link in",
"z": "4b5e055cd6b1e387",
"g": "d0dc259791aed430",
"name": "LDAP: Update Password",
"links": [
"8dd7c0779eac59f0",
"ad66e8c05ee9a664",
"dbeedddce12963de"
],
"x": 710,
"y": 1020,
"wires": [
[
"c710ba5a1416cfd8"
]
],
"l": true
},
{
"id": "142f9ce43cb63dd7",
"type": "link call",
"z": "4b5e055cd6b1e387",
"g": "d0dc259791aed430",
"name": "Convert Password to LDAP Hashed Password",
"links": [
"c19ba5f86ea40757"
],
"linkType": "static",
"timeout": "30",
"x": 1180,
"y": 1020,
"wires": [
[
"853e6c15b5317007"
]
]
},
{
"id": "c66c2a0c3817433c",
"type": "link call",
"z": "4b5e055cd6b1e387",
"g": "4cdebccc4a1f08ed",
"name": "Fetch Second half of password",
"links": [
"869469819396a632"
],
"linkType": "static",
"timeout": "30",
"x": 1610,
"y": 560,
"wires": [
[
"c08e353c85cde934"
]
]
},
{
"id": "c710ba5a1416cfd8",
"type": "change",
"z": "4b5e055cd6b1e387",
"g": "d0dc259791aed430",
"name": "Prepare LDAP data",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$string(msg.http.form.random & msg.payload)",
"tot": "jsonata"
},
{
"t": "set",
"p": "dn",
"pt": "msg",
"to": "ldap.dn",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 910,
"y": 1020,
"wires": [
[
"142f9ce43cb63dd7"
]
]
},
{
"id": "ec52cbc3aa0fec25",
"type": "debug",
"z": "4b5e055cd6b1e387",
"g": "d0dc259791aed430",
"name": "LDAP Error",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1870,
"y": 1040,
"wires": []
},
{
"id": "9090daaf8a5892b0",
"type": "switch",
"z": "4b5e055cd6b1e387",
"g": "d0dc259791aed430",
"name": "LDAP: Changed?",
"property": "ldapStatus.success",
"propertyType": "msg",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 1630,
"y": 1020,
"wires": [
[
"13711f1826f83198"
],
[
"ec52cbc3aa0fec25"
]
]
},
{
"id": "07ed8c85583c5a2e",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "9926c0ba3f91aca8",
"name": "Respond to User",
"mode": "link",
"links": [
"f125e4c474dd2e5c"
],
"x": 1910,
"y": 700,
"wires": [],
"l": true
},
{
"id": "c08e353c85cde934",
"type": "change",
"z": "4b5e055cd6b1e387",
"g": "4cdebccc4a1f08ed",
"name": "msg.password_second_half",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "password_second_half",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1860,
"y": 560,
"wires": [
[
"b10e8a45ff44f80d"
]
]
},
{
"id": "13711f1826f83198",
"type": "debug",
"z": "4b5e055cd6b1e387",
"g": "d0dc259791aed430",
"name": "LDAP Success",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1880,
"y": 1000,
"wires": []
},
{
"id": "05accf0d9a6f0aa8",
"type": "function",
"z": "4b5e055cd6b1e387",
"g": "3b96ab15b1a54e33",
"name": "Flow Data",
"func": "\nmsg.payload = msg.file_contents;\n\ndelete msg.file_contents;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1660,
"y": 200,
"wires": [
[
"edf62fa2ca3cd812"
]
]
},
{
"id": "1df8ab6bb55ff621",
"type": "link in",
"z": "4b5e055cd6b1e387",
"g": "dba3741d6cc275c9",
"name": "Process: Password Change",
"links": [
"64c99b312f9c601c"
],
"x": 300,
"y": 1220,
"wires": [
[
"98364b7271054017"
]
],
"l": true
},
{
"id": "6ef14d9fb582d42e",
"type": "template",
"z": "4b5e055cd6b1e387",
"g": "f8ec4a6290dc7e20",
"name": "Create LDAP Search Filter",
"field": "filter",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "(&(objectclass=*)(cn={{ auth.user.fname }} {{ auth.user.lname }})(givenName={{ auth.user.fname }})(sn={{ auth.user.lname }})(uid={{ auth.user.username }})(mail={{ auth.user.mail }}))",
"output": "str",
"x": 1460,
"y": 1220,
"wires": [
[
"30264cfad476079a"
]
]
},
{
"id": "30264cfad476079a",
"type": "ldap-search in",
"z": "4b5e055cd6b1e387",
"g": "f8ec4a6290dc7e20",
"name": "Find LDAP User",
"ldap": "160d0b5ed597dc51",
"baseDn": "dc=nww",
"searchScope": "sub",
"filter": "",
"attributes": "dn,cn,givenName,sn,uid,mail,userpassword",
"x": 1680,
"y": 1220,
"wires": [
[
"53fce6f461eec779"
]
]
},
{
"id": "f0a7ae298ec9e423",
"type": "debug",
"z": "4b5e055cd6b1e387",
"name": "debug 115",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 690,
"y": 340,
"wires": []
},
{
"id": "0354e185d6df3087",
"type": "function",
"z": "4b5e055cd6b1e387",
"g": "02dc457b6549ba4e",
"name": "Form and user details must match",
"func": "var success = null;\nvar failure = null;\n\nnode.status({fill:\"yellow\",shape:\"ring\",text:\"User Details Dont match\"});\n\nif(\n msg.auth.user.username == msg.req.body.uid &&\n msg.auth.user.fname == msg.req.body.givenName &&\n msg.auth.user.lname == msg.req.body.sn &&\n msg.auth.user.mail == msg.req.body.mail\n) {\n node.status({ fill: \"green\", shape: \"dot\", text: \"User Details match\" });\n\n success = msg;\n}\n\nnode.send([\n success,\n failure\n]);",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 560,
"y": 420,
"wires": [
[
"3e44bc1a5e60ec3d"
],
[
"c7b7522a20abbb47"
]
],
"outputLabels": [
"Success",
"Failure"
],
"icon": "font-awesome/fa-question"
},
{
"id": "c7b7522a20abbb47",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "02dc457b6549ba4e",
"name": "User details don't match",
"mode": "link",
"links": [
"72721ec69edf230f"
],
"x": 890,
"y": 460,
"wires": [],
"icon": "font-awesome/fa-hand-stop-o",
"l": true
},
{
"id": "3e44bc1a5e60ec3d",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "02dc457b6549ba4e",
"name": "Process Form: Password Reset",
"mode": "link",
"links": [
"5cfc1e5277013397"
],
"x": 970,
"y": 400,
"wires": [],
"icon": "font-awesome/fa-check",
"l": true
},
{
"id": "5cfc1e5277013397",
"type": "link in",
"z": "4b5e055cd6b1e387",
"g": "4cdebccc4a1f08ed",
"name": "LDAP: User Search",
"links": [
"3e44bc1a5e60ec3d"
],
"x": 550,
"y": 580,
"wires": [
[
"faa5e7380a3092a2"
]
],
"icon": "node-red/arrow-in.svg",
"l": true
},
{
"id": "23439ba609bdc6d9",
"type": "debug",
"z": "4b5e055cd6b1e387",
"name": "debug 116",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3170,
"y": 980,
"wires": []
},
{
"id": "53fce6f461eec779",
"type": "function",
"z": "4b5e055cd6b1e387",
"g": "f8ec4a6290dc7e20",
"name": "Process LDAP Search",
"func": "var found = null;\nvar not_found = null;\n\ndelete msg.filter;\ndelete msg._event;\n\nnode.status({fill:\"red\",shape:\"ring\",text:\"No User Found\"});\n\n\nif( Array(msg.payload).length > 0 ) {\n\n msg.ldap = msg.payload[0];\n found = msg;\n node.status({ fill: \"green\", shape: \"ring\", text: \"User Found\" });\n\n}\n\n\nnode.send([\n found,\n not_found,\n]);",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1880,
"y": 1220,
"wires": [
[
"1619699cd34defb4"
],
[
"815ce9e0380e642f"
]
],
"outputLabels": [
"Found User",
"No User Found"
],
"icon": "font-awesome/fa-question"
},
{
"id": "98364b7271054017",
"type": "function",
"z": "4b5e055cd6b1e387",
"g": "dba3741d6cc275c9",
"name": "Form and user details must match",
"func": "var success = null;\nvar failure = null;\n\nvar status_colour = 'red';\nvar status_text = 'Validation did not complete';\n\n\nif( msg.req.body.c_password == '' ) {\n\n status_colour = 'yellow';\n status_text =\"Missing current password\";\n\n failure = msg;\n}\n\nif( msg.req.body.n_password_1 != msg.req.body.n_password_2 ) {\n\n status_colour = 'yellow';\n status_text = \"New password doesn't match\";\n\n failure = msg;\n\n}\n\nif( status_colour == 'red' ) {\n\n status_colour = 'green';\n status_text = \"form validation OK\";\n success = msg;\n\n}\n\nif (status_colour == 'yellow') {\n\n msg.payload = status_text;\n\n}\n\nnode.status({ fill: status_colour, shape: \"ring\", text: status_text });\n\nnode.send([\n success,\n failure\n]);",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 640,
"y": 1220,
"wires": [
[
"0239e19c34a9baaa"
],
[
"0efd3333091c9999"
]
],
"outputLabels": [
"Success",
"Failure"
],
"icon": "font-awesome/fa-question"
},
{
"id": "a6c8721721fc267e",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "3b247f5e5d90963e",
"name": "Response",
"mode": "link",
"links": [
"7db929503cf13635"
],
"x": 4740,
"y": 1320,
"wires": [],
"l": true
},
{
"id": "b75415bd2541b6df",
"type": "link in",
"z": "4b5e055cd6b1e387",
"g": "3b247f5e5d90963e",
"name": "Complete: Password Change",
"links": [
"0efd3333091c9999",
"815ce9e0380e642f",
"f17566766d0b5a53",
"53df7c8ab13e33de",
"f093762ba0afe7d2"
],
"x": 4560,
"y": 1320,
"wires": [
[
"a6c8721721fc267e"
]
],
"icon": "font-awesome/fa-flag-checkered",
"l": true
},
{
"id": "0efd3333091c9999",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "dba3741d6cc275c9",
"name": "Failed",
"mode": "link",
"links": [
"b75415bd2541b6df"
],
"x": 890,
"y": 1240,
"wires": [],
"icon": "font-awesome/fa-exclamation-circle",
"l": true
},
{
"id": "553d0da331015252",
"type": "link in",
"z": "4b5e055cd6b1e387",
"g": "f8ec4a6290dc7e20",
"name": "Process: Password Change",
"links": [
"0239e19c34a9baaa"
],
"x": 1220,
"y": 1220,
"wires": [
[
"6ef14d9fb582d42e"
]
],
"l": true
},
{
"id": "0239e19c34a9baaa",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "dba3741d6cc275c9",
"name": "Success",
"mode": "link",
"links": [
"553d0da331015252"
],
"x": 880,
"y": 1200,
"wires": [],
"icon": "font-awesome/fa-check-circle",
"l": true
},
{
"id": "c57cf198943aef16",
"type": "link in",
"z": "4b5e055cd6b1e387",
"g": "1e614fa32322f125",
"name": "Continue: Check Passwords",
"links": [
"1619699cd34defb4"
],
"x": 2360,
"y": 1220,
"wires": [
[
"aab2d165deacdab6"
]
],
"l": true
},
{
"id": "abef97c0bb13b432",
"type": "link call",
"z": "4b5e055cd6b1e387",
"g": "1e614fa32322f125",
"name": "",
"links": [
"c19ba5f86ea40757"
],
"linkType": "static",
"timeout": "30",
"x": 2830,
"y": 1220,
"wires": [
[
"23292bc7d78b9d1d"
]
]
},
{
"id": "aab2d165deacdab6",
"type": "change",
"z": "4b5e055cd6b1e387",
"g": "1e614fa32322f125",
"name": "Convert current password",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "req.body.c_password",
"tot": "msg"
},
{
"t": "set",
"p": "item",
"pt": "msg",
"to": "c_password",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2590,
"y": 1220,
"wires": [
[
"abef97c0bb13b432"
]
]
},
{
"id": "1619699cd34defb4",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "f8ec4a6290dc7e20",
"name": "Success",
"mode": "link",
"links": [
"c57cf198943aef16"
],
"x": 2060,
"y": 1200,
"wires": [],
"icon": "font-awesome/fa-check-circle",
"l": true
},
{
"id": "815ce9e0380e642f",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "f8ec4a6290dc7e20",
"name": "Failed",
"mode": "link",
"links": [
"b75415bd2541b6df"
],
"x": 2070,
"y": 1240,
"wires": [],
"icon": "font-awesome/fa-exclamation-circle",
"l": true
},
{
"id": "23292bc7d78b9d1d",
"type": "function",
"z": "4b5e055cd6b1e387",
"g": "1e614fa32322f125",
"name": "Check Current Password",
"func": "var success = null;\nvar failure = null;\n\n// delete msg.payload.n_password_1.item;\n// delete msg.payload.n_password_1.ldap;\n// delete msg.payload.n_password_1.rc;\n// delete msg.payload.n_password_1._event;\n\n//var new_msg = msg.payload.n_password_1;\n// var new_msg = {};\n\n// new_msg.req = msg.payload.c_password.req;\n// new_msg.res = msg.payload.c_password.res;\n// new_msg._msgid = msg.payload.c_password._msgid;\n// new_msg.ldap = msg.payload.c_password.ldap;\n// new_msg.cookies = msg.payload.c_password.cookies;\n\nif ( msg.payload == msg.ldap.userPassword ) {\n\n node.status({fill:\"green\",shape:\"ring\",text:\"Current Password Matches\"});\n\n success = msg;\n\n} else {\n\n msg.payload = String(\"Current Password Incorrect\");\n\n node.status({ fill: \"yellow\", shape: \"ring\", text: msg.payload });\n\n failure = msg;\n\n}\n\nnode.send([\n success,\n failure\n]);\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 3090,
"y": 1220,
"wires": [
[
"ffaae19e230436cf"
],
[
"f17566766d0b5a53"
]
],
"outputLabels": [
"Success",
"Failure"
],
"icon": "font-awesome/fa-lock",
"info": "# Check Current Password\n\nConfirm that the user entered password matches the current password store within LDAP.\n\nOutputs are:\n\n- success, password matches\n\n- failure, password does not matches\n"
},
{
"id": "f17566766d0b5a53",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "1e614fa32322f125",
"name": "Failed",
"mode": "link",
"links": [
"b75415bd2541b6df"
],
"x": 3290,
"y": 1240,
"wires": [],
"icon": "font-awesome/fa-exclamation-circle",
"l": true
},
{
"id": "ffaae19e230436cf",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "1e614fa32322f125",
"name": "Success",
"mode": "link",
"links": [
"5897178ac3448e41"
],
"x": 3280,
"y": 1200,
"wires": [],
"icon": "font-awesome/fa-unlock",
"l": true
},
{
"id": "5897178ac3448e41",
"type": "link in",
"z": "4b5e055cd6b1e387",
"g": "0c16bf9634323276",
"name": "Change Users Password",
"links": [
"ffaae19e230436cf"
],
"x": 3530,
"y": 1220,
"wires": [
[
"f8b9e1b1537129ec"
]
],
"icon": "font-awesome/fa-rotate-right",
"l": true
},
{
"id": "e7fa19cf8785fd90",
"type": "ldap-update in",
"z": "4b5e055cd6b1e387",
"g": "0c16bf9634323276",
"name": "Update Password",
"ldap": "160d0b5ed597dc51",
"operation": "replace",
"dn": "",
"attribute": "userPassword",
"value": "",
"x": 4290,
"y": 1220,
"wires": [
[
"7b9797b6bc354e56"
]
]
},
{
"id": "f16ae7601e3dce19",
"type": "link call",
"z": "4b5e055cd6b1e387",
"g": "0c16bf9634323276",
"name": "Convert Password to LDAP Hashed Password",
"links": [
"c19ba5f86ea40757"
],
"linkType": "static",
"timeout": "30",
"x": 4000,
"y": 1220,
"wires": [
[
"e7fa19cf8785fd90"
]
]
},
{
"id": "f8b9e1b1537129ec",
"type": "change",
"z": "4b5e055cd6b1e387",
"g": "0c16bf9634323276",
"name": "Prepare LDAP data",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$string(msg.req.body.n_password_1)",
"tot": "jsonata"
},
{
"t": "set",
"p": "dn",
"pt": "msg",
"to": "ldap.dn",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 3730,
"y": 1220,
"wires": [
[
"f16ae7601e3dce19"
]
]
},
{
"id": "7b9797b6bc354e56",
"type": "function",
"z": "4b5e055cd6b1e387",
"g": "0c16bf9634323276",
"name": "Check Current Password",
"func": "var success = null;\nvar failure = msg;\n\nvar status_colour = 'yellow';\nvar status_text = 'Failure, password not changed';\n\nmsg.payload = status_text;\n\nif (msg.ldapStatus.success ) {\n\n status_colour = 'green';\n status_text = \"Password Changed\";\n\n msg.payload = status_text;\n\n success = msg;\n failure = null;\n\n}\n\nnode.status({ fill: status_colour, shape: \"ring\", text: status_text });\n\nnode.send([\n success,\n failure\n]);\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 4510,
"y": 1220,
"wires": [
[
"f093762ba0afe7d2"
],
[
"53df7c8ab13e33de"
]
],
"outputLabels": [
"Success",
"Failure"
],
"icon": "font-awesome/fa-question",
"info": "# Check Current Password\n\nConfirm that the user entered password matches the current password store within LDAP.\n\nOutputs are:\n\n- success, password matches\n\n- failure, password does not matches\n"
},
{
"id": "53df7c8ab13e33de",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "0c16bf9634323276",
"name": "Failed",
"mode": "link",
"links": [
"b75415bd2541b6df"
],
"x": 4730,
"y": 1240,
"wires": [],
"icon": "font-awesome/fa-exclamation-circle",
"l": true
},
{
"id": "f093762ba0afe7d2",
"type": "link out",
"z": "4b5e055cd6b1e387",
"g": "0c16bf9634323276",
"name": "Success",
"mode": "link",
"links": [
"b75415bd2541b6df"
],
"x": 4720,
"y": 1200,
"wires": [],
"icon": "font-awesome/fa-check-circle",
"l": true
},
{
"id": "0eeaba70b043a226",
"type": "exec",
"z": "8179bf22c4c31682",
"g": "0d96945ec7d069cb",
"command": "",
"addpay": "payload",
"append": "",
"useSpawn": "false",
"timer": "1",
"winHide": false,
"oldrc": false,
"name": "Run Hash Command",
"x": 620,
"y": 220,
"wires": [
[
"540882a95f65754c"
],
[],
[]
]
},
{
"id": "9c9c7bbd71c78d8e",
"type": "function",
"z": "8179bf22c4c31682",
"g": "0d96945ec7d069cb",
"name": "Create Hash Command",
"func": "\nmsg.payload = 'echo -n $(echo -n ' + msg.hash.string + '| ' + msg.hash.type + 'sum) | awk \\'{print $1 }\\' | tr -dc \\'A-Fa-f0-9\\'';\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 370,
"y": 220,
"wires": [
[
"0eeaba70b043a226"
]
]
},
{
"id": "43eebf1623f29074",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "0d96945ec7d069cb",
"name": "Hash String",
"links": [],
"x": 190,
"y": 220,
"wires": [
[
"9c9c7bbd71c78d8e"
]
],
"l": true
},
{
"id": "8fadd3c4294a6939",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "0d96945ec7d069cb",
"name": "Return",
"mode": "return",
"links": [],
"x": 990,
"y": 200,
"wires": [],
"l": true
},
{
"id": "540882a95f65754c",
"type": "function",
"z": "8179bf22c4c31682",
"g": "0d96945ec7d069cb",
"name": "Save Hash Value",
"func": "msg.hash.value = msg.payload;\n\ndelete msg.payload;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 850,
"y": 200,
"wires": [
[
"8fadd3c4294a6939"
]
]
},
{
"id": "8c13bbcc86d93be8",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "bcd2727d77a80ce3",
"name": "Hash: User-Questions-Filename",
"links": [],
"x": 250,
"y": 360,
"wires": [
[
"858268a5d48a4486"
]
],
"l": true
},
{
"id": "a35b8cc53c276d62",
"type": "link call",
"z": "8179bf22c4c31682",
"g": "bcd2727d77a80ce3",
"name": "",
"links": [
"43eebf1623f29074"
],
"linkType": "static",
"timeout": "30",
"x": 630,
"y": 360,
"wires": [
[
"0f2ff2f433d17eef"
]
]
},
{
"id": "858268a5d48a4486",
"type": "function",
"z": "8179bf22c4c31682",
"g": "bcd2727d77a80ce3",
"name": "Build: Hash Details",
"func": "msg.hash = {};\nmsg.hash.string = msg.user;\nmsg.hash.type = 'sha256';\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 470,
"y": 360,
"wires": [
[
"a35b8cc53c276d62"
]
]
},
{
"id": "998b007182d85455",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "bcd2727d77a80ce3",
"name": "Return",
"mode": "return",
"links": [],
"x": 930,
"y": 360,
"wires": [],
"l": true
},
{
"id": "0f2ff2f433d17eef",
"type": "function",
"z": "8179bf22c4c31682",
"g": "bcd2727d77a80ce3",
"name": "Build: Hash Details",
"func": "msg.filename = global.get('config.paths.user_data') + msg.hash.value + '.json'\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 790,
"y": 360,
"wires": [
[
"998b007182d85455"
]
]
},
{
"id": "804feccd90b3276c",
"type": "exec",
"z": "8179bf22c4c31682",
"g": "10a6c6b12749dda9",
"command": "bash -c \"tr -dc 'A-Za-z0-9' </dev/urandom | head -c 6 ; echo -n\"",
"addpay": "random",
"append": "",
"useSpawn": "false",
"timer": "1",
"winHide": false,
"oldrc": false,
"name": "Generate random 6 char string",
"x": 550,
"y": 520,
"wires": [
[
"c4e40d6f6678bb55"
],
[
"c4e40d6f6678bb55",
"e62119d30db09cce"
],
[]
]
},
{
"id": "869469819396a632",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "10a6c6b12749dda9",
"name": "Generate random 6 char string",
"links": [],
"x": 250,
"y": 520,
"wires": [
[
"804feccd90b3276c"
]
],
"l": true
},
{
"id": "c4e40d6f6678bb55",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "10a6c6b12749dda9",
"name": "Return",
"mode": "return",
"links": [],
"x": 810,
"y": 500,
"wires": [],
"l": true
},
{
"id": "e62119d30db09cce",
"type": "debug",
"z": "8179bf22c4c31682",
"g": "10a6c6b12749dda9",
"name": "STDERR",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 540,
"wires": []
},
{
"id": "33d710f97adb5298",
"type": "http request",
"z": "8179bf22c4c31682",
"g": "d7dbd3970c891c33",
"name": "User ITSM Search",
"method": "GET",
"ret": "txt",
"paytoqs": "body",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "Content-Type",
"keyValue": "",
"valueType": "application/json",
"valueValue": ""
}
],
"x": 990,
"y": 880,
"wires": [
[]
]
},
{
"id": "6aac3151138c4af9",
"type": "json",
"z": "8179bf22c4c31682",
"g": "d7dbd3970c891c33",
"name": "",
"property": "payload",
"action": "obj",
"pretty": false,
"x": 1750,
"y": 980,
"wires": [
[
"a888a2ed9a053acc"
]
]
},
{
"id": "b8c9f1cf125efd2e",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "9b1493c4ae19a935",
"name": "ITSM",
"links": [],
"x": 170,
"y": 700,
"wires": [
[
"f5cae04225998e3b"
]
],
"l": true
},
{
"id": "f5cae04225998e3b",
"type": "switch",
"z": "8179bf22c4c31682",
"g": "9b1493c4ae19a935",
"name": "ITSM Platform",
"property": "config.itsm.platform",
"propertyType": "global",
"rules": [
{
"t": "eq",
"v": "glpi",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 360,
"y": 700,
"wires": [
[
"002457f33834fc91"
],
[
"6840ab77f76439db"
]
]
},
{
"id": "002457f33834fc91",
"type": "link call",
"z": "8179bf22c4c31682",
"g": "9b1493c4ae19a935",
"name": "GLPI",
"links": [
"160bc27f7530e52d"
],
"linkType": "static",
"timeout": "30",
"x": 590,
"y": 680,
"wires": [
[
"d4d1ce730aa1c15b"
]
]
},
{
"id": "d4d1ce730aa1c15b",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "9b1493c4ae19a935",
"name": "Return",
"mode": "return",
"links": [],
"x": 730,
"y": 680,
"wires": [],
"l": true
},
{
"id": "160bc27f7530e52d",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "9858d84dc9d001be",
"name": "GLPI",
"links": [],
"x": 310,
"y": 960,
"wires": [
[
"4cdb1540cd4c8744"
]
],
"l": true
},
{
"id": "269cbacf5274d6d8",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "d7dbd3970c891c33",
"name": "Return",
"mode": "return",
"links": [],
"x": 2090,
"y": 980,
"wires": [],
"l": true
},
{
"id": "6840ab77f76439db",
"type": "debug",
"z": "8179bf22c4c31682",
"g": "9b1493c4ae19a935",
"name": "ITSM Platform Doesn't exist",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 660,
"y": 720,
"wires": []
},
{
"id": "42f157ed01b737f4",
"type": "change",
"z": "8179bf22c4c31682",
"g": "d7dbd3970c891c33",
"name": "User",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.data",
"tot": "msg"
},
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "http://nodered:1880/api/user",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 830,
"y": 980,
"wires": [
[
"a9cfd4c1413c7ec6"
]
]
},
{
"id": "4cdb1540cd4c8744",
"type": "switch",
"z": "8179bf22c4c31682",
"g": "9858d84dc9d001be",
"name": "Action",
"property": "payload.action",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "search",
"vt": "str"
},
{
"t": "eq",
"v": "create",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 3,
"x": 430,
"y": 960,
"wires": [
[
"0676d69c05236349"
],
[
"edbb6827a8b33085"
],
[]
]
},
{
"id": "0676d69c05236349",
"type": "switch",
"z": "8179bf22c4c31682",
"g": "9858d84dc9d001be",
"name": "Search",
"property": "payload.action_for",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "user",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 640,
"y": 940,
"wires": [
[
"42f157ed01b737f4"
],
[]
]
},
{
"id": "edbb6827a8b33085",
"type": "switch",
"z": "8179bf22c4c31682",
"g": "9858d84dc9d001be",
"name": "Create",
"property": "payload.action_for",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "ticket",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 630,
"y": 1040,
"wires": [
[
"d4de6eab89782579"
],
[]
]
},
{
"id": "d4de6eab89782579",
"type": "change",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"name": "Ticket",
"rules": [],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 830,
"y": 1100,
"wires": [
[
"246331e1c052e1f8"
]
]
},
{
"id": "c6c63174053774b7",
"type": "change",
"z": "8179bf22c4c31682",
"name": "Build Command",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "'echo -n \"{sha512}$(echo -n \"$(echo -n ' & msg.payload &'| sha512sum)\" | xxd -r -p | openssl enc -base64 | tr -dc \"A-Za-z0-9+\\\\/=\")\"'",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1620,
"y": 360,
"wires": [
[
"0a8a08fff2cf8bc6",
"38ef027aea02e3b9"
]
]
},
{
"id": "0a8a08fff2cf8bc6",
"type": "debug",
"z": "8179bf22c4c31682",
"name": "debug 51",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1800,
"y": 320,
"wires": []
},
{
"id": "38ef027aea02e3b9",
"type": "exec",
"z": "8179bf22c4c31682",
"command": "",
"addpay": "payload",
"append": "",
"useSpawn": "false",
"timer": "",
"winHide": false,
"oldrc": false,
"name": "Generate LDAP Password String",
"x": 1880,
"y": 360,
"wires": [
[
"0041766d05e6184c",
"55a05bb281e1f7a8"
],
[
"f284a3ecbe8cdbe6",
"55a05bb281e1f7a8"
],
[
"00064453b16cedac"
]
]
},
{
"id": "0041766d05e6184c",
"type": "debug",
"z": "8179bf22c4c31682",
"name": "debug 53",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2160,
"y": 280,
"wires": []
},
{
"id": "f284a3ecbe8cdbe6",
"type": "debug",
"z": "8179bf22c4c31682",
"name": "debug 54",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2160,
"y": 400,
"wires": []
},
{
"id": "00064453b16cedac",
"type": "debug",
"z": "8179bf22c4c31682",
"name": "debug 55",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2160,
"y": 440,
"wires": []
},
{
"id": "c19ba5f86ea40757",
"type": "link in",
"z": "8179bf22c4c31682",
"name": "LDAP Password String {sha256}",
"links": [],
"x": 1410,
"y": 360,
"wires": [
[
"c6c63174053774b7"
]
],
"l": true
},
{
"id": "55a05bb281e1f7a8",
"type": "link out",
"z": "8179bf22c4c31682",
"name": "Return",
"mode": "return",
"links": [],
"x": 2150,
"y": 340,
"wires": [],
"l": true
},
{
"id": "f17afdbfc8c07889",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "bbd929c437c592ea",
"name": "Authentication Begin",
"links": [],
"x": 210,
"y": 1580,
"wires": [
[
"f9550cdd015b52ae"
]
],
"icon": "node-red/arrow-in.svg",
"l": true
},
{
"id": "6c790a65bbdc61a5",
"type": "function",
"z": "8179bf22c4c31682",
"g": "bbd929c437c592ea",
"name": "Auth Type",
"func": "var token = null;\nvar auth = null;\n\nvar use_cookie = false;\nvar use_token = false;\n\nmsg.auth = {\n \"access\": false\n};\n\n//node.warn(Object.keys(msg.req.cookies || {}).length);\n\nif (Object.keys(msg.req.query || {}).length > 0) {\n node.status({ fill: \"yellow\", shape: \"ring\", text: \"Incomplete, use cookie token\" });\n\n if (msg.req.query.hasOwnProperty(\"token\")) {\n node.status({ fill: \"yellow\", shape: \"ring\", text: \"Incomplete, use cookie has token\" });\n\n use_token = true;\n\n }\n} else if( Object.keys(msg.req.cookies || {}).length > 0 ) {\n \n if (msg.req.cookies.hasOwnProperty(\"token\")) {\n\n node.status({ fill: \"yellow\", shape: \"ring\", text: \"Incomplete, use cookie token\" });\n\n use_cookie = true;\n\n}\n}\n\nif (use_cookie) {\n node.status({ fill: \"green\", shape: \"ring\", text: \"Use cookie token\" });\n\n msg.filename = global.get('config.paths.token_sessions') + msg.req.cookies.token + '.json';\n msg.cookie_exists = true;\n msg.token = msg.req.cookies.token;\n token = msg;\n\n} else if (use_token) {\n node.status({ fill: \"green\", shape: \"ring\", text: \"Use query string token\" });\n\n msg.filename = global.get('config.paths.token_sessions') + msg.req.query.token + '.json';\n msg.cookie_exists = false;\n msg.token = msg.req.query.token;\n token = msg;\n\n} else {\n node.status({ fill: \"blue\", shape: \"ring\", text: \"Use other auth method\" });\n\n auth = msg;\n}\n\nnode.send([token, auth]);\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 200,
"y": 1840,
"wires": [
[
"bc039e4b516adf37"
],
[
"627a72eee1e26ae6"
]
],
"outputLabels": [
"Token",
"Auth"
]
},
{
"id": "bc039e4b516adf37",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "bbd929c437c592ea",
"name": "Token",
"mode": "link",
"links": [],
"x": 350,
"y": 1820,
"wires": [],
"l": true
},
{
"id": "627a72eee1e26ae6",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "bbd929c437c592ea",
"name": "OpenID",
"mode": "link",
"links": [
"9f416bc258c1a60c",
"566184a95b7ad334"
],
"x": 360,
"y": 1860,
"wires": [],
"l": true
},
{
"id": "9f416bc258c1a60c",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "7225c45ad941c14f",
"name": "Oauth2: Begin",
"links": [
"627a72eee1e26ae6"
],
"x": 750,
"y": 2300,
"wires": [
[]
],
"icon": "node-red/arrow-in.svg",
"l": true
},
{
"id": "d20869bcacd7b0fd",
"type": "link call",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"name": "",
"links": [
"aa3f79a3aae107ec"
],
"linkType": "static",
"timeout": "30",
"x": 1510,
"y": 1100,
"wires": [
[
"6492bc8146326691"
]
]
},
{
"id": "525cc01f4d41ae0b",
"type": "template",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"name": "GLPI: Build Data",
"field": "form",
"fieldType": "msg",
"format": "json",
"syntax": "mustache",
"template": "{\n \"approval_required\": {{ payload.data.ticket.approval_required }},\n \"data\": {\n {{ payload.data }}\n },\n \"name\": \"\",\n \"requester_id\": {{ itsm.user.id }},\n \"requesttypes_id\": {{ payload.data.ticket.requesttype_id }},\n \"ticket_category\": {{ payload.data.ticket.category_id }},\n \"ticket_entity\": {{ payload.data.ticket.entity_id }}\n}\n",
"output": "str",
"x": 910,
"y": 1240,
"wires": [
[
"2663cccd5d6ca575"
]
]
},
{
"id": "45d7aa8b4b386bb7",
"type": "json",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"name": "",
"property": "form",
"action": "obj",
"pretty": false,
"x": 1110,
"y": 1220,
"wires": [
[
"2663cccd5d6ca575"
]
]
},
{
"id": "6492bc8146326691",
"type": "switch",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"name": "Route Ticket Packets",
"property": "glpi.msg_routing",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "ticket_task_creation_automation",
"vt": "str"
},
{
"t": "eq",
"v": "ticket_creation",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 3,
"x": 1960,
"y": 1100,
"wires": [
[
"2545718f1853e084"
],
[
"e363219f4309eedb"
],
[
"1840577fd414a84d"
]
]
},
{
"id": "803a8b65fc7a5087",
"type": "change",
"z": "8179bf22c4c31682",
"g": "85fa24886e126df7",
"name": "",
"rules": [
{
"t": "set",
"p": "itsm_ticket",
"pt": "msg",
"to": "payload",
"tot": "msg"
},
{
"t": "set",
"p": "parts.index",
"pt": "msg",
"to": "0",
"tot": "num"
},
{
"t": "set",
"p": "method",
"pt": "msg",
"to": "POST",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2340,
"y": 1300,
"wires": [
[
"96766518a046855d"
]
]
},
{
"id": "2663cccd5d6ca575",
"type": "function",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"name": "Multi-Message Check",
"func": "\nmsg.config = global.get('config');\n\nif ( global.get('config.itsm.create_ticket_task') ) {\n\n msg.parts = String('{ \"id\": \"ticket_creation\", \"count\": 2 }');\n msg.parts = JSON.parse(msg.parts);\n\n}else{\n\n msg.parts = String('{ \"id\": \"ticket_creation\", \"count\": 1 }');\n msg.parts = JSON.parse(msg.parts);\n\n}\n\n\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1260,
"y": 1100,
"wires": [
[
"d20869bcacd7b0fd"
]
]
},
{
"id": "96766518a046855d",
"type": "template",
"z": "8179bf22c4c31682",
"g": "85fa24886e126df7",
"name": "Ticket Solution JSON Body",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "mustache",
"template": "{\n \"input\": {\n \"itemtype\": \"Ticket\",\n \"items_id\": {{ itsm_ticket.id }},\n \"content\": \"Your Password has been reset.\\n\\n the second half of your password is: {{ password_second_half }}\",\n \"status\": 2\n }\n}\n ",
"output": "json",
"x": 2540,
"y": 1300,
"wires": [
[
"242b471ad711a4f1"
]
]
},
{
"id": "1305e2f195ec5ede",
"type": "link call",
"z": "8179bf22c4c31682",
"g": "85fa24886e126df7",
"name": "GLPI Ticket Solution",
"links": [
"eb5f283400263c25"
],
"linkType": "static",
"timeout": "30",
"x": 3100,
"y": 1300,
"wires": [
[
"40208ed719417cac"
]
]
},
{
"id": "242b471ad711a4f1",
"type": "template",
"z": "8179bf22c4c31682",
"g": "85fa24886e126df7",
"name": "Create GLPI Solution URL",
"field": "url",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{{{ global.config.itsm.api_url }}}Ticket/{{ itsm_ticket.id }}/ITILSolution/",
"output": "str",
"x": 2880,
"y": 1300,
"wires": [
[
"1305e2f195ec5ede"
]
]
},
{
"id": "285f57c0fee687a1",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "85fa24886e126df7",
"name": "Update Ticket Task Part 2/2",
"mode": "link",
"links": [
"c2f8e99492223cfb"
],
"x": 3560,
"y": 1300,
"wires": [],
"l": true
},
{
"id": "5eda003868c5e354",
"type": "debug",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"name": "GLPI: Ticket Complete",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 4640,
"y": 1380,
"wires": []
},
{
"id": "ed5a0fab59b28faa",
"type": "comment",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"name": "ToDo: On error Update ticket",
"info": "",
"x": 4600,
"y": 1300,
"wires": []
},
{
"id": "40208ed719417cac",
"type": "change",
"z": "8179bf22c4c31682",
"g": "85fa24886e126df7",
"name": "Save Ticket Solution",
"rules": [
{
"t": "set",
"p": "itsm_solution",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 3340,
"y": 1300,
"wires": [
[
"285f57c0fee687a1"
]
]
},
{
"id": "246331e1c052e1f8",
"type": "function",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"name": "msg.form",
"func": "\n\nmsg.form = {\n \"approval_required\": msg.payload.data.ticket.approval_required,\n \"data\": msg.payload.data,\n \"name\": \"\",\n \"requester_id\": msg.itsm.user.id,\n \"requesttypes_id\": msg.payload.data.ticket.requesttype_id,\n \"ticket_category\": msg.payload.data.ticket.category_id,\n \"ticket_entity\": msg.payload.data.ticket.entity_id,\n \"auto_assign\": true\n}\n\nmsg.task_category = global.get('config.itsm.ticket.task_category_id');\n\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 940,
"y": 1100,
"wires": [
[
"2663cccd5d6ca575"
]
]
},
{
"id": "587b497ce06d683f",
"type": "link call",
"z": "8179bf22c4c31682",
"g": "d7dbd3970c891c33",
"name": "GLPI User Search",
"links": [
"eb5f283400263c25"
],
"linkType": "static",
"timeout": "30",
"x": 1610,
"y": 980,
"wires": [
[
"6aac3151138c4af9"
]
]
},
{
"id": "f76da20ac475cf64",
"type": "function",
"z": "8179bf22c4c31682",
"g": "d7dbd3970c891c33",
"name": "function 1",
"func": "msg.ldap = msg.payload[0];\ndelete msg.payload;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 980,
"y": 920,
"wires": [
[]
]
},
{
"id": "a9cfd4c1413c7ec6",
"type": "change",
"z": "8179bf22c4c31682",
"g": "d7dbd3970c891c33",
"name": "Globals",
"rules": [
{
"t": "set",
"p": "authorization",
"pt": "msg",
"to": "glpi.authorization",
"tot": "global"
},
{
"t": "set",
"p": "app_token",
"pt": "msg",
"to": "glpi.app_token",
"tot": "global"
},
{
"t": "set",
"p": "api_url",
"pt": "msg",
"to": "config.itsm.api_url",
"tot": "global"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1040,
"y": 980,
"wires": [
[
"669724fdc876385d"
]
],
"icon": "font-awesome/fa-cogs"
},
{
"id": "669724fdc876385d",
"type": "link call",
"z": "8179bf22c4c31682",
"g": "d7dbd3970c891c33",
"name": "Fetch GLPI Session",
"links": [
"e930fc18412ba052"
],
"linkType": "static",
"timeout": "30",
"x": 1200,
"y": 980,
"wires": [
[
"65c3e138bbcd8b3a"
]
]
},
{
"id": "65c3e138bbcd8b3a",
"type": "template",
"z": "8179bf22c4c31682",
"g": "d7dbd3970c891c33",
"name": "Create GLPI Search URL",
"field": "url",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{{{ global.config.itsm.api_url }}}/User?searchText[name]={{ ldap.uid }}&searchText[firstname]={{ ldap.givenName }}&searchText[realname]={{ ldap.sn }}&searchText[sync_field]={{ ldap.uid }}",
"output": "str",
"x": 1410,
"y": 980,
"wires": [
[
"587b497ce06d683f"
]
]
},
{
"id": "a888a2ed9a053acc",
"type": "function",
"z": "8179bf22c4c31682",
"g": "d7dbd3970c891c33",
"name": "Search GLPI Results for user",
"func": "for( var i = 0; i < msg.payload.length; i++ ) {\n\n if (\n msg.payload[i].name == msg.ldap.uid\n &&\n msg.payload[i].firstname == msg.ldap.givenName\n &&\n msg.payload[i].realname == msg.ldap.sn\n &&\n msg.payload[i].user_dn == msg.ldap.dn\n &&\n msg.payload[i].sync_field == msg.ldap.uid\n &&\n Number(msg.payload[i].is_deleted) == 0\n &&\n Number(msg.payload[i].is_deleted_ldap) == 0\n ){\n \n msg.user = msg.payload[i];\n \n }\n}\n\ndelete msg.payload;\n\nmsg.payload = msg.user;\ndelete msg.user;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1920,
"y": 980,
"wires": [
[
"269cbacf5274d6d8"
]
]
},
{
"id": "e8f257b38aa4d749",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"name": "Return",
"mode": "return",
"links": [],
"x": 4590,
"y": 1340,
"wires": [],
"l": true
},
{
"id": "fb6750555645b873",
"type": "change",
"z": "8179bf22c4c31682",
"g": "351440700b3e2ecc",
"name": "",
"rules": [
{
"t": "set",
"p": "itsm_task",
"pt": "msg",
"to": "payload",
"tot": "msg"
},
{
"t": "set",
"p": "parts.index",
"pt": "msg",
"to": "1",
"tot": "num"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2360,
"y": 1160,
"wires": [
[
"e0660324da4581dd"
]
]
},
{
"id": "e0660324da4581dd",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "351440700b3e2ecc",
"name": "Update Ticket Task Part 1/2",
"mode": "link",
"links": [
"c2f8e99492223cfb"
],
"x": 2600,
"y": 1160,
"wires": [],
"l": true
},
{
"id": "eacbafc05d06b95a",
"type": "link call",
"z": "8179bf22c4c31682",
"g": "f17ccfa845461657",
"name": "GLPI: Automation Task Duration",
"links": [
"eb5f283400263c25"
],
"linkType": "static",
"timeout": "30",
"x": 4250,
"y": 1160,
"wires": [
[
"f57f557a25d166b7"
]
]
},
{
"id": "76cd564b69443419",
"type": "change",
"z": "8179bf22c4c31682",
"g": "f17ccfa845461657",
"name": "msg.method",
"rules": [
{
"t": "set",
"p": "method",
"pt": "msg",
"to": "PUT",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 4030,
"y": 1160,
"wires": [
[
"eacbafc05d06b95a"
]
]
},
{
"id": "ca1b9c48c3c0c522",
"type": "template",
"z": "8179bf22c4c31682",
"g": "f17ccfa845461657",
"name": "GLPI: Ticket Task URL",
"field": "url",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "{{{ global.config.itsm.api_url }}}Ticket/{{ itsm.ticket.id }}/TicketTask/{{ itsm.ticket_task.id }}",
"output": "str",
"x": 3800,
"y": 1160,
"wires": [
[
"76cd564b69443419"
]
]
},
{
"id": "d64e9c631ee7ec87",
"type": "template",
"z": "8179bf22c4c31682",
"g": "f17ccfa845461657",
"name": "Task time JSON Body",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "mustache",
"template": "{\n \"input\": {\n \"id\": \"{{ itsm.ticket_task.id }}\",\n \"actiontime\": 5,\n \"state\": 2\n }\n}\n",
"output": "json",
"x": 3600,
"y": 1160,
"wires": [
[
"ca1b9c48c3c0c522"
]
]
},
{
"id": "cafa50da13d9e5d9",
"type": "join",
"z": "8179bf22c4c31682",
"g": "f17ccfa845461657",
"name": "Combine Ticket and Ticket Task Packets",
"mode": "custom",
"build": "merged",
"property": "",
"propertyType": "full",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": true,
"timeout": "1",
"count": "2",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "num",
"reduceFixup": "",
"x": 3220,
"y": 1160,
"wires": [
[
"fdf014eff1962329"
]
],
"info": "after two messages, the password has been changed"
},
{
"id": "c2f8e99492223cfb",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "f17ccfa845461657",
"name": "Process: Update Ticket Task",
"links": [
"e0660324da4581dd",
"285f57c0fee687a1"
],
"x": 2940,
"y": 1160,
"wires": [
[
"cafa50da13d9e5d9"
]
],
"l": true
},
{
"id": "fdf014eff1962329",
"type": "function",
"z": "8179bf22c4c31682",
"g": "f17ccfa845461657",
"name": "function 2",
"func": "\nmsg.itsm = {\n \"ticket\": msg.itsm_ticket,\n \"ticket_task\": msg.itsm_task,\n \"solution\": msg.itsm_solution,\n \"user\": msg.itsm.user\n}\ndelete msg.itsm_ticket;\ndelete msg.itsm_task;\ndelete msg.itsm_solution;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 3440,
"y": 1160,
"wires": [
[
"d64e9c631ee7ec87"
]
]
},
{
"id": "5a961504d7ca5be3",
"type": "debug",
"z": "8179bf22c4c31682",
"g": "ed0645c12f7435b2",
"name": "debug 67",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2580,
"y": 1360,
"wires": []
},
{
"id": "9cbf4beaceba5255",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "bcaed4334222c14a",
"name": "Session: Oauth2",
"mode": "link",
"links": [
"b4a253cb29efc244",
"20aae4d90a07f156"
],
"x": 1690,
"y": 1580,
"wires": [],
"icon": "node-red/arrow-in.svg",
"l": true
},
{
"id": "f20711a44b43b7d4",
"type": "debug",
"z": "8179bf22c4c31682",
"g": "bcaed4334222c14a",
"name": "debug 149",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1490,
"y": 1660,
"wires": []
},
{
"id": "2a858bd15a2d257e",
"type": "function",
"z": "8179bf22c4c31682",
"g": "bcaed4334222c14a",
"name": "Session Type",
"func": "var oauth2 = null;\nvar token = null;\n\nvar status = {fill:\"red\",shape:\"ring\",text:\"ERR: Incomplete\"};\n\nmsg.session = JSON.parse(msg.payload);\ndelete msg.payload;\n\nif( msg.session.type == 'oauth2' ) {\n\n status.text = \"Oauth2\";\n status.fill = 'blue';\n oauth2 = msg;\n\n} else if( msg.session.type == 'token' ) {\n\n status.text = \"Token\";\n status.fill = 'green';\n token = msg;\n\n}\n\nnode.status(status);\n\nnode.send([\n oauth2,\n token\n]);",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1500,
"y": 1600,
"wires": [
[
"9cbf4beaceba5255"
],
[
"da0811fbd7963934"
]
],
"outputLabels": [
"Oauth2",
"Token"
],
"icon": "font-awesome/fa-question",
"info": "ToDo: add date check of session file"
},
{
"id": "e897aec8ea7c81c5",
"type": "file in",
"z": "8179bf22c4c31682",
"g": "bcaed4334222c14a",
"name": "Fetch Saved session",
"filename": "filename",
"filenameType": "msg",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 1300,
"y": 1600,
"wires": [
[
"f20711a44b43b7d4",
"2a858bd15a2d257e"
]
]
},
{
"id": "9c05ca2751f619a7",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "bcaed4334222c14a",
"name": "No Saved Session",
"mode": "link",
"links": [
"e80aabc47c664088"
],
"x": 1290,
"y": 1640,
"wires": [],
"icon": "font-awesome/fa-lock",
"l": true,
"info": "# No Saved Session\n\n> No Session could be found with the cookie value\n\nThis path has set HTTP/303 with the location set to the oauth2 provider authentication url."
},
{
"id": "2dee51842e868755",
"type": "debug",
"z": "8179bf22c4c31682",
"g": "bcaed4334222c14a",
"name": "debug 148",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1270,
"y": 1680,
"wires": []
},
{
"id": "73b63d7562fe9cce",
"type": "function",
"z": "8179bf22c4c31682",
"g": "bcaed4334222c14a",
"name": "Session: Load and Check",
"func": "var have_session = null;\nvar no_session = msg;\n\nvar status = { fill: \"red\", shape: \"ring\", text: \"incomplete\"};\n\nvar url = '/auth';\n\nvar filename = msg.req.cookies.auth + '.json';\n\nif ( msg.req.cookies.hasOwnProperty('auth')) {\n\n fs.stat( filename, function (err) {\n\n if (err) {\n status.text = \"No Saved Session\";\n status.fill = \"yellow\";\n\n var auth_url = \"https://auth.nofusscomputing.com/realms/NoFussComputing/protocol/openid-connect/auth?response_type=code&client_id=boowho&redirect_uri=\" + encodeURIComponent(\"http://127.0.0.1:1880/callback\") + \"&scope=openid&state=\" + String(Date.now());\n\n msg.statusCode = 303;\n\n msg.headers = {\n Location: auth_url\n }\n\n } else {\n status.text = \"Saved Session Exists\";\n status.fill = \"green\";\n\n msg.filename = filename;\n\n have_session = msg;\n no_session = null;\n\n }\n\n node.status(status);\n\n node.send([\n have_session,\n no_session\n ]);\n\n })\n\n} else{\n \n status.text = \"No Cookie\";\n status.fill = \"yellow\";\n \n node.status(status);\n\n node.send([\n have_session,\n no_session\n ]);\n}\n\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [
{
"var": "fs",
"module": "fs"
}
],
"x": 1030,
"y": 1620,
"wires": [
[
"e897aec8ea7c81c5"
],
[
"2dee51842e868755",
"9c05ca2751f619a7"
]
],
"outputLabels": [
"Session Found",
"Session Not Found"
],
"icon": "font-awesome/fa-question",
"info": "\nsuccess = session found from cookie value\nfailure = need to logon, redirect"
},
{
"id": "33f25da80ef87e72",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "bcaed4334222c14a",
"name": "Cookie: Begin Validation",
"links": [
"5c30dbcce4f3e71e",
"f9550cdd015b52ae"
],
"x": 790,
"y": 1620,
"wires": [
[
"73b63d7562fe9cce"
]
],
"icon": "font-awesome/fa-unlock-alt",
"l": true
},
{
"id": "da0811fbd7963934",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "bcaed4334222c14a",
"name": "Session: Token",
"mode": "link",
"links": [
"8b1fef39c34f5513"
],
"x": 1680,
"y": 1620,
"wires": [],
"icon": "node-red/arrow-in.svg",
"l": true
},
{
"id": "20aae4d90a07f156",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "dbe86357f31c79d1",
"name": "Session: Oauth2",
"links": [
"9cbf4beaceba5255"
],
"x": 1020,
"y": 2340,
"wires": [
[]
],
"icon": "node-red/arrow-in.svg",
"l": true
},
{
"id": "c10e09e4bfbddfd7",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "cc33365c2aa59e35",
"name": "Token: Finish",
"links": [
"366892fde876296f",
"9c55bf6229fa740c",
"95f44fbb0ddd39fc"
],
"x": 1630,
"y": 2060,
"wires": [
[
"53a5ee55ee916cec"
]
],
"icon": "font-awesome/fa-flag-checkered",
"l": true
},
{
"id": "53a5ee55ee916cec",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "cc33365c2aa59e35",
"name": "Token: Return",
"mode": "link",
"links": [
"e80aabc47c664088"
],
"x": 1780,
"y": 2060,
"wires": [],
"icon": "node-red/arrow-in.svg",
"l": true
},
{
"id": "366892fde876296f",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "75c44e5f7f101beb",
"name": "Fail: Token Check",
"mode": "link",
"links": [
"c10e09e4bfbddfd7"
],
"x": 1430,
"y": 1880,
"wires": [],
"icon": "font-awesome/fa-refresh",
"l": true
},
{
"id": "42a1e057dda56f95",
"type": "function",
"z": "8179bf22c4c31682",
"g": "75c44e5f7f101beb",
"name": "Validate Token File",
"func": "var success = null;\nvar failure = null;\n\nif( msg.session.datetime > Date.now() ) {\n\n if( msg.session.hasOwnProperty(\"user\") ) {\n\n if (\n msg.session.user.hasOwnProperty(\"fname\") &&\n msg.session.user.hasOwnProperty(\"lname\") &&\n msg.session.user.hasOwnProperty(\"username\") &&\n msg.session.user.hasOwnProperty(\"mail\")\n ) {\n\n node.status({ fill: \"green\", shape: \"ring\", text: \"Authorized\" });\n msg.auth.access = true;\n msg.auth.user = msg.session.user;\n\n msg.cookies = {\n token: {\n value: String(msg.token),\n expires: 0\n }\n };\n\n delete msg.token;\n delete msg.payload;\n success = msg\n\n } else {\n\n node.status({ fill: \"grey\", shape: \"ring\", text: \"Missing User details, not Authorized\" });\n \n delete msg.token;\n delete msg.payload;\n failure = msg;\n\n }\n } else{\n\n node.status({ fill: \"grey\", shape: \"ring\", text: \"Missing User, not Authorized\" });\n\n delete msg.token;\n delete msg.payload;\n failure = msg;\n\n }\n \n\n} else {\n\n node.status({ fill: \"yellow\", shape: \"ring\", text: \"Not Authorized\" });\n delete msg.token;\n delete msg.payload;\n failure = msg;\n}\n\n\nnode.send([success, failure]);",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [
{
"var": "fs",
"module": "fs"
}
],
"x": 1210,
"y": 1860,
"wires": [
[
"95f44fbb0ddd39fc"
],
[
"366892fde876296f"
]
],
"outputLabels": [
"True",
"False"
]
},
{
"id": "8b1fef39c34f5513",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "75c44e5f7f101beb",
"name": "Session: Token",
"links": [
"da0811fbd7963934"
],
"x": 1000,
"y": 1860,
"wires": [
[
"42a1e057dda56f95"
]
],
"icon": "node-red/arrow-in.svg",
"l": true
},
{
"id": "95f44fbb0ddd39fc",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "75c44e5f7f101beb",
"name": "Success: Token Check",
"mode": "link",
"links": [
"c10e09e4bfbddfd7"
],
"x": 1440,
"y": 1840,
"wires": [],
"icon": "font-awesome/fa-unlock",
"l": true
},
{
"id": "e80aabc47c664088",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "bbd929c437c592ea",
"name": "Auth: Finish",
"links": [
"53a5ee55ee916cec",
"9c05ca2751f619a7",
"8ad6190854001584"
],
"x": 2250,
"y": 2360,
"wires": [
[
"724a142f28c3b6e4"
]
],
"icon": "font-awesome/fa-flag-checkered",
"l": true
},
{
"id": "724a142f28c3b6e4",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "bbd929c437c592ea",
"name": "Auth: Return",
"mode": "return",
"links": [],
"x": 2390,
"y": 2360,
"wires": [],
"l": true
},
{
"id": "f9550cdd015b52ae",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "bbd929c437c592ea",
"name": "Cookie Check",
"mode": "link",
"links": [
"33f25da80ef87e72"
],
"x": 380,
"y": 1580,
"wires": [],
"icon": "node-red/arrow-in.svg",
"l": true
},
{
"id": "a4bc5830daf9801a",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "cc33365c2aa59e35",
"name": "Token: Begin",
"links": [],
"x": 750,
"y": 1820,
"wires": [
[]
],
"icon": "node-red/arrow-in.svg",
"l": true
},
{
"id": "1fe34e17a81dce9e",
"type": "http in",
"z": "8179bf22c4c31682",
"g": "7225c45ad941c14f",
"name": "",
"url": "/callback",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 750,
"y": 2220,
"wires": [
[
"bc5ca736a6e324e5"
]
]
},
{
"id": "bc5ca736a6e324e5",
"type": "function",
"z": "8179bf22c4c31682",
"g": "7225c45ad941c14f",
"name": "Valid",
"func": "msg.token_refresh = false;\n\nvar callback = null;\nvar request = msg;\n\nvar status = { fill: \"red\", shape: \"ring\", text: \"Incomplete\" }\n\n\nif( Object.keys(msg.req.query || {}).length > 0 ){\n\n if (\n msg.req.query.hasOwnProperty('state') &&\n msg.req.query.hasOwnProperty('session_state') &&\n msg.req.query.hasOwnProperty('code')\n ){\n\n status.text = \"Callback\";\n msg.oauth2 = msg.payload;\n delete msg.payload;\n \n callback = msg;\n request = null;\n\n }\n\n} else if (Object.keys(msg.req.cookie || {}).length > 0) {\n \n \n} else {\n\n status.text = \"Request\";\n callback = null;\n request = msg;\n\n}\n\nnode.status(status);\n\nnode.send([\n callback,\n request\n]);\n",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 870,
"y": 2220,
"wires": [
[
"60a97c78327c3a6a"
],
[
"8964a5bda9eb7113"
]
],
"outputLabels": [
"Callback",
"Request"
],
"icon": "font-awesome/fa-question",
"info": "# Query Type\n\nThere are two types of query:\n\n- callback\n\n- request\n\n## Callback\n\nA user has authenticated with the oauth2 provider, with the details of the authentication contained in the request. \nFurther processing is required for the user to be granted access.\n\nDuring the processing, a auth cookie must be set so that authentication confirmation can occur in subsequent non-callback requests.\n\n## Request\n\nA Normal non-callback `GET` request that is assumed to be the users web browser. This path must confirm if the users cookie is present and load the user details using the value of a cookie from the session cache.\n"
},
{
"id": "60a97c78327c3a6a",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "7225c45ad941c14f",
"name": "Callback Valid",
"mode": "link",
"links": [
"de76019e24c52ae0"
],
"x": 1040,
"y": 2200,
"wires": [],
"icon": "node-red/arrow-in.svg",
"l": true
},
{
"id": "8964a5bda9eb7113",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "7225c45ad941c14f",
"name": "HTTP/400",
"mode": "link",
"links": [
"21ec376b58ac0c54"
],
"x": 1030,
"y": 2240,
"wires": [],
"icon": "font-awesome/fa-exclamation-triangle",
"l": true
},
{
"id": "21ec376b58ac0c54",
"type": "link in",
"z": "8179bf22c4c31682",
"g": "7225c45ad941c14f",
"name": "Oauth2: Finish",
"links": [
"8964a5bda9eb7113"
],
"x": 1640,
"y": 2400,
"wires": [
[
"8ad6190854001584"
]
],
"icon": "font-awesome/fa-flag-checkered",
"l": true
},
{
"id": "8ad6190854001584",
"type": "link out",
"z": "8179bf22c4c31682",
"g": "7225c45ad941c14f",
"name": "Oauth2: Return",
"mode": "link",
"links": [
"e80aabc47c664088"
],
"x": 1780,
"y": 2400,
"wires": [],
"icon": "node-red/arrow-in.svg",
"l": true
},
{
"id": "17f893c2bb347668",
"type": "inject",
"z": "104f7938a23fe82f",
"name": "Start",
"props": [
{
"p": "payload"
}
],
"repeat": "300",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "3",
"payloadType": "num",
"x": 110,
"y": 220,
"wires": [
[
"a740ac24fa947f73"
]
]
},
{
"id": "6dc681185dff1d75",
"type": "comment",
"z": "104f7938a23fe82f",
"name": "Flow Start",
"info": "Flow Start",
"x": 100,
"y": 140,
"wires": []
},
{
"id": "82183bee2dd412fe",
"type": "change",
"z": "104f7938a23fe82f",
"name": "Debug",
"rules": [
{
"t": "set",
"p": "debug_on",
"pt": "global",
"to": "config.glpi.debug_on",
"tot": "global"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1130,
"y": 220,
"wires": [
[
"cd999564657880cc",
"4146b052670fb819"
]
],
"icon": "font-awesome/fa-cogs"
},
{
"id": "9587918c59375270",
"type": "inject",
"z": "104f7938a23fe82f",
"name": "Start: Manual Failsafe",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "2",
"payloadType": "num",
"x": 580,
"y": 180,
"wires": [
[
"4ab2787bb0227121"
]
]
},
{
"id": "ab1b24f61ae7f3bf",
"type": "debug",
"z": "104f7938a23fe82f",
"name": "Start",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 370,
"y": 260,
"wires": []
},
{
"id": "0097abc4a9b09076",
"type": "trigger",
"z": "104f7938a23fe82f",
"name": "fail safe: start flow",
"op1": "",
"op2": "4",
"op1type": "nul",
"op2type": "num",
"duration": "303",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 590,
"y": 260,
"wires": [
[
"a493231bd5231b91",
"4ab2787bb0227121"
]
]
},
{
"id": "a493231bd5231b91",
"type": "debug",
"z": "104f7938a23fe82f",
"name": "FailSafe: Session Start",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 280,
"wires": []
},
{
"id": "cd999564657880cc",
"type": "switch",
"z": "104f7938a23fe82f",
"name": "Debug No Auto-run",
"property": "debug_on",
"propertyType": "msg",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1410,
"y": 220,
"wires": [
[
"271a0053b235aad2"
],
[
"c2d23a114d11726f",
"e2fdc9ac8f0f5378"
]
]
},
{
"id": "271a0053b235aad2",
"type": "switch",
"z": "104f7938a23fe82f",
"name": "Manual Run Only",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "lt",
"v": "3",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1650,
"y": 180,
"wires": [
[
"d3ee1ecc22c74264",
"b365499ab7271965"
],
[
"0c185358cc65059b"
]
]
},
{
"id": "d3ee1ecc22c74264",
"type": "debug",
"z": "104f7938a23fe82f",
"name": "Debug on: Manual run only",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1980,
"y": 140,
"wires": []
},
{
"id": "0c185358cc65059b",
"type": "debug",
"z": "104f7938a23fe82f",
"name": "Debug: On, no autorun",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1960,
"y": 220,
"wires": []
},
{
"id": "c2d23a114d11726f",
"type": "debug",
"z": "104f7938a23fe82f",
"name": "Debug: Off, Autorun Enabled",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1680,
"y": 240,
"wires": []
},
{
"id": "935f35904a0d89bf",
"type": "link in",
"z": "104f7938a23fe82f",
"name": "Manual Start",
"links": [
"2f0dd5172e907730",
"0e97a47512b3c7ef",
"d6e72db598c850a0",
"610fb43bda07b3c3"
],
"x": 145,
"y": 180,
"wires": [
[
"a740ac24fa947f73"
]
]
},
{
"id": "e65438fd63bf5834",
"type": "link out",
"z": "104f7938a23fe82f",
"name": "GLPI: FormCreator",
"mode": "link",
"links": [
"3c3f4ccfbc0ec4e7"
],
"x": 2350,
"y": 280,
"wires": [],
"l": true
},
{
"id": "4146b052670fb819",
"type": "change",
"z": "104f7938a23fe82f",
"name": "Globals",
"rules": [
{
"t": "set",
"p": "glpi.authorization",
"pt": "global",
"to": "authorization",
"tot": "msg"
},
{
"t": "set",
"p": "glpi.app_token",
"pt": "global",
"to": "app_token",
"tot": "msg"
},
{
"t": "set",
"p": "glpi.api_url",
"pt": "global",
"to": "api_url",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1420,
"y": 120,
"wires": [
[
"a9472349e8102352"
]
],
"icon": "font-awesome/fa-cogs"
},
{
"id": "a9472349e8102352",
"type": "debug",
"z": "104f7938a23fe82f",
"name": "debug 56",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1600,
"y": 120,
"wires": []
},
{
"id": "b3adfbc257af34d9",
"type": "function",
"z": "104f7938a23fe82f",
"name": "Config Exists",
"func": "var exists = null;\nvar absent = null;\nvar config_not_loaded = null;\n\nfs.stat('config.glpi.json', function (err) {\n if (err) {\n absent = msg;\n } else {\n if( global.get('config') != null ) {\n exists = msg;\n }else{\n config_not_loaded = msg;\n }\n }\n});\n\nnode.send([exists, absent, config_not_loaded]);\n",
"outputs": 3,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [
{
"var": "fs",
"module": "fs"
}
],
"x": 930,
"y": 220,
"wires": [
[
"82183bee2dd412fe"
],
[
"e4ec88859fe76e54"
],
[
"59a9bd1194a20f9f"
]
],
"outputLabels": [
"Exists",
"Absent",
"NoConfigLoaded"
]
},
{
"id": "e4ec88859fe76e54",
"type": "debug",
"z": "104f7938a23fe82f",
"name": "No GLPI Config File",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1180,
"y": 260,
"wires": []
},
{
"id": "59a9bd1194a20f9f",
"type": "debug",
"z": "104f7938a23fe82f",
"name": "No Global Config Loaded",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1190,
"y": 300,
"wires": []
},
{
"id": "8de5bc665bc27215",
"type": "http request",
"z": "f6f2187d.f17ca8",
"name": "",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "other",
"keyValue": "App-Token",
"valueType": "msg",
"valueValue": "app_token"
},
{
"keyType": "other",
"keyValue": "Content-Type",
"valueType": "other",
"valueValue": "application/json"
},
{
"keyType": "other",
"keyValue": "Authorization",
"valueType": "msg",
"valueValue": "authorization"
}
],
"x": 750,
"y": 260,
"wires": [
[
"4faa229d7128337c",
"0ca59c59c589aa9a"
]
]
},
{
"id": "4faa229d7128337c",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "200",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 870,
"y": 260,
"wires": [
[
"60ce45a4be8c49f5"
],
[
"b1928b4dfdebf45a"
]
]
},
{
"id": "60ce45a4be8c49f5",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "",
"rules": [
{
"t": "set",
"p": "session_details.session.valid_id",
"pt": "msg",
"to": "payload.session_token",
"tot": "msg"
},
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "set",
"p": "app_token",
"pt": "flow",
"to": "app_token",
"tot": "msg"
},
{
"t": "set",
"p": "bot_account",
"pt": "flow",
"to": "bot_account",
"tot": "msg"
},
{
"t": "set",
"p": "authorization",
"pt": "msg",
"to": "authorization",
"tot": "flow"
},
{
"t": "set",
"p": "authorisation",
"pt": "msg",
"to": "authorisation",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1040,
"y": 240,
"wires": [
[
"2138ec0147a36c71",
"6856e12e77f0102f"
]
]
},
{
"id": "4974c57bfe4fabf9",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 300,
"y": 1020,
"wires": [
[
"04a413764f4af078"
]
]
},
{
"id": "454c179e9999918e",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Set session-token + URL",
"rules": [
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "msg.api_url & \"/PluginFormcreatorFormAnswer\"",
"tot": "jsonata"
},
{
"t": "set",
"p": "app_token",
"pt": "msg",
"to": "app_token",
"tot": "flow"
},
{
"t": "set",
"p": "bot_account",
"pt": "msg",
"to": "bot_account",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 710,
"y": 960,
"wires": [
[
"8a3fd2b2125c14fb"
]
]
},
{
"id": "84f26b16f40f482b",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "From 'GLPI' Flow\\n Start",
"info": "From 'GLPI' Flow\\n\nStart",
"x": 220,
"y": 200,
"wires": []
},
{
"id": "dfc6e804866badfa",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Form Answers",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1980,
"y": 880,
"wires": []
},
{
"id": "d6ead9ea953d172e",
"type": "split",
"z": "f6f2187d.f17ca8",
"name": "List of forms to form",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 1340,
"y": 940,
"wires": [
[
"883ef304b2dec6bc"
]
]
},
{
"id": "883ef304b2dec6bc",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Build Answer URL",
"rules": [
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "msg.api_url & '/PluginFormcreatorFormAnswer/' & msg.payload.id & '/PluginFormcreatorAnswer?range=0-150'",
"tot": "jsonata"
},
{
"t": "set",
"p": "form_details.id",
"pt": "msg",
"to": "payload.plugin_formcreator_forms_id",
"tot": "msg"
},
{
"t": "set",
"p": "form_details.answer_id",
"pt": "msg",
"to": "payload.id",
"tot": "msg"
},
{
"t": "set",
"p": "form_details.requester_id",
"pt": "msg",
"to": "payload.requester_id",
"tot": "msg"
},
{
"t": "set",
"p": "form_details.name",
"pt": "msg",
"to": "payload.name",
"tot": "msg"
},
{
"t": "set",
"p": "form_details.ticket_entity",
"pt": "msg",
"to": "payload.entities_id",
"tot": "msg"
},
{
"t": "set",
"p": "form_details.entity_id",
"pt": "msg",
"to": "payload.entities_id",
"tot": "msg"
},
{
"t": "set",
"p": "method",
"pt": "msg",
"to": "GET",
"tot": "str"
},
{
"t": "move",
"p": "parts",
"pt": "msg",
"to": "form_parts",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1530,
"y": 940,
"wires": [
[
"ae6d3ff335b65b3d",
"048e10e4b5f175c8"
]
]
},
{
"id": "ab66728b85b18a91",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Get the forms",
"info": "",
"x": 210,
"y": 960,
"wires": []
},
{
"id": "1d89ecbaf2f03503",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "msg.form",
"rules": [
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "delete",
"p": "topic",
"pt": "msg"
},
{
"t": "delete",
"p": "url",
"pt": "msg"
},
{
"t": "delete",
"p": "responseUrl",
"pt": "msg"
},
{
"t": "delete",
"p": "redirectList",
"pt": "msg"
},
{
"t": "delete",
"p": "retry",
"pt": "msg"
},
{
"t": "delete",
"p": "headers",
"pt": "msg"
},
{
"t": "delete",
"p": "parts",
"pt": "msg"
},
{
"t": "delete",
"p": "statusCode",
"pt": "msg"
},
{
"t": "move",
"p": "form",
"pt": "msg",
"to": "questions",
"tot": "msg"
},
{
"t": "move",
"p": "form_details",
"pt": "msg",
"to": "form",
"tot": "msg"
},
{
"t": "move",
"p": "questions",
"pt": "msg",
"to": "form.questions",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 620,
"y": 1620,
"wires": [
[
"7ec7fc9e20c4a7e8",
"2a779072acca3f67"
]
]
},
{
"id": "34a93eb2fba21d96",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Ticket Prepare",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2260,
"y": 2220,
"wires": []
},
{
"id": "d690fb9681f9829e",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Prepare",
"rules": [
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "msg.api_url & \"/Ticket\"",
"tot": "jsonata"
},
{
"t": "move",
"p": "generated_template",
"pt": "msg",
"to": "payload",
"tot": "msg"
},
{
"t": "set",
"p": "session_token",
"pt": "msg",
"to": "session_token",
"tot": "flow"
},
{
"t": "set",
"p": "method",
"pt": "msg",
"to": "POST",
"tot": "str"
},
{
"t": "set",
"p": "glpi",
"pt": "msg",
"to": "{}",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2060,
"y": 2160,
"wires": [
[
"34a93eb2fba21d96",
"7641a0ba9012b0c4"
]
]
},
{
"id": "d081be6d1e4379b5",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Create Ticket",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2410,
"y": 2120,
"wires": []
},
{
"id": "d4cbdb80c6de1a0c",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "HTTP Status",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "201",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 2370,
"y": 2160,
"wires": [
[
"30eb92e619af0e99",
"facaa6a7395e5d7f"
],
[]
]
},
{
"id": "40bba4658693fcf0",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Amend Ticket",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3940,
"y": 2080,
"wires": []
},
{
"id": "baa846245c4d19de",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Upload json to ticket",
"rules": [
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "msg.api_url & '/Ticket/' & msg.payload.id &'/TicketTask/'",
"tot": "jsonata"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\t \"input\": {\t \"tickets_id\": msg.payload.id,\t \"taskcategories_id\": msg.task_category,\t \"users_id\": msg.session_details.session.glpiID,\t \"users_id_editor\": 0,\t \"content\": $string(msg.form),\t \"is_private\": 1,\t \"actiontime\": 0,\t \"begin\": null,\t \"end\": null,\t \"state\": 1,\t \"users_id_tech\": msg.session_details.session.glpiID,\t \"groups_id_tech\": 0,\t\t \"tasktemplates_id\": 0,\t\t \"sourceitems_id\": 0,\t \"sourceof_items_id\": 0,\t \"links\": [\t {\t \"rel\": \"Ticket\",\t \"href\": \"http://127.0.0.1/apirest.php/Ticket/msg.payload.id\"\t },\t {\t \"rel\": \"User\",\t \"href\": $string(\"http://127.0.0.1/apirest.php/User/\" & msg.session_details.session.glpiID)\t },\t {\t \"rel\": \"User\",\t \"href\": $string(\"http://127.0.0.1/apirest.php/User/\" & msg.session_details.session.glpiID)\t }\t ]\t }\t\t}\t",
"tot": "jsonata"
},
{
"t": "set",
"p": "method",
"pt": "msg",
"to": "post",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2860,
"y": 2260,
"wires": [
[
"a1830195f3d24676",
"3a6a6d119c434dce",
"f44d85f3dd843e24"
]
]
},
{
"id": "7af4f7c4d5054119",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Remove Form Answer",
"rules": [
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "$string(msg.api_url & '/PluginFormcreatorFormAnswer/' & msg.form.answer_id)",
"tot": "jsonata"
},
{
"t": "set",
"p": "method",
"pt": "msg",
"to": "DELETE",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 3460,
"y": 2300,
"wires": [
[
"94e9c3f821a62eed",
"7bb0fa06d2b81ebf"
]
]
},
{
"id": "8e8b0cd0b13c0c61",
"type": "split",
"z": "f6f2187d.f17ca8",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": true,
"addname": "payload",
"x": 1890,
"y": 940,
"wires": [
[
"254033ce6df92ac2"
]
]
},
{
"id": "254033ce6df92ac2",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "",
"rules": [
{
"t": "set",
"p": "form",
"pt": "msg",
"to": "{\t \"question_id\": msg.payload.plugin_formcreator_questions_id,\t \"answer\": msg.payload.answer\t}",
"tot": "jsonata"
},
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "msg.api_url & '/PluginFormcreatorQuestion/' & msg.payload.plugin_formcreator_questions_id & '?range=0-150'",
"tot": "jsonata"
},
{
"t": "set",
"p": "method",
"pt": "msg",
"to": "GET",
"tot": "str"
},
{
"t": "move",
"p": "parts",
"pt": "msg",
"to": "answer_parts",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2020,
"y": 940,
"wires": [
[
"7a564f89bd59c747",
"92f06ed116476f53"
]
]
},
{
"id": "109cb443e3b18552",
"type": "join",
"z": "f6f2187d.f17ca8",
"name": "Combine Questions",
"mode": "auto",
"build": "object",
"property": "form",
"propertyType": "msg",
"key": "form",
"joiner": "\\n",
"joinerType": "str",
"accumulate": true,
"timeout": "5",
"count": "3",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "num",
"reduceFixup": "",
"x": 250,
"y": 1620,
"wires": [
[
"32337fc19b0c6c53",
"6abd782f33f6aa9f"
]
]
},
{
"id": "14ec463e022ba2e6",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Add Form fields",
"rules": [
{
"t": "set",
"p": "form.question",
"pt": "msg",
"to": "payload.name",
"tot": "msg"
},
{
"t": "set",
"p": "form.field_type",
"pt": "msg",
"to": "payload.fieldtype",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2780,
"y": 660,
"wires": [
[
"77a912d5ef7737c9",
"32c5dc82712e4b12"
]
]
},
{
"id": "77a912d5ef7737c9",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Form Fields",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3030,
"y": 560,
"wires": []
},
{
"id": "d50561ffddac19e4",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Split messages and build form json",
"info": "",
"x": 1980,
"y": 1000,
"wires": []
},
{
"id": "159ed95d7807ebf4",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Fetch Question Details",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2500,
"y": 980,
"wires": []
},
{
"id": "cf4fe833c9fe8b07",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Form Details",
"info": "",
"x": 3230,
"y": 540,
"wires": []
},
{
"id": "38ea96d6c95ce24a",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Ticket Creation",
"info": "",
"x": 1860,
"y": 2120,
"wires": []
},
{
"id": "4cbac34d37797cc9",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Ticket Details",
"info": "",
"x": 2890,
"y": 1960,
"wires": []
},
{
"id": "9a5db65742117413",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "ToDo",
"info": "",
"x": 210,
"y": 620,
"wires": []
},
{
"id": "92f06ed116476f53",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Split Form Answer",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2230,
"y": 900,
"wires": []
},
{
"id": "63ed9783b1185337",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Session Details",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1760,
"y": 220,
"wires": []
},
{
"id": "0ca59c59c589aa9a",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Session Init",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 970,
"y": 340,
"wires": []
},
{
"id": "31641a423aec4269",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 400,
"y": 3940,
"wires": [
[
"35d95d641dd4fa34"
]
]
},
{
"id": "35d95d641dd4fa34",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Set session-token + URL",
"rules": [
{
"t": "set",
"p": "session_token",
"pt": "msg",
"to": "session_token",
"tot": "flow"
},
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "http://glpi/apirest.php/TicketTask/?searchText[users_id_tech]=11&searchText[state]=1",
"tot": "str"
},
{
"t": "set",
"p": "app_token",
"pt": "msg",
"to": "app_token",
"tot": "flow"
},
{
"t": "set",
"p": "bot_account",
"pt": "msg",
"to": "bot_account",
"tot": "flow"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 410,
"y": 3820,
"wires": [
[
"fa23ae9590ce975a"
]
]
},
{
"id": "fa23ae9590ce975a",
"type": "http request",
"z": "f6f2187d.f17ca8",
"name": "Get All form Answers",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "other",
"keyValue": "App-Token",
"valueType": "msg",
"valueValue": "app_token"
},
{
"keyType": "Content-Type",
"keyValue": "",
"valueType": "other",
"valueValue": "application/json"
},
{
"keyType": "other",
"keyValue": "Session-Token",
"valueType": "msg",
"valueValue": "session_token"
}
],
"x": 520,
"y": 3780,
"wires": [
[
"be9730be497c0a0a",
"e07e2c386f4dd6a2"
]
]
},
{
"id": "be9730be497c0a0a",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 17",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 680,
"y": 3720,
"wires": []
},
{
"id": "e369c19f7af0f81f",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "TEST Get ticket tasks",
"info": "",
"x": 240,
"y": 3740,
"wires": []
},
{
"id": "7f220be9b68fe3c9",
"type": "json",
"z": "f6f2187d.f17ca8",
"name": "",
"property": "task",
"action": "obj",
"pretty": false,
"x": 930,
"y": 3820,
"wires": [
[
"9c5bfdbf78f8ce86"
]
]
},
{
"id": "e07e2c386f4dd6a2",
"type": "split",
"z": "f6f2187d.f17ca8",
"name": "List of forms to form",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 700,
"y": 3820,
"wires": [
[
"903ae9214c328d8b",
"42a4a8bd6fc637b8"
]
]
},
{
"id": "9c5bfdbf78f8ce86",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 18",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1080,
"y": 3760,
"wires": []
},
{
"id": "903ae9214c328d8b",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Set session-token + URL",
"rules": [
{
"t": "set",
"p": "task",
"pt": "msg",
"to": "$string($replace(msg.payload.content, /(\\&\\#\\d{2}\\;\\/?[a-z]+\\&\\#\\d{2}\\;)/, ''))\t",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 970,
"y": 3880,
"wires": [
[
"7f220be9b68fe3c9",
"d26d506004500f22"
]
]
},
{
"id": "42a4a8bd6fc637b8",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 19",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 920,
"y": 3720,
"wires": []
},
{
"id": "d26d506004500f22",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 20",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1220,
"y": 3940,
"wires": []
},
{
"id": "b92b33f2ae2ee405",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "200",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 990,
"y": 2300,
"wires": [
[
"15760c44e52dc96e"
],
[
"15760c44e52dc96e"
]
]
},
{
"id": "15760c44e52dc96e",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "",
"rules": [
{
"t": "set",
"p": "session_token",
"pt": "flow",
"to": "",
"tot": "str"
},
{
"t": "delete",
"p": "payload",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1160,
"y": 2280,
"wires": [
[
"58412e238946fb86"
]
]
},
{
"id": "c1b719a6a47b9bdc",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Kill the API session",
"info": "",
"x": 170,
"y": 2240,
"wires": []
},
{
"id": "58412e238946fb86",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Session End",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1370,
"y": 2280,
"wires": []
},
{
"id": "348d59445d4c260c",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Form Answers Returned",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1410,
"y": 980,
"wires": []
},
{
"id": "adc6e4883443806f",
"type": "http request",
"z": "f6f2187d.f17ca8",
"name": "HTTP Request: Kill user session",
"method": "GET",
"ret": "obj",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "other",
"keyValue": "App-Token",
"valueType": "msg",
"valueValue": "app_token"
},
{
"keyType": "Content-Type",
"keyValue": "",
"valueType": "other",
"valueValue": "application/json"
},
{
"keyType": "other",
"keyValue": "Session-Token",
"valueType": "msg",
"valueValue": "session_details.session.valid_id"
}
],
"x": 810,
"y": 2300,
"wires": [
[
"b92b33f2ae2ee405"
]
]
},
{
"id": "1e03a208414a3bf0",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Set session-token + URL",
"rules": [
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "msg.api_url & \"/killSession\"",
"tot": "jsonata"
},
{
"t": "set",
"p": "app_token",
"pt": "msg",
"to": "app_token",
"tot": "flow"
},
{
"t": "delete",
"p": "responseUrl",
"pt": "msg"
},
{
"t": "delete",
"p": "method",
"pt": "msg"
},
{
"t": "delete",
"p": "statusCode",
"pt": "msg"
},
{
"t": "delete",
"p": "headers",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 530,
"y": 2300,
"wires": [
[
"adc6e4883443806f",
"557310b9928fc001"
]
]
},
{
"id": "04a413764f4af078",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "Session Check",
"property": "session_token",
"propertyType": "flow",
"rules": [
{
"t": "nempty"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 480,
"y": 1020,
"wires": [
[
"454c179e9999918e"
]
]
},
{
"id": "c6318878d6c4173e",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "Results returned",
"property": "msg.payload.length",
"propertyType": "msg",
"rules": [
{
"t": "gt",
"v": "0",
"vt": "num"
},
{
"t": "eq",
"v": "0",
"vt": "num"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 1100,
"y": 960,
"wires": [
[
"d6ead9ea953d172e",
"348d59445d4c260c"
],
[
"815974a44d365161",
"951a8a267481cfe6"
]
]
},
{
"id": "951a8a267481cfe6",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "No Form Answers Returned",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1380,
"y": 1140,
"wires": []
},
{
"id": "4350bb1697165898",
"type": "link in",
"z": "f6f2187d.f17ca8",
"name": "GLPI: End Session",
"links": [
"815974a44d365161",
"94c316c3e6192a53",
"84ac2b5e6df44243"
],
"x": 330,
"y": 2300,
"wires": [
[
"1e03a208414a3bf0"
]
],
"l": true
},
{
"id": "815974a44d365161",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "End GLPI Session",
"mode": "link",
"links": [
"4350bb1697165898"
],
"x": 1350,
"y": 1100,
"wires": [],
"l": true
},
{
"id": "94c316c3e6192a53",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "End GLPI Session",
"mode": "link",
"links": [
"4350bb1697165898"
],
"x": 4010,
"y": 2120,
"wires": [],
"l": true
},
{
"id": "51124c8c0b7142dd",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "GLPI: Session Fetch end",
"mode": "return",
"links": [],
"x": 1790,
"y": 260,
"wires": [],
"l": true
},
{
"id": "3c3f4ccfbc0ec4e7",
"type": "link in",
"z": "f6f2187d.f17ca8",
"name": "GLPI: Fetch Forms",
"links": [
"e65438fd63bf5834"
],
"x": 170,
"y": 880,
"wires": [
[
"e3b230d99d4bf90e",
"87d33fd4cc09e27f"
]
],
"l": true
},
{
"id": "557310b9928fc001",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 25",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 720,
"y": 2240,
"wires": []
},
{
"id": "fb18f6154f0c0465",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "Dynamic Fields Check",
"mode": "link",
"links": [
"2e2491c09565868d"
],
"x": 2500,
"y": 940,
"wires": [],
"l": true
},
{
"id": "2e2491c09565868d",
"type": "link in",
"z": "f6f2187d.f17ca8",
"name": "Form: Dynamic fields",
"links": [
"fb18f6154f0c0465"
],
"x": 2600,
"y": 660,
"wires": [
[
"14ec463e022ba2e6"
]
],
"l": true
},
{
"id": "e2fd3bd854073749",
"type": "link in",
"z": "f6f2187d.f17ca8",
"name": "Process Form",
"links": [
"bcdb9f8a74cd2414"
],
"x": 90,
"y": 1400,
"wires": [
[
"5c7a23d16f3799de"
]
],
"l": true
},
{
"id": "bcdb9f8a74cd2414",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "Continue",
"mode": "link",
"links": [
"e2fd3bd854073749"
],
"x": 4900,
"y": 700,
"wires": [],
"l": true
},
{
"id": "3dee9addd0ed8cd6",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "ticket_category",
"rules": [
{
"t": "set",
"p": "ticket_category",
"pt": "msg",
"to": "$number(msg.payload.default_values)\t",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 3480,
"y": 540,
"wires": [
[
"b1524bd812745460",
"7d597c9f95237aec"
]
]
},
{
"id": "32c5dc82712e4b12",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "Route fields for processing",
"property": "$lowercase( msg.payload.name )\t",
"propertyType": "jsonata",
"rules": [
{
"t": "eq",
"v": "approval_required",
"vt": "str"
},
{
"t": "eq",
"v": "entity_approval",
"vt": "str"
},
{
"t": "eq",
"v": "ticket_category",
"vt": "str"
},
{
"t": "eq",
"v": "ticket_title",
"vt": "str"
},
{
"t": "eq",
"v": "ticket_type",
"vt": "str"
},
{
"t": "eq",
"v": "task_category",
"vt": "str"
},
{
"t": "eq",
"v": "automation_account_id",
"vt": "str"
},
{
"t": "eq",
"v": "approver_id",
"vt": "str"
},
{
"t": "eq",
"v": "entity",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 10,
"x": 3080,
"y": 660,
"wires": [
[
"56cdb59cb181c6f4"
],
[
"ec869fcde783d888"
],
[
"3dee9addd0ed8cd6"
],
[
"0d4ff1f5a09fe7c6"
],
[
"b56ed66c5684c193"
],
[
"738079e881bd7c2c"
],
[
"bf6a0883e2c6fa86"
],
[
"bf6a0883e2c6fa86"
],
[
"8ff8495c24d48ef7"
],
[
"bf6a0883e2c6fa86"
]
]
},
{
"id": "b1524bd812745460",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 27",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 4060,
"y": 540,
"wires": []
},
{
"id": "b56ed66c5684c193",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "ticket_type",
"rules": [
{
"t": "set",
"p": "ticket_type",
"pt": "msg",
"to": "$number(msg.payload.default_values)",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 3490,
"y": 620,
"wires": [
[
"83eb1d86b52defce",
"7d597c9f95237aec"
]
]
},
{
"id": "83eb1d86b52defce",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 29",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 4060,
"y": 620,
"wires": []
},
{
"id": "32337fc19b0c6c53",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "msg.form_details",
"rules": [
{
"t": "move",
"p": "automation_account_id",
"pt": "msg",
"to": "form_details.automation_account_id",
"tot": "msg"
},
{
"t": "move",
"p": "ticket_category",
"pt": "msg",
"to": "form_details.ticket_category",
"tot": "msg"
},
{
"t": "move",
"p": "ticket_title",
"pt": "msg",
"to": "form_details.ticket_title",
"tot": "msg"
},
{
"t": "move",
"p": "ticket_type",
"pt": "msg",
"to": "form_details.ticket_type",
"tot": "msg"
},
{
"t": "move",
"p": "approval_required",
"pt": "msg",
"to": "form_details.approval_required",
"tot": "msg"
},
{
"t": "move",
"p": "approver_id",
"pt": "msg",
"to": "form_details.approver_id",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 470,
"y": 1620,
"wires": [
[
"1d89ecbaf2f03503"
]
]
},
{
"id": "0d4ff1f5a09fe7c6",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "ticket_title",
"rules": [
{
"t": "set",
"p": "ticket_title",
"pt": "msg",
"to": "$string(msg.payload.default_values)",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 3500,
"y": 580,
"wires": [
[
"06aa9b576afd2be5",
"7d597c9f95237aec"
]
]
},
{
"id": "06aa9b576afd2be5",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 32",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 4060,
"y": 580,
"wires": []
},
{
"id": "9d874e042a1954f0",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "[Done] Add approval to ticket if specified",
"info": "",
"x": 310,
"y": 680,
"wires": []
},
{
"id": "b1928b4dfdebf45a",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "HTTP ERROR",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1040,
"y": 300,
"wires": []
},
{
"id": "94e9c3f821a62eed",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Remove Form Answers",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3470,
"y": 2340,
"wires": []
},
{
"id": "58d7f582867e25b9",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Approver Packet",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3430,
"y": 2100,
"wires": []
},
{
"id": "3988dff78ba97852",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "Adjust form fields so that multiple approvers for different parts can have differnet approvers",
"info": "",
"x": 530,
"y": 720,
"wires": []
},
{
"id": "8c254f92f72ca43b",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "ITILCategory Checks Including building Ticket request from category Template",
"info": "",
"x": 350,
"y": 1540,
"wires": []
},
{
"id": "c5055cdaaf932dbc",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Fetch Details",
"rules": [
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "msg.api_url & \"/ITILCategory/\" & msg.form.ticket_category",
"tot": "jsonata"
},
{
"t": "set",
"p": "method",
"pt": "msg",
"to": "GET",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1050,
"y": 1600,
"wires": [
[
"5225cbd0ed0d0ee3"
]
]
},
{
"id": "7ec7fc9e20c4a7e8",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "Category Exists",
"property": "form.ticket_category",
"propertyType": "msg",
"rules": [
{
"t": "istype",
"v": "number",
"vt": "number"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 860,
"y": 1620,
"wires": [
[
"c5055cdaaf932dbc"
],
[
"8d453aaee35aa375",
"fd37bced67415bb7"
]
]
},
{
"id": "67dd1c6bb33f2633",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 39",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1480,
"y": 1540,
"wires": []
},
{
"id": "77366d1c8a178421",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "Incident <> Request",
"property": "form.ticket_type",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "1",
"vt": "num"
},
{
"t": "eq",
"v": "2",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 3,
"x": 1660,
"y": 1600,
"wires": [
[
"1ffc637c2378703d"
],
[
"858c1aaae498389e"
],
[
"858c1aaae498389e"
]
]
},
{
"id": "24cc9ac0380bd505",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "ticket_category",
"tot": "msg"
},
{
"t": "delete",
"p": "statusCode",
"pt": "msg"
},
{
"t": "delete",
"p": "headers",
"pt": "msg"
},
{
"t": "delete",
"p": "redirectList",
"pt": "msg"
},
{
"t": "delete",
"p": "retry",
"pt": "msg"
},
{
"t": "delete",
"p": "responseUrl",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1420,
"y": 1600,
"wires": [
[
"77366d1c8a178421"
]
]
},
{
"id": "1ffc637c2378703d",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Incident",
"rules": [
{
"t": "set",
"p": "ticket_template",
"pt": "msg",
"to": "ticket_category.tickettemplates_id_incident",
"tot": "msg"
},
{
"t": "set",
"p": "ticket_template_applicable",
"pt": "msg",
"to": "ticket_category.is_incident",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1860,
"y": 1580,
"wires": [
[
"9c91ead347397f0d"
]
]
},
{
"id": "858c1aaae498389e",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Request",
"rules": [
{
"t": "set",
"p": "ticket_template",
"pt": "msg",
"to": "ticket_category.tickettemplates_id_demand",
"tot": "msg"
},
{
"t": "set",
"p": "ticket_template_applicable",
"pt": "msg",
"to": "ticket_category.is_request",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1860,
"y": 1620,
"wires": [
[
"9c91ead347397f0d"
]
]
},
{
"id": "9c91ead347397f0d",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "Template Applicable",
"property": "ticket_template_applicable",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "1",
"vt": "num"
},
{
"t": "eq",
"v": "0",
"vt": "num"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 2100,
"y": 1600,
"wires": [
[
"219fbaa53aa78d28"
],
[
"3af87a18632ad1be"
]
]
},
{
"id": "a672f214ea959fc4",
"type": "link in",
"z": "f6f2187d.f17ca8",
"name": "GLPI: Ticket Creation",
"links": [
"46377a801e0c95c7",
"8d453aaee35aa375",
"8dafd33b57416c3f"
],
"x": 1880,
"y": 2160,
"wires": [
[
"d690fb9681f9829e"
]
],
"l": true
},
{
"id": "8dafd33b57416c3f",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "Continue",
"mode": "link",
"links": [
"a672f214ea959fc4"
],
"x": 2460,
"y": 1680,
"wires": [],
"l": true
},
{
"id": "8d453aaee35aa375",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "Continue",
"mode": "link",
"links": [
"a672f214ea959fc4"
],
"x": 1100,
"y": 1700,
"wires": [],
"l": true
},
{
"id": "3af87a18632ad1be",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Cleanup",
"rules": [
{
"t": "delete",
"p": "ticket_template_applicable",
"pt": "msg"
},
{
"t": "delete",
"p": "ticket_template",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2300,
"y": 1640,
"wires": [
[
"8dafd33b57416c3f",
"a3b3c181797c094a"
]
]
},
{
"id": "bbba2b34fa078dc7",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 40",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3180,
"y": 1540,
"wires": []
},
{
"id": "219fbaa53aa78d28",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "URL Build",
"rules": [
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "msg.api_url & \"/TicketTemplate/\" & msg.ticket_template &\"/TicketTemplatePredefinedField\"",
"tot": "jsonata"
},
{
"t": "delete",
"p": "ticket_template_applicable",
"pt": "msg"
},
{
"t": "set",
"p": "method",
"pt": "msg",
"to": "GET",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2300,
"y": 1580,
"wires": [
[
"04a5b3d6d2bb5609"
]
]
},
{
"id": "389e918ab0b455df",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Build Ticket from Template",
"func": "// \"msg.ticket_fields[String(msg.template_fields[i].num)].field\"\nmsg.generated_template = '{ \"input\": {'\nmsg.items_ticket = \"[\"\nfor (var i = 0; i < msg.template_fields.length; i++) {\n\n // var TicketField = String(msg.template_fields[i].num);\n //var TheField = String(msg.template_fields[i].num); // msg.template_fields[0].num\n\n msg.template_fields[i].name = msg.ticket_fields[String(msg.template_fields[i].num)].field; // msg.ticket_fields[\"1\"].field\n\n var key = msg.template_fields[i].name;\n \n if (key == 'name') {\n msg.template_fields[i].value = msg.template_fields[i].value + msg.form.name;\n }\n if (key == 'content') {\n // msg.template_fields[i].value = String(msg.template_fields[i].value + msg.form.content).replace(\"\\n\", '\\\\r\\\\n').replace(\"\\r\", '');\n if (msg.form.hasOwnProperty(\"content\") ){\n\n msg.template_fields[i].value = String(msg.template_fields[i].value + msg.form.content).replace(/\\n/g, '\\\\r\\\\n').replace(/\\r/g, '').replace(/(\\\")/g, '&#34;');\n \n }else{\n \n msg.template_fields[i].value = String(msg.template_fields[i].value).replace(/\\n/g, '\\\\r\\\\n').replace(/\\r/g, '').replace(/(\\\")/g, '&#34;');\n \n }\n }\n\n \n // var value = String(msg.template_fields[i].value).replace(\"\\n\", '\\\\r\\\\n').replace(\"\\r\", '').replace(/(\\&\\#\\d{2}\\;\\/?[a-z]+\\&\\#\\d{2}\\;)/g, '');\n var value = String(msg.template_fields[i].value).replace(/\\n/g, '\\\\r\\\\n').replace(/\\r/g, '').replace(/(\\\")/g, '&#34;'); // Test to see if html can stay\n\n if( key != 'items_id' ) {\n \n msg.generated_template = msg.generated_template + String(\n '\"' + key + '\": ' +\n '\"' + value + '\",'\n );\n\n } else if (key == 'items_id') {\n\n var item_details = value.split('_')\n\n msg.items_ticket = msg.items_ticket + String(\n \"{\" +\n '\"' + key + '\": ' +\n '\"' + item_details[1] + '\",' \n +\n '\"itemtype\": ' +\n '\"' + item_details[0] + '\"' +\n \"},\"\n );\n\n\n }\n}\n\nif (msg.ticket_category.users_id != 0 && msg.form.approval_required == 1 ) {\n\n msg.form.user_id_approver = msg.ticket_category.users_id;\n msg.generated_template = msg.generated_template + String('\"validation_percent\": ' + 100 + ',');\n\n}\n\nif (msg.ticket_category.groups_id != 0 && msg.form.approval_required == 1 ) {\n\n msg.form.group_id_approver = msg.ticket_category.groups_id;\n msg.generated_template = msg.generated_template + String('\"validation_percent\": ' + 25 + ',');\n}\n\nmsg.generated_template = msg.generated_template + String('\"itilcategories_id\": ' + msg.form.ticket_category + ',' );\nmsg.generated_template = msg.generated_template + String('\"requesttypes_id\": ' + 7 + ',');\nmsg.generated_template = msg.generated_template + String('\"entities_id\": ' + msg.form.ticket_entity);\nmsg.generated_template = msg.generated_template + \"}}\";\nmsg.generated_template = JSON.parse(msg.generated_template);\n\nif(msg.items_ticket != \"[\" ) {\n msg.items_ticket = String(msg.items_ticket).substring(0, msg.items_ticket.length-1) + \"]\";\n msg.items_ticket = JSON.parse(msg.items_ticket);\n}else{\n delete (msg.items_ticket);\n}\n\nif ( ! msg.generated_template.hasOwnProperty(\"name\") ) {\n\n msg.generated_template.name = msg.form.name;\n\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 3180,
"y": 1580,
"wires": [
[
"531c943af7341755",
"46377a801e0c95c7"
]
]
},
{
"id": "5d11f290abca4992",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Clean-up / Prep",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "template_fields",
"tot": "msg"
},
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "msg.api_url & \"/listSearchOptions/Ticket\"",
"tot": "jsonata"
},
{
"t": "set",
"p": "method",
"pt": "msg",
"to": "GET",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2680,
"y": 1580,
"wires": [
[
"2cf4482e5aa3d454"
]
]
},
{
"id": "531c943af7341755",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 41",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3400,
"y": 1540,
"wires": []
},
{
"id": "13d2fe736f955b77",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Clean-up",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "ticket_fields",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 3000,
"y": 1580,
"wires": [
[
"389e918ab0b455df",
"bbba2b34fa078dc7"
]
]
},
{
"id": "46377a801e0c95c7",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "Continue",
"mode": "link",
"links": [
"a672f214ea959fc4"
],
"x": 3360,
"y": 1580,
"wires": [],
"l": true
},
{
"id": "f0b8ea2876129114",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Approver Packet",
"func": "//{\n// \"input\": {\n// \"tickets_id\": msg.payload.id,\n// \"users_id_validate\": msg.form.approver_id,\n// \"comment_submission\": $string(\"A request for '\" & msg.form.name & \"' has been made that requires your approval.\"),\n// \"status\": 2\n// }\n//}\n\nif (\n msg.form.hasOwnProperty(\"user_id_approver\")\n ||\n msg.form.hasOwnProperty(\"group_id_approver\")\n ) {\n\n msg.input = {};\n \n msg.input.tickets_id = msg.payload.id;\n msg.input.comment_submission = String(\"As the person listed as responsible, this request requires your approval.\");\n msg.input.status = 2;\n\n if( msg.form.user_id_approver != 0 ) {\n msg.input.users_id_validate = msg.form.user_id_approver;\n }\n if( msg.form.group_id_approver != 0) {\n msg.input.groups_id_validate = msg.form.group_id_approver;\n }\n\n msg.url = String(msg.api_url + '/Ticket/' + msg.payload.id + '/TicketValidation');\n msg.method = \"POST\";\n\n msg.payload = {};\n msg.payload.input = msg.input;\n\n return msg;\n\n}\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2870,
"y": 2100,
"wires": [
[
"58d7f582867e25b9",
"e5548020922347cc"
]
]
},
{
"id": "f710a0c68b11ee76",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Build Ticket Items Packet",
"func": "\nif( msg.hasOwnProperty(\"items_ticket\") ) {\n\n for (var i = 0; i < msg.items_ticket.length; i++ ) {\n\n msg.items_ticket[i].tickets_id = msg.payload.id\n\n }\n \n msg.payload = {};\n msg.payload.input = msg.items_ticket;\n\n msg.url = msg.api_url + \"/Item_Ticket\"\n msg.method = \"POST\";\n\n return msg;\n\n}\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2850,
"y": 2180,
"wires": [
[
"314b414628960c36",
"e5548020922347cc"
]
]
},
{
"id": "314b414628960c36",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Ticket Item Packet",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3430,
"y": 2180,
"wires": []
},
{
"id": "a7f816f627d2deb8",
"type": "delay",
"z": "f6f2187d.f17ca8",
"name": "",
"pauseType": "delay",
"timeout": "5",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 3860,
"y": 2120,
"wires": [
[
"94c316c3e6192a53"
]
]
},
{
"id": "04a5b3d6d2bb5609",
"type": "link call",
"z": "f6f2187d.f17ca8",
"name": "Fetch Ticket Template Fields",
"links": [
"eb5f283400263c25"
],
"linkType": "static",
"timeout": "30",
"x": 2480,
"y": 1580,
"wires": [
[
"5d11f290abca4992"
]
]
},
{
"id": "7bb0fa06d2b81ebf",
"type": "link call",
"z": "f6f2187d.f17ca8",
"name": "Amend Ticket",
"links": [
"eb5f283400263c25"
],
"linkType": "static",
"timeout": "30",
"x": 3720,
"y": 2120,
"wires": [
[
"a7f816f627d2deb8",
"40bba4658693fcf0",
"34d02c8cfe43bbe6"
]
]
},
{
"id": "2cf4482e5aa3d454",
"type": "link call",
"z": "f6f2187d.f17ca8",
"name": "Fetch Field Details",
"links": [
"eb5f283400263c25"
],
"linkType": "static",
"timeout": "30",
"x": 2850,
"y": 1580,
"wires": [
[
"13d2fe736f955b77"
]
]
},
{
"id": "7641a0ba9012b0c4",
"type": "link call",
"z": "f6f2187d.f17ca8",
"name": "Create Ticket",
"links": [
"eb5f283400263c25"
],
"linkType": "static",
"timeout": "30",
"x": 2230,
"y": 2160,
"wires": [
[
"d4cbdb80c6de1a0c",
"d081be6d1e4379b5"
]
]
},
{
"id": "fcbf307dae461acb",
"type": "http request",
"z": "f6f2187d.f17ca8",
"name": "HTTP",
"method": "use",
"ret": "obj",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [
{
"keyType": "other",
"keyValue": "App-Token",
"valueType": "msg",
"valueValue": "app_token"
},
{
"keyType": "Content-Type",
"keyValue": "",
"valueType": "other",
"valueValue": "application/json"
},
{
"keyType": "other",
"keyValue": "Session-Token",
"valueType": "msg",
"valueValue": "session_details.session.valid_id"
}
],
"x": 250,
"y": 1900,
"wires": [
[
"8dc03813b42d41cb",
"72eeacf15e359fec"
]
]
},
{
"id": "eb5f283400263c25",
"type": "link in",
"z": "f6f2187d.f17ca8",
"name": "GLPI API",
"links": [],
"x": 140,
"y": 1900,
"wires": [
[
"fcbf307dae461acb",
"e5c1f581fdc90543"
]
],
"l": true
},
{
"id": "a1557288d6c101e4",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "Return to flow",
"mode": "return",
"links": [],
"x": 1460,
"y": 1840,
"wires": [],
"l": true
},
{
"id": "5225cbd0ed0d0ee3",
"type": "link call",
"z": "f6f2187d.f17ca8",
"name": "Fetch ITILCategory",
"links": [
"eb5f283400263c25"
],
"linkType": "static",
"timeout": "30",
"x": 1210,
"y": 1600,
"wires": [
[
"24cc9ac0380bd505",
"67dd1c6bb33f2633"
]
]
},
{
"id": "e57ec269ddceda7d",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "GLPI API Request",
"info": "",
"x": 170,
"y": 1840,
"wires": []
},
{
"id": "2138ec0147a36c71",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Defaults",
"rules": [
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "set",
"p": "automation_account_id",
"pt": "msg",
"to": "11",
"tot": "num"
},
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "msg.api_url & \"/getFullSession\"",
"tot": "jsonata"
},
{
"t": "set",
"p": "method",
"pt": "msg",
"to": "GET",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1180,
"y": 240,
"wires": [
[
"09a9ef3efab61351"
]
]
},
{
"id": "09a9ef3efab61351",
"type": "link call",
"z": "f6f2187d.f17ca8",
"name": "Get My User ID",
"links": [
"eb5f283400263c25"
],
"linkType": "static",
"timeout": "30",
"x": 1320,
"y": 240,
"wires": [
[
"0d8fdbae0c5bc0ad"
]
]
},
{
"id": "d4dcc73bbe878f42",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Clean Up Response",
"rules": [
{
"t": "delete",
"p": "headers",
"pt": "msg"
},
{
"t": "delete",
"p": "redirectList",
"pt": "msg"
},
{
"t": "delete",
"p": "retry",
"pt": "msg"
},
{
"t": "delete",
"p": "method",
"pt": "msg"
},
{
"t": "delete",
"p": "responseUrl",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1280,
"y": 1840,
"wires": [
[
"a1557288d6c101e4"
]
]
},
{
"id": "8dc03813b42d41cb",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Web Response",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 420,
"y": 1920,
"wires": []
},
{
"id": "0d8fdbae0c5bc0ad",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Session Details",
"rules": [
{
"t": "move",
"p": "payload",
"pt": "msg",
"to": "session_details",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1480,
"y": 240,
"wires": [
[
"63ed9783b1185337",
"51124c8c0b7142dd"
]
]
},
{
"id": "6856e12e77f0102f",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 43",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1320,
"y": 300,
"wires": []
},
{
"id": "8a3fd2b2125c14fb",
"type": "link call",
"z": "f6f2187d.f17ca8",
"name": "Get All form Answers",
"links": [
"eb5f283400263c25"
],
"linkType": "static",
"timeout": "30",
"x": 920,
"y": 960,
"wires": [
[
"c6318878d6c4173e"
]
]
},
{
"id": "ae6d3ff335b65b3d",
"type": "link call",
"z": "f6f2187d.f17ca8",
"name": "Get Each Answered Form",
"links": [
"eb5f283400263c25"
],
"linkType": "static",
"timeout": "30",
"x": 1730,
"y": 940,
"wires": [
[
"8e8b0cd0b13c0c61",
"dfc6e804866badfa"
]
]
},
{
"id": "72eeacf15e359fec",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "HTTP StatusCode",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "200",
"vt": "num"
},
{
"t": "eq",
"v": "201",
"vt": "num"
},
{
"t": "eq",
"v": "206",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 4,
"x": 630,
"y": 1900,
"wires": [
[
"bab95cf5ba3d6045"
],
[
"ce4de75bc712f124"
],
[
"ad563b1612f320ce"
],
[
"53b1c5bbed90265f"
]
]
},
{
"id": "0bf3afb49b551d9c",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Web Error",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 950,
"y": 2020,
"wires": []
},
{
"id": "7a564f89bd59c747",
"type": "link call",
"z": "f6f2187d.f17ca8",
"name": "Get Question Details",
"links": [
"eb5f283400263c25"
],
"linkType": "static",
"timeout": "30",
"x": 2200,
"y": 940,
"wires": [
[
"fb18f6154f0c0465",
"159ed95d7807ebf4"
]
]
},
{
"id": "29882bec61111349",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "Only Remove Form Answer, on success",
"property": "statusCode",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "201",
"vt": "num"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 3160,
"y": 2300,
"wires": [
[
"7af4f7c4d5054119"
],
[]
]
},
{
"id": "a1830195f3d24676",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "Debug Don't Delete",
"property": "debug_on",
"propertyType": "msg",
"rules": [
{
"t": "false"
},
{
"t": "true"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 2870,
"y": 2300,
"wires": [
[
"29882bec61111349"
],
[]
]
},
{
"id": "e3b230d99d4bf90e",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Fetch Forms",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 670,
"y": 800,
"wires": []
},
{
"id": "ebb2a01cac9a803d",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "HTTP/201",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 950,
"y": 1900,
"wires": []
},
{
"id": "836dca1c83616f32",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "HTTP/200",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 950,
"y": 1860,
"wires": []
},
{
"id": "3944fbf533097cbb",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "HTTP/206",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 950,
"y": 1940,
"wires": []
},
{
"id": "a3b3c181797c094a",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Template N/A",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 2480,
"y": 1640,
"wires": []
},
{
"id": "fd37bced67415bb7",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "No Category",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1110,
"y": 1660,
"wires": []
},
{
"id": "be126901c3d26d5d",
"type": "comment",
"z": "f6f2187d.f17ca8",
"name": "ToDo: Build ticket packet\\n as no category exists",
"info": "ToDo: Build ticket packet\\n\nas no category exists",
"x": 1330,
"y": 1700,
"wires": []
},
{
"id": "405728494cdf7f87",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Un-Processed Field",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 4090,
"y": 740,
"wires": []
},
{
"id": "2a779072acca3f67",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Pre-Category Exists",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 900,
"y": 1560,
"wires": []
},
{
"id": "6abd782f33f6aa9f",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Combined Questions",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 700,
"y": 1680,
"wires": []
},
{
"id": "e370037f2b9ae9a6",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Process Form",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 380,
"y": 1660,
"wires": []
},
{
"id": "e97bbbbac1bab270",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "No Payload Required",
"rules": [
{
"t": "delete",
"p": "payload",
"pt": "msg"
},
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "msg.api_url & \"/initSession\"",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 580,
"y": 260,
"wires": [
[
"8de5bc665bc27215"
]
],
"icon": "font-awesome/fa-cogs"
},
{
"id": "8ff8495c24d48ef7",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "flow.entity_id",
"rules": [
{
"t": "set",
"p": "entity_id",
"pt": "flow",
"to": "$number(msg.form.answer)\t",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 3490,
"y": 760,
"wires": [
[
"13b00547bd61210c",
"7d597c9f95237aec"
]
]
},
{
"id": "56cdb59cb181c6f4",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "approval_required",
"rules": [
{
"t": "set",
"p": "approval_required",
"pt": "msg",
"to": "payload.default_values",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 3470,
"y": 420,
"wires": [
[
"e0b3838ab709561b"
]
]
},
{
"id": "a06872fd8512eb8d",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Approval required",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 4850,
"y": 420,
"wires": []
},
{
"id": "ec869fcde783d888",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "entity_approval",
"rules": [
{
"t": "set",
"p": "entity_approval",
"pt": "msg",
"to": "$number(msg.payload.default_values)",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 3480,
"y": 460,
"wires": [
[
"0ab23bd954321b9c"
]
]
},
{
"id": "c0f28e1a21ee46d1",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Entity Approvers",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 4420,
"y": 460,
"wires": []
},
{
"id": "4b51a5788a45d420",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Entity Owner Approver Packet",
"func": "//{\n// \"input\": {\n// \"tickets_id\": msg.payload.id,\n// \"users_id_validate\": msg.form.approver_id,\n// \"comment_submission\": $string(\"A request for '\" & msg.form.name & \"' has been made that requires your approval.\"),\n// \"status\": 2\n// }\n//}\n\nif (msg.hasOwnProperty(\"entity_approvers\") ) {\n\n msg.input = [];\n msg.url = String(msg.api_url + '/Ticket/' + msg.payload.id + '/TicketValidation');\n\n\n for(var i = 0; i < msg.entity_approvers.length; i++ ) {\n\n var approver = {};\n \n approver.tickets_id = msg.payload.id;\n approver.comment_submission = String(\"As the person listed as responsible, this request requires your approval.\");\n approver.status = 2;\n approver.users_id_validate = msg.entity_approvers[i];\n\n\n \n msg.input[i] = approver;\n \n\n }\n\n msg.payload = {};\n msg.payload.input = msg.input;\n\n msg.method = \"POST\";\n\n return msg;\n}\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2830,
"y": 2140,
"wires": [
[
"7926c9939779dd37",
"e5548020922347cc"
]
]
},
{
"id": "f5462f2891c454ec",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "Approval Type Routing",
"property": "approval_type",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "entity",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 3940,
"y": 320,
"wires": [
[],
[]
]
},
{
"id": "20a4cf95c10a2a5c",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "msg.entity_id",
"rules": [
{
"t": "set",
"p": "entity_id",
"pt": "msg",
"to": "entity_id",
"tot": "flow"
},
{
"t": "delete",
"p": "entity_id",
"pt": "flow"
},
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "msg.api_url & \"/Profile_User?searchText[profiles_id]=\" & msg.entity_approval &\"&searchText[entities_id]=\" & msg.entity_id",
"tot": "jsonata"
},
{
"t": "set",
"p": "mehod",
"pt": "msg",
"to": "GET",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 3950,
"y": 460,
"wires": [
[
"3d1e72dfd4b897dc"
]
]
},
{
"id": "3d1e72dfd4b897dc",
"type": "link call",
"z": "f6f2187d.f17ca8",
"name": "Fetch Entity Approvers",
"links": [
"eb5f283400263c25"
],
"linkType": "static",
"timeout": "30",
"x": 4180,
"y": 460,
"wires": [
[
"c0f28e1a21ee46d1",
"2535b188f77fe631"
]
]
},
{
"id": "13b00547bd61210c",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Entity ID",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3860,
"y": 800,
"wires": []
},
{
"id": "0ab23bd954321b9c",
"type": "delay",
"z": "f6f2187d.f17ca8",
"name": "wait for flow.entity_id",
"pauseType": "delay",
"timeout": "2",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 3740,
"y": 460,
"wires": [
[
"20a4cf95c10a2a5c",
"d665febefbcb0731"
]
]
},
{
"id": "d665febefbcb0731",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Entity Approval: post wait",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 4010,
"y": 380,
"wires": []
},
{
"id": "efc41ed6a8dcc29b",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "Manual Start",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "num",
"x": 190,
"y": 320,
"wires": [
[
"2f0dd5172e907730"
]
]
},
{
"id": "2f0dd5172e907730",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "link out 1",
"mode": "link",
"links": [
"f2259793983f70a6",
"935f35904a0d89bf"
],
"x": 345,
"y": 320,
"wires": []
},
{
"id": "8cbff9c661802fc8",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "Manual Start",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "num",
"x": 3190,
"y": 2000,
"wires": [
[
"0e97a47512b3c7ef"
]
]
},
{
"id": "0e97a47512b3c7ef",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "link out 2",
"mode": "link",
"links": [
"f2259793983f70a6",
"935f35904a0d89bf"
],
"x": 3345,
"y": 2000,
"wires": []
},
{
"id": "2535b188f77fe631",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Add Approvers",
"func": "if(msg.payload.length > 0){\n\n msg.entity_approvers = \"[\";\n\n for(var i = 0; i < msg.payload.length; i++ ) {\n\n msg.entity_approvers = msg.entity_approvers + msg.payload[i].users_id + ',';\n }\n\n\n if (msg.entity_approvers != \"[\") {\n msg.entity_approvers = String(msg.entity_approvers).substring(0, msg.entity_approvers.length - 1) + \"]\";\n msg.entity_approvers = JSON.parse(msg.entity_approvers);\n } else {\n delete (msg.entity_approvers);\n }\n\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 4420,
"y": 500,
"wires": [
[
"fef2e3d863dd3b14",
"596b03adcd307cb4"
]
]
},
{
"id": "7926c9939779dd37",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Entity Owner Approval",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3440,
"y": 2140,
"wires": []
},
{
"id": "84ac2b5e6df44243",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "End GLPI Session",
"mode": "link",
"links": [
"4350bb1697165898"
],
"x": 570,
"y": 1960,
"wires": [],
"l": true
},
{
"id": "e5c1f581fdc90543",
"type": "trigger",
"z": "f6f2187d.f17ca8",
"name": "fail safe: End Session",
"op1": "",
"op2": "",
"op1type": "nul",
"op2type": "date",
"duration": "8",
"extend": true,
"overrideDelay": false,
"units": "s",
"reset": "1",
"bytopic": "all",
"topic": "topic",
"outputs": 1,
"x": 360,
"y": 1960,
"wires": [
[
"84ac2b5e6df44243",
"e86ff2dd49db8a79"
]
]
},
{
"id": "fef2e3d863dd3b14",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Add Approvers",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 4600,
"y": 500,
"wires": []
},
{
"id": "e86ff2dd49db8a79",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "FailSafe: End Session",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 360,
"y": 2000,
"wires": []
},
{
"id": "fa52923d181b861e",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "Manual Start",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "num",
"x": 3990,
"y": 260,
"wires": [
[
"d6e72db598c850a0"
]
]
},
{
"id": "d6e72db598c850a0",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "link out 3",
"mode": "link",
"links": [
"f2259793983f70a6",
"935f35904a0d89bf"
],
"x": 4145,
"y": 260,
"wires": []
},
{
"id": "04d760f9b1988f4b",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Add task to ticket for time tracking",
"rules": [
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "msg.api_url & '/Ticket/' & msg.payload.id &'/TicketTask/'",
"tot": "jsonata"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\t \"input\": {\t \"tickets_id\": msg.payload.id,\t \"taskcategories_id\": msg.category_id_automation_task,\t \"users_id\": msg.session_details.session.glpiID,\t \"content\": \"Created Ticket via NodeRed\",\t \"is_private\": 1,\t \"actiontime\": 10,\t \"state\": 2,\t \"users_id_tech\": msg.session_details.session.glpiID\t }\t\t}\t",
"tot": "jsonata"
},
{
"t": "set",
"p": "method",
"pt": "msg",
"to": "post",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2900,
"y": 2220,
"wires": [
[
"e5548020922347cc"
]
]
},
{
"id": "e930fc18412ba052",
"type": "link in",
"z": "f6f2187d.f17ca8",
"name": "GLPI: Fetch Session",
"links": [],
"x": 270,
"y": 260,
"wires": [
[
"865a5c31c2d4529c",
"24ee7dc3b08f78a1"
]
],
"l": true
},
{
"id": "048e10e4b5f175c8",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Individulal Forms",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1730,
"y": 900,
"wires": []
},
{
"id": "400a61dcdf038b1d",
"type": "inject",
"z": "f6f2187d.f17ca8",
"name": "Manual Start",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "1",
"payloadType": "num",
"x": 1170,
"y": 1320,
"wires": [
[
"610fb43bda07b3c3"
]
]
},
{
"id": "610fb43bda07b3c3",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "link out 4",
"mode": "link",
"links": [
"f2259793983f70a6",
"935f35904a0d89bf"
],
"x": 1325,
"y": 1320,
"wires": []
},
{
"id": "5c7a23d16f3799de",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "",
"rules": [
{
"t": "move",
"p": "answer_parts",
"pt": "msg",
"to": "parts",
"tot": "msg"
},
{
"t": "set",
"p": "form_parts.id",
"pt": "msg",
"to": "parts.id",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 240,
"y": 1400,
"wires": [
[
"706486ceadc2bee7"
]
]
},
{
"id": "731ac452a4471480",
"type": "join",
"z": "f6f2187d.f17ca8",
"name": "Combine Questions",
"mode": "custom",
"build": "array",
"property": "form",
"propertyType": "msg",
"key": "parts",
"joiner": "\\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "num",
"reduceFixup": "",
"x": 390,
"y": 1740,
"wires": [
[
"32337fc19b0c6c53",
"6abd782f33f6aa9f"
]
]
},
{
"id": "738079e881bd7c2c",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "task_category",
"rules": [
{
"t": "set",
"p": "task_category",
"pt": "msg",
"to": "$number(msg.payload.default_values)",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 3500,
"y": 660,
"wires": [
[
"675eebaa2b29490e",
"7d597c9f95237aec"
]
]
},
{
"id": "675eebaa2b29490e",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "debug 45",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 4060,
"y": 660,
"wires": []
},
{
"id": "706486ceadc2bee7",
"type": "switch",
"z": "f6f2187d.f17ca8",
"name": "",
"property": "form.field_type",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "description",
"vt": "str"
},
{
"t": "else"
}
],
"checkall": "false",
"repair": false,
"outputs": 2,
"x": 370,
"y": 1400,
"wires": [
[
"88a41fa724a24518"
],
[
"56d5a39010b82e94"
]
]
},
{
"id": "88a41fa724a24518",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "",
"rules": [
{
"t": "set",
"p": "form.answer",
"pt": "msg",
"to": "$replace( msg.payload.description, /(\\&\\#\\d{2}\\;\\/?[a-z]+\\&\\#\\d{2}\\;|\\r\\n)/, '')\t",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 600,
"y": 1380,
"wires": [
[
"d5037ce5a29693fc"
]
]
},
{
"id": "3a6a6d119c434dce",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Upload JSON to ticket",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 3420,
"y": 2260,
"wires": []
},
{
"id": "d5037ce5a29693fc",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Description Field as Value",
"func": "if(\n msg.form.field_type == 'hidden'\n &&\n msg.form.answer == '-description-'\n) {\n\n // msg.form.answer = msg.payload.description.replace(\"\\r)\", '').replace(\"\\n)\", '\\\\r\\\\n')\n msg.form.answer = msg.payload.description.replace(/\\r/g, '').replace(/\\n/g, '').replace(/\\\"/g, '&quot;')\n // msg.form.answer = msg.payload.description\n\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 870,
"y": 1420,
"wires": [
[
"46dd694a18a599c9"
]
]
},
{
"id": "87d33fd4cc09e27f",
"type": "link call",
"z": "f6f2187d.f17ca8",
"name": "GLPI: Get Session",
"links": [
"e930fc18412ba052"
],
"linkType": "static",
"timeout": "30",
"x": 470,
"y": 920,
"wires": [
[
"454c179e9999918e"
]
]
},
{
"id": "865a5c31c2d4529c",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Session Init begin",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 570,
"y": 300,
"wires": []
},
{
"id": "aa3f79a3aae107ec",
"type": "link in",
"z": "f6f2187d.f17ca8",
"name": "GLPI: Ticket Creation (ITIL Template)",
"links": [],
"x": 540,
"y": 1580,
"wires": [
[
"7ec7fc9e20c4a7e8",
"aecf1787ccb37139"
]
],
"l": true,
"info": "# Create Ticket using Ticket Template\n\nThis node is an entrypoint for the start of a workflow that uses the provided category to fetch the ticket template and use it to build the ticket.\n\nthe input object is `msg.form` with the following structure\n\n```json\n{\n \"approval_required\": msg.payload.data.ticket.approval_required,\n \"data\": msg.payload.data,\n \"name\": \"\",\n \"requester_id\": msg.itsm.user.id,\n \"requesttypes_id\": msg.payload.data.ticket.requesttype_id,\n \"ticket_category\": msg.payload.data.ticket.category_id,\n \"ticket_entity\": msg.payload.data.ticket.entity_id,\n \"auto_assign\": true\n \"technician\": 0 //Optional, int\n}\n```\n\n| Property | Type | Description |\n|:---|:---:|:---|\n| technician | `int` | _Optional_ Set to the GLPI User id of the user to assign as the technician |\n"
},
{
"id": "34d02c8cfe43bbe6",
"type": "link out",
"z": "f6f2187d.f17ca8",
"name": "Return to calling node",
"mode": "return",
"links": [],
"x": 4020,
"y": 1940,
"wires": [],
"l": true
},
{
"id": "aecf1787ccb37139",
"type": "debug",
"z": "f6f2187d.f17ca8",
"name": "Ticket Creation - Template",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 910,
"y": 1520,
"wires": []
},
{
"id": "30eb92e619af0e99",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "",
"rules": [
{
"t": "set",
"p": "glpi.msg_routing",
"pt": "msg",
"to": "ticket_creation",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 2590,
"y": 1940,
"wires": [
[
"34d02c8cfe43bbe6"
]
]
},
{
"id": "f44d85f3dd843e24",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "",
"rules": [
{
"t": "set",
"p": "glpi.msg_routing",
"pt": "msg",
"to": "ticket_task_creation_automation",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 3170,
"y": 2240,
"wires": [
[
"e5548020922347cc"
]
]
},
{
"id": "24ee7dc3b08f78a1",
"type": "change",
"z": "f6f2187d.f17ca8",
"name": "Defaults",
"rules": [
{
"t": "set",
"p": "authorization",
"pt": "msg",
"to": "config.glpi.authorization",
"tot": "global"
},
{
"t": "set",
"p": "app_token",
"pt": "msg",
"to": "config.glpi.app_token",
"tot": "global"
},
{
"t": "set",
"p": "api_url",
"pt": "msg",
"to": "config.glpi.api_url",
"tot": "global"
},
{
"t": "set",
"p": "category_id_automation_task",
"pt": "global",
"to": "config.glpi.category_id_automation_task",
"tot": "global"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 420,
"y": 260,
"wires": [
[
"e97bbbbac1bab270"
]
],
"icon": "font-awesome/fa-cogs"
},
{
"id": "432e2ad61476d045",
"type": "function",
"z": "f6f2187d.f17ca8",
"name": "Assign Ticket",
"func": "msg.url = global.get('config.glpi.api_url') + 'Ticket/' + msg.payload.id + '/Ticket_User';\nmsg.method = \"POST\";\n\nvar statusMessage = \"Added: \";\nvar ticketID = msg.payload.id;\n\n\nif (msg.form.hasOwnProperty(\"requester_id\") ) {\n\n msg.payload = {\n \"input\": {\n \"users_id\": msg.form.requester_id,\n \"tickets_id\": ticketID,\n \"type\": 1,\n \"use_notification\": 1\n }\n }\n\n node.send([\n msg,\n null,\n null\n ]);\n\n statusMessage += \"requester \" + msg.form.requester_id + \" \";\n\n}\n\nif ( msg.form.auto_assign || false ) {\n \n msg.payload = {\n \"input\": {\n \"users_id\": msg.session_details.session.glpiID,\n \"tickets_id\": ticketID,\n \"type\": 2,\n \"use_notification\": 0\n }\n };\n\n node.send([\n null,\n null,\n msg\n ]);\n\n statusMessage += \"technician \" + msg.session_details.session.glpiID + \" \";\n\n}\n\nif (msg.form.hasOwnProperty('technician_id') ) {\n\n msg.payload = {\n \"input\": {\n \"users_id\": msg.form.technician_id,\n \"tickets_id\": ticketID,\n \"type\": 2,\n \"use_notification\": 1\n }\n };\n\n node.send([\n null,\n null,\n msg\n ]);\n\n statusMessage += \"technician \" + msg.form.technician_id + \" \";\n\n}\n\n// always assign the API account as a watcher\nmsg.payload = {\n \"input\": {\n \"users_id\": msg.session_details.session.glpiID,\n \"tickets_id\": ticketID,\n \"type\": 3,\n \"use_notification\": 0\n }\n};\n\nnode.send([\n null,\n msg,\n null\n]);\n\nstatusMessage += \"watcher[Always] \" + msg.session_details.session.glpiID + \" \";\n\nnode.status({fill:\"blue\",shape:\"dot\",text:statusMessage});\n",
"outputs": 3,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2890,
"y": 2040,
"wires": [
[
"8d9762cb45d1a09d"
],
[
"8d9762cb45d1a09d"
],
[
"8d9762cb45d1a09d"
]
],
"outputLabels": [
"Requester",
"Watcher",
"Technician"
],
"icon": "font-awesome/fa-exchange",
"info": "# Assign the Ticket\n\nThis node generates the json body to assign the ticket. Currenty supports setting watcher and technician.\n\nTo assign the ticket set the following properties:\n\n- watcher is assigned automagically and is the user who is accessing the api.\n\n- Technician:\n\n - set the property `msg.form.auto_assign` to assign to the API user as the technician\n\n - set the property `msg.form.technician` to the id of the user to assign that user\n"
},
{
"id": "8e0d9bd8043dd53b",
"type": "inject",
"z": "24deed6b10f37f8f",
"g": "b5d607bb9a62875f",
"name": "Cron Trigger",
"props": [
{
"p": "cron.start",
"v": "",
"vt": "date"
}
],
"repeat": "60",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"x": 180,
"y": 160,
"wires": [
[
"79e414f65b0e157b"
]
]
},
{
"id": "79e414f65b0e157b",
"type": "function",
"z": "24deed6b10f37f8f",
"g": "b5d607bb9a62875f",
"name": "Route: Time based",
"func": "var minute = msg;\nvar hour = null;\nvar day = null;\nvar week = null;\nvar month = null;\n\nvar date;\ndate = new Date(msg.cron.start);\n\n// node.warn(msg.start);\n// node.warn(String(\"minute: \" + date.getMinutes()))\n// node.warn(String(\"seconds: \" + String(date.getSeconds()).padStart(2, \"0\")))\n// node.warn(String(\"hour: \" + String(date.getHours()).padStart(2, \"0\")))\n// node.warn(String(\"day: \" + String(date.getDay()).padStart(2, \"0\")))\n// node.warn(String(\"date: \" + String(date.getDate()).padStart(2, \"0\")))\n\nmsg.cron.trigger = 'minute';\n\n\n\nif(\n String(date.getMinutes()).padStart(2, \"0\") == \"00\" \n) { // Hour\n\n msg.cron.trigger = \"hour\";\n\n}\n\nif (\n String(date.getHours()).padStart(2, \"0\") == \"00\" &&\n String(date.getMinutes()).padStart(2, \"0\") == \"00\"\n) { // Daily\n\n msg.cron.trigger = \"day\";\n\n}\n\nif (\n String(date.getDay()).padStart(2, \"0\") == \"00\" &&\n String(date.getHours()).padStart(2, \"0\") == \"00\" &&\n String(date.getMinutes()).padStart(2, \"0\") == \"00\"\n) { // Weekly\n\n msg.cron.trigger = \"week\";\n\n}\n\nif (\n String(date.getDate()).padStart(2, \"0\") == \"01\" &&\n String(date.getDay()).padStart(2, \"0\") == \"00\" &&\n String(date.getHours()).padStart(2, \"0\") == \"00\" &&\n String(date.getMinutes()).padStart(2, \"0\") == \"00\"\n) { // Weekly\n\n msg.cron.trigger = \"month\";\n\n}\n\nnode.send([\n minute,\n hour,\n day,\n week,\n month\n]);",
"outputs": 5,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 430,
"y": 240,
"wires": [
[
"7e6699ce0159226a",
"8f313772a6e82e96"
],
[
"61115e9c6e619dae"
],
[
"2d78bd7d0f411721"
],
[
"47f68cd20a8a528b"
],
[
"348b594ba5acb470"
]
],
"outputLabels": [
"minute",
"hour",
"day",
"week",
"month"
],
"icon": "node-red/timer.svg"
},
{
"id": "8f313772a6e82e96",
"type": "debug",
"z": "24deed6b10f37f8f",
"g": "b5d607bb9a62875f",
"name": "Minute",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 810,
"y": 180,
"wires": []
},
{
"id": "7e6699ce0159226a",
"type": "link call",
"z": "24deed6b10f37f8f",
"g": "b5d607bb9a62875f",
"name": "Clean Expired Tokens",
"links": [
"e25b155a2a29f16d"
],
"linkType": "static",
"timeout": "30",
"x": 860,
"y": 140,
"wires": [
[
"2bcdbb78b4e9181f"
]
]
},
{
"id": "61115e9c6e619dae",
"type": "debug",
"z": "24deed6b10f37f8f",
"g": "b5d607bb9a62875f",
"name": "Hourly",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 810,
"y": 220,
"wires": []
},
{
"id": "2d78bd7d0f411721",
"type": "debug",
"z": "24deed6b10f37f8f",
"g": "b5d607bb9a62875f",
"name": "Daily",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 810,
"y": 260,
"wires": []
},
{
"id": "47f68cd20a8a528b",
"type": "debug",
"z": "24deed6b10f37f8f",
"g": "b5d607bb9a62875f",
"name": "Weekly",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 300,
"wires": []
},
{
"id": "348b594ba5acb470",
"type": "debug",
"z": "24deed6b10f37f8f",
"g": "b5d607bb9a62875f",
"name": "Monthly",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 340,
"wires": []
},
{
"id": "2bcdbb78b4e9181f",
"type": "debug",
"z": "24deed6b10f37f8f",
"g": "b5d607bb9a62875f",
"name": "Cron Complete",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1120,
"y": 260,
"wires": []
},
{
"id": "8c5bb81ae0b14703",
"type": "fs-list",
"z": "24deed6b10f37f8f",
"g": "f7c0a5bee0e0df33",
"name": "fetch token files",
"path": "path",
"pathType": "msg",
"pattern": "*.json",
"patternType": "str",
"filter": "files",
"recursive": false,
"follow": false,
"property": "files",
"propertyType": "msg",
"x": 1960,
"y": 160,
"wires": [
[
"f4da55e70a4f8c2c"
]
]
},
{
"id": "b2e1cdc1778fd936",
"type": "function",
"z": "24deed6b10f37f8f",
"g": "f7c0a5bee0e0df33",
"name": "Build Path",
"func": "msg.cron.name = 'Remove expired token'\nmsg.path = String(env.get('HOME') + '/' + global.get('config.paths.token_sessions'));\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1570,
"y": 160,
"wires": [
[
"a3bd692422c0fcf5"
]
],
"icon": "node-red-contrib-filesystem/fs-mkdir.svg"
},
{
"id": "f4da55e70a4f8c2c",
"type": "function",
"z": "24deed6b10f37f8f",
"g": "f7c0a5bee0e0df33",
"name": "Build Path",
"func": "\nvar files = msg.files;\nvar filesfound = files.length;\n\nvar new_msg = {\n \"cron\": msg.cron,\n \"_linkSource\": msg._linkSource\n};\n\nnode.status({fill:\"blue\",shape:\"dot\",text:String( filesfound + \" found\")});\n\n\nfor (var i = 0; i < filesfound; i++ ) {\n\n new_msg.path = msg.path;\n new_msg.filename = String(msg.path + msg.files[i]);\n node.send([new_msg, null]);\n\n}\n\nif (filesfound == 0 ) {\n\n new_msg.cron.task = 'No Tokens Found';\n\n node.send([null, new_msg]);\n\n}",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2150,
"y": 160,
"wires": [
[
"44c01ba9bfc47ee8"
],
[
"291408859782056d"
]
],
"outputLabels": [
"Continue",
"No Action Required"
]
},
{
"id": "44c01ba9bfc47ee8",
"type": "file in",
"z": "24deed6b10f37f8f",
"g": "f7c0a5bee0e0df33",
"name": "Read Token File",
"filename": "filename",
"filenameType": "msg",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 2360,
"y": 160,
"wires": [
[
"55d7ad6e4958f882"
]
]
},
{
"id": "55d7ad6e4958f882",
"type": "json",
"z": "24deed6b10f37f8f",
"g": "f7c0a5bee0e0df33",
"name": "",
"property": "payload",
"action": "obj",
"pretty": false,
"x": 2490,
"y": 160,
"wires": [
[
"bb5ccb49f1aa1036"
]
],
"icon": "font-awesome/fa-exchange"
},
{
"id": "bb5ccb49f1aa1036",
"type": "function",
"z": "24deed6b10f37f8f",
"g": "f7c0a5bee0e0df33",
"name": "Process Token File",
"func": "var file_delete = msg;\nvar file_keep = null;\n\nnode.status({ fill: \"red\", shape: \"dot\", text: \"function did not complete\" });\n\nmsg.cron.task = 'delete'\nmsg.cron.data = {\n \"filename\": msg.filename\n}\n\nif( msg.payload.hasOwnProperty('datetime') ) {\n\n if( msg.payload.datetime > Date.now() ) {\n\n if ( msg.payload.hasOwnProperty('user') ){\n\n if(\n msg.payload.user.hasOwnProperty('username') &&\n msg.payload.user.hasOwnProperty('fname') &&\n msg.payload.user.hasOwnProperty('lname') &&\n msg.payload.user.hasOwnProperty('mail')\n ){\n\n file_delete = null;\n msg.cron.task = 'do nothing'\n file_keep = msg;\n\n } else {\n\n node.status({ fill: \"yellow\", shape: \"dot\", text: \"missing a required user field\" });\n\n }\n\n } else {\n\n node.status({ fill: \"yellow\", shape: \"dot\", text: \"user field\" });\n\n }\n\n } else {\n\n node.status({ fill: \"yellow\", shape: \"dot\", text: \"expired\" });\n\n }\n\n} else {\n\n node.status({fill:\"yellow\",shape:\"dot\",text:\"missing datetime\"});\n\n}\n\ndelete msg.path;\ndelete msg.filename;\ndelete msg.payload;\n\nnode.send([\n file_delete,\n file_keep\n]);",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2650,
"y": 160,
"wires": [
[
"f5f9e14092781e29"
],
[
"966779cca7297dec"
]
],
"outputLabels": [
"Delete",
"Keep"
],
"icon": "font-awesome/fa-repeat"
},
{
"id": "f5f9e14092781e29",
"type": "fs-remove",
"z": "24deed6b10f37f8f",
"g": "f7c0a5bee0e0df33",
"path": "",
"pathType": "msg",
"filename": "filename",
"filenameType": "msg",
"recursive": false,
"exist": true,
"name": "Delete Token File",
"x": 2870,
"y": 140,
"wires": [
[
"0f30a271d9c71f74"
]
]
},
{
"id": "e25b155a2a29f16d",
"type": "link in",
"z": "24deed6b10f37f8f",
"g": "f7c0a5bee0e0df33",
"name": "Clean expired Tokens",
"links": [],
"x": 1400,
"y": 160,
"wires": [
[
"b2e1cdc1778fd936"
]
],
"icon": "font-awesome/fa-paint-brush",
"l": true
},
{
"id": "0f30a271d9c71f74",
"type": "link out",
"z": "24deed6b10f37f8f",
"g": "f7c0a5bee0e0df33",
"name": "Return",
"mode": "return",
"links": [],
"x": 3070,
"y": 200,
"wires": [],
"l": true
},
{
"id": "a3bd692422c0fcf5",
"type": "fs-mkdir",
"z": "24deed6b10f37f8f",
"g": "f7c0a5bee0e0df33",
"name": "Create Dirs if not exist",
"purpose": "reg",
"path": "",
"pathType": "msg",
"foldername": "path",
"foldernameType": "msg",
"recursive": true,
"exists": false,
"prefix": "",
"prefixType": "str",
"mode": "777",
"property": "payload",
"propertyType": "msg",
"x": 1760,
"y": 160,
"wires": [
[
"8c5bb81ae0b14703"
]
]
}
]