[ { "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", "50d19d3ce5cf88f2", "e5ae19af5f6d6561", "781d23c946457b30", "9d93b8dfe83bf3ca", "e551d77d5412aced", "4ed718e1ae800bad" ], "x": 1314, "y": 19, "w": 812, "h": 127 }, { "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": 114, "y": 79, "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": 114, "y": 239, "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, "w": 2312, "h": 182 }, { "id": "10a6c6b12749dda9", "type": "group", "z": "8179bf22c4c31682", "name": "Returns: string msg.payload", "style": { "label": true }, "nodes": [ "804feccd90b3276c", "869469819396a632", "c4e40d6f6678bb55", "e62119d30db09cce", "8e670403cf071aaf" ], "x": 114, "y": 359, "w": 1012, "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, "w": 2798, "h": 774, "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", "69f0d6271fe16536" ], "x": 94, "y": 1487, "w": 3012, "h": 1334, "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", "842ade29052f7e66", "957b63c9fc58a139", "02812e8708980b09", "e83ed4274d3959f3", "06b5d27bbf1e5b16", "32d8df5c0bb564cb", "fb7fea44905cf7a4" ], "x": 154, "y": 59, "w": 1432, "h": 182 }, { "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, "w": 4704, "h": 228, "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": 2174, "y": 79, "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": "e8558844b3710e7b", "type": "group", "z": "8179bf22c4c31682", "name": "Returns: string, msg.filename (Session File)", "style": { "label": true }, "nodes": [ "17276c106d99423c", "dacd02c9aec07af9", "745056010192e36a", "aade2f705a555f31", "1bc65c1f44b4a1ac", "b595d8148f247f69" ], "x": 114, "y": 519, "w": 992, "h": 82 }, { "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, "w": 512, "h": 82 }, { "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, "w": 512, "h": 82 }, { "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, "w": 1432, "h": 122 }, { "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, "w": 912, "h": 122 }, { "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, "w": 1752, "h": 122 }, { "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, "w": 1452, "h": 142 }, { "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, "w": 1072, "h": 122 }, { "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", "b174f7bc1d398a56", "3dc07bb0a7d4f647" ], "x": 174, "y": 339, "w": 552, "h": 202, "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, "w": 972, "h": 142, "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, "w": 812, "h": 122, "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, "w": 1152, "h": 122, "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, "w": 1412, "h": 122, "info": "# Change User Password\n\nChange the users password within LDAP" }, { "id": "177a7aba70483ccb", "type": "group", "z": "8179bf22c4c31682", "g": "bbd929c437c592ea", "name": "Cookie Validation", "style": { "stroke": "#ffC000", "fill": "#ffffbf", "label": true, "color": "#777777" }, "nodes": [ "bcaed4334222c14a" ], "x": 508, "y": 1513, "w": 1204, "h": 234 }, { "id": "cc33365c2aa59e35", "type": "group", "z": "8179bf22c4c31682", "g": "bbd929c437c592ea", "name": "Token", "style": { "stroke": "#0070c0", "fill": "#ffffbf", "label": true }, "nodes": [ "c10e09e4bfbddfd7", "53a5ee55ee916cec", "75c44e5f7f101beb", "a4bc5830daf9801a" ], "x": 514, "y": 1773, "w": 2072, "h": 328 }, { "id": "7225c45ad941c14f", "type": "group", "z": "8179bf22c4c31682", "g": "bbd929c437c592ea", "name": "Oauth2", "style": { "stroke": "#0070c0", "fill": "#ffffbf", "label": true, "color": "#777777" }, "nodes": [ "9f416bc258c1a60c", "bc5ca736a6e324e5", "8964a5bda9eb7113", "60a97c78327c3a6a", "8ad6190854001584", "21ec376b58ac0c54", "9f3711f96411e2cc", "f5e65e1ae7e8b812", "1e2dce9d25c567d6", "261436c730a46051", "97fb6e1471c0f7cd" ], "x": 514, "y": 2153, "w": 2078, "h": 394, "info": "# Oauth2 Authentication\n\n" }, { "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": "75c44e5f7f101beb", "type": "group", "z": "8179bf22c4c31682", "g": "cc33365c2aa59e35", "name": "Token Session", "style": { "label": true, "stroke": "#6f2fa0", "fill": "#bfdbef" }, "nodes": [ "42a1e057dda56f95", "366892fde876296f", "8b1fef39c34f5513", "95f44fbb0ddd39fc" ], "x": 754, "y": 1799, "w": 672, "h": 122 }, { "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": 534, "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": "9f3711f96411e2cc", "type": "group", "z": "8179bf22c4c31682", "g": "7225c45ad941c14f", "name": "Oauth2: Fetch User Token", "style": { "stroke": "#ffC000", "fill": "#dbcbe7", "label": true, "color": "#777777" }, "nodes": [ "8b072412d6eea267", "07ee83c8d9bdbcb2", "a4a3bb52d2eaa071", "9d0d1d9a6c596428", "a49db4bcea29097d", "444cde06405f24e3" ], "x": 1034, "y": 2399, "w": 972, "h": 122 }, { "id": "f5e65e1ae7e8b812", "type": "group", "z": "8179bf22c4c31682", "g": "7225c45ad941c14f", "name": "Oauth2: Session", "style": { "stroke": "#6f2fa0", "fill": "#bfdbef", "label": true, "color": "#777777" }, "nodes": [ "55efe159b8d86e8f", "50e12d2b699abb59", "3254bbe21538dc25", "b371f5e8c32059f3", "e6f37f07e9217707", "68cdc18107b77029", "412814a194fb2e27", "a30dab395f333826", "7873f07f92e9be20", "36c7736ada06ef15", "54e638b390e13c61" ], "x": 1034, "y": 2179, "w": 1532, "h": 202 }, { "id": "69f0d6271fe16536", "type": "group", "z": "8179bf22c4c31682", "g": "bbd929c437c592ea", "name": "Auth: Save Session", "style": { "stroke": "#0070c0", "fill": "#e3f3d3", "label": true, "color": "#777777" }, "nodes": [ "d24ebda198149601", "1380f91c814b8e2f", "c3a8957e4400e12f", "05880bb4ed6cab41", "10120b4cdade08c6", "3629b0bb901c20a7", "d43b2afbfaad2d31", "bcab3f1c2966f5aa", "150344ba8db2ceee", "4ff84724b26afc75", "3f5bfeb6ef2a9467", "b51064e9a331947d", "5eaba17d961e2efb", "fb600cd457e87c43", "431bb2a5b956dd2c", "e2cbcdcc69e9ce21" ], "x": 234, "y": 2599, "w": 2352, "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": "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": "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": 380, "y": 440, "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": "e83ed4274d3959f3", "type": "junction", "z": "379c65a27117b46c", "g": "b994fe21efb223a9", "x": 1340, "y": 140, "wires": [ [ "de01a4559aecf1c4" ] ] }, { "id": "06b5d27bbf1e5b16", "type": "junction", "z": "379c65a27117b46c", "g": "b994fe21efb223a9", "x": 1000, "y": 140, "wires": [ [ "957b63c9fc58a139", "fb7fea44905cf7a4" ] ] }, { "id": "32d8df5c0bb564cb", "type": "junction", "z": "379c65a27117b46c", "g": "b994fe21efb223a9", "x": 460, "y": 100, "wires": [ [ "7df31641fc2fe59a" ] ] }, { "id": "e551d77d5412aced", "type": "junction", "z": "42b9663b67dbd983", "g": "a64f4a2c837d5c3c", "x": 1720, "y": 120, "wires": [ [ "4ed718e1ae800bad" ] ] }, { "id": "4ed718e1ae800bad", "type": "junction", "z": "42b9663b67dbd983", "g": "a64f4a2c837d5c3c", "x": 1860, "y": 120, "wires": [ [ "e5ae19af5f6d6561" ] ] }, { "id": "3f5bfeb6ef2a9467", "type": "junction", "z": "8179bf22c4c31682", "g": "69f0d6271fe16536", "x": 1500, "y": 2680, "wires": [ [ "3629b0bb901c20a7", "10120b4cdade08c6" ] ] }, { "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": 420, "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": 460, "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": 450, "y": 500, "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": "/usr/src/node-red/config.json", "vt": "str" } ], "repeat": "300", "crontab": "", "once": true, "onceDelay": "2", "topic": "", "x": 290, "y": 100, "wires": [ [ "32d8df5c0bb564cb" ] ] }, { "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": 100, "wires": [ [ "d109fc9821987d4f" ] ] }, { "id": "d109fc9821987d4f", "type": "json", "z": "379c65a27117b46c", "g": "b994fe21efb223a9", "name": "", "property": "payload", "action": "obj", "pretty": false, "x": 770, "y": 100, "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": 100, "wires": [ [ "06b5d27bbf1e5b16" ] ] }, { "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": 1470, "y": 200, "wires": [] }, { "id": "36cf43c754570ebd", "type": "watch", "z": "379c65a27117b46c", "g": "b994fe21efb223a9", "name": "", "files": "config.json", "recursive": "", "x": 320, "y": 140, "wires": [ [ "32d8df5c0bb564cb" ] ] }, { "id": "842ade29052f7e66", "type": "change", "z": "379c65a27117b46c", "g": "b994fe21efb223a9", "name": "global.config.glpi", "rules": [ { "t": "set", "p": "CurrentGlobalConfig", "pt": "msg", "to": "config", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1250, "y": 200, "wires": [ [ "de01a4559aecf1c4" ] ] }, { "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\nif ( String(msg.req.originalUrl).indexOf('?') > 0 ) {\n\n msg.http.path = String(msg.req.originalUrl).split('?')[0].split('/');\n\n}else{\n msg.http.path = String(msg.req.originalUrl).split('/');\n\n}\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\n\n} else if (String(msg.req.originalUrl).indexOf('.') > 0 ) {\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": 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": 450, "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": 2310, "y": 160, "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": 2730, "y": 160, "wires": [ [ "0107c5fd18462084" ] ] }, { "id": "0107c5fd18462084", "type": "link call", "z": "379c65a27117b46c", "g": "1b2783bfbb09503e", "name": "", "links": [ "43eebf1623f29074" ], "linkType": "static", "timeout": "30", "x": 2890, "y": 160, "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": 3010, "y": 160, "wires": [ [ "9bb0664a91ae9b97" ] ] }, { "id": "9bb0664a91ae9b97", "type": "file", "z": "379c65a27117b46c", "g": "1b2783bfbb09503e", "name": "", "filename": "filename", "filenameType": "msg", "appendNewline": true, "createDir": true, "overwriteFile": "true", "encoding": "none", "x": 3120, "y": 160, "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": 3250, "y": 160, "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": 2520, "y": 160, "wires": [ [ "2f7615b7afa603aa" ] ] }, { "id": "702a6efc7be81391", "type": "comment", "z": "379c65a27117b46c", "g": "1b2783bfbb09503e", "name": "ToDo: add random salt to hash generation", "info": "", "x": 2660, "y": 120, "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.hasOwnProperty('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", "2ed31116a1e83c99" ], "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": 630, "y": 400, "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": "var cont = null;\nvar callback = null;\nvar not_configured = null;\n\nvar status = {fill:\"red\",shape:\"ring\",text:\"Err: Incomplete\"};\n\nif (\n global.get(\"config\") == undefined ||\n (\n global.get(\"config\") != undefined &&\n global.get(\"config.auth_method\") == undefined\n )\n) {\n\n status.text = 'No Config';\n\n msg.statusCode = 400;\n\n not_configured = msg;\n\n} else {\n\n if ( \n Array(global.get(\"config.auth_method\")).includes('oauth2') &&\n global.get(\"config.oauth2\") == undefined\n ) {\n\n status.text = 'No OAuth2 Config';\n\n msg.statusCode = 400;\n\n not_configured = msg;\n\n }else{\n\n msg.http = {\n \"client\": msg.req.connection.remoteAddress,\n \"headers\": msg.req.headers,\n \"timestamp\": Date.now()\n }\n\n if (msg.req.params[\"0\"] == 'callback' ){\n\n status.fill = 'blue';\n status.text = 'Oauth2 Callback';\n\n callback = msg;\n\n }else{\n\n status.fill = 'green';\n status.text = 'Continue';\n\n cont = msg;\n\n }\n }\n}\nnode.status( status );\n\nnode.send([\n cont,\n callback,\n not_configured\n]);\n", "outputs": 3, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 470, "y": 440, "wires": [ [ "28713941e03e2bf5" ], [ "b174f7bc1d398a56" ], [ "3dc07bb0a7d4f647" ] ], "outputLabels": [ "Continue", "Oauth2 Callback", "Server Not Configured" ], "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", "5b97592fe62125c7", "3dc07bb0a7d4f647" ], "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": "b174f7bc1d398a56", "type": "link out", "z": "379c65a27117b46c", "g": "cf2a3f84cb26a12c", "name": "Oauth2 call", "mode": "link", "links": [ "9f416bc258c1a60c" ], "x": 630, "y": 440, "wires": [], "icon": "font-awesome/fa-lock", "l": true }, { "id": "f57a5bd56ce68760", "type": "inject", "z": "379c65a27117b46c", "name": "Trigger: Oauth2 Config", "props": [ { "p": "payload" } ], "repeat": "300", "crontab": "", "once": true, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 3630, "y": 140, "wires": [ [] ] }, { "id": "957b63c9fc58a139", "type": "credentials", "z": "379c65a27117b46c", "g": "b994fe21efb223a9", "name": "Oauth2", "props": [ { "value": "config.oauth.client_secret", "type": "global" }, { "value": "config.oauth.client_id", "type": "global" }, { "value": "config.oauth.url.token", "type": "global" }, { "value": "config.oauth.url.auth", "type": "global" }, { "value": "config.oauth.url.callback", "type": "global" } ], "x": 1100, "y": 140, "wires": [ [ "02812e8708980b09" ] ], "info": "# Oauth2 Configuration\n\nThis node stores it's values within `flows_cred.json` and therefor takes advantage of encrypting the values.\n\n## Structure\n\n``` json\n\n{\n \"client_secret\": \"\",\n \"client_id\": \"\",\n \"url\": {\n \"token\": \"\",\n \"auth\": \"\",\n \"callback\": \"http://127.0.0.1:1881/callback\"\n }\n}\n\n```\n\n| item | type | description |\n|:---:|:---:|:---|\n| client_secret | `string` | client secret |\n| client_id | `string` | client id |\n| url.token | `string` | Token URL |\n| url.auth | `string` | Auth URL |\n| url.callback | `string` | Authentication Callback URL, this value must always be `{protocol}://{domain}/callback`. i.e. `http://127.0.0.1:1881/callback` |\n " }, { "id": "02812e8708980b09", "type": "change", "z": "379c65a27117b46c", "g": "b994fe21efb223a9", "name": "global.config", "rules": [ { "t": "set", "p": "CurrentGlobalConfig", "pt": "msg", "to": "config", "tot": "global" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1230, "y": 140, "wires": [ [ "e83ed4274d3959f3" ] ] }, { "id": "3dc07bb0a7d4f647", "type": "link out", "z": "379c65a27117b46c", "g": "cf2a3f84cb26a12c", "name": "No Config", "mode": "link", "links": [ "5ad10ea406e2d3a7" ], "x": 620, "y": 480, "wires": [], "icon": "font-awesome/fa-hand-stop-o", "l": true }, { "id": "fb7fea44905cf7a4", "type": "credentials", "z": "379c65a27117b46c", "g": "b994fe21efb223a9", "name": "GLPI", "props": [ { "value": "config.glpi.api_url", "type": "global" }, { "value": "config.glpi.authorization", "type": "global" }, { "value": "config.glpi.app_token", "type": "global" }, { "value": "config.glpi.category_id_automation_task", "type": "global" }, { "value": "config.glpi.debug_on", "type": "global" } ], "x": 1110, "y": 200, "wires": [ [ "842ade29052f7e66" ] ], "info": "# GLPI Configuration\n\nThis node stores it's values within `flows_cred.json` and therefor takes advantage of encrypting the values.\n\n## Structure\n\n``` json\n\n{\n \"api_url\": \"http://glpi/apirest.php/\",\n \"authorization\": \"user_token ***\",\n \"app_token\": \"\",\n \"category_id_automation_task\": 0,\n \"debug_on\": false\n}\n\n```\n\n| item | type | description |\n|:---:|:---:|:---|\n| api_url | `string` | URL for the API `{protocol}://{domain}/apirest.php/` |\n| authorization | `string` | Auth token suffixed with `user_token` |\n| app_token | `string` | Application token |\n| category_id_automation_task | `int` | the category for this automation task to be applied to the ticket task |\n| debug_on | `bool` | Authentication Callback URL, this value must always be `{protocol}://{domain}/callback`. i.e. `http://127.0.0.1:1881/callback` |\n " }, { "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": "
\n

Password reset Questions

\n\n
\n

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.

\n

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.

\n

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.

\n
\n \n \n \n \n
\n\n
\n \n \n \n \n
\n\n
\n \n \n \n \n
\n\n

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.

\n\n \n
\n \n
\n\n
\n Results\n \n
\n
\n \n
\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": "
\n

Self-Service Password Reset

\n\n
\n

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.

\n \n \n\n \n \n\n \n \n\n \n \n\n

This is the first half of your password

\n \n\n \n
\n \n
\n\n
\n Results\n \n
\n
\n \n
\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": "
\n

Main Menu

\n\n

G'Day {{{ session.user.fname}}}

\n\n \n \n \n{{#global.config.developer_mode}}\n \n \n{{/global.config.developer_mode}}\n\n
", "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": [ [ "9d93b8dfe83bf3ca" ] ], "icon": "node-red/file.svg", "l": true }, { "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": 80, "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": "html", "syntax": "mustache", "template": "\n \n No Fuss Computing\n \n \n \n \n \n \n \n \n\n
\n\n
\n\n {{{ html.body }}}\n\n
\n\n\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
\n

Account Details

\n\n
\n

\n\n \n \n\n \n \n\n \n \n\n \n \n\n \n
\n \n
\n\n
\n Results\n \n
\n
\n \n
\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
\n

Change Password

\n \n
\n

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.

\n \n \n \n \n \n \n \n \n \n \n \n
\n\n \n \n
\n \n
\n Results\n \n
\n
\n \n
\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 \"auth_method\": [ \"oauth\", \"token\" ],\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": "9d93b8dfe83bf3ca", "type": "function", "z": "42b9663b67dbd983", "g": "a64f4a2c837d5c3c", "name": "HTML", "func": "var content = null;\nvar redirect = null;\n\nif ( msg.statusCode > 399 && msg.statusCode < 300 ){\n msg.payload = \"

{{ statusCode }}: {{ http.error }}

\";\n content = msg;\n\n} else {\n // Redirect\n delete msg.payload;\n redirect = msg;\n}\n\nnode.send([\n content,\n redirect\n])\n", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1610, "y": 100, "wires": [ [ "781d23c946457b30" ], [ "e551d77d5412aced" ] ], "outputLabels": [ "Content", "Redirect" ], "icon": "font-awesome/fa-question" }, { "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 < 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": 640, "y": 140, "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": 390, "y": 140, "wires": [ [ "0eeaba70b043a226" ] ] }, { "id": "43eebf1623f29074", "type": "link in", "z": "8179bf22c4c31682", "g": "0d96945ec7d069cb", "name": "Hash String", "links": [], "x": 210, "y": 140, "wires": [ [ "9c9c7bbd71c78d8e" ] ], "l": true }, { "id": "8fadd3c4294a6939", "type": "link out", "z": "8179bf22c4c31682", "g": "0d96945ec7d069cb", "name": "Return", "mode": "return", "links": [], "x": 1010, "y": 120, "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": 870, "y": 120, "wires": [ [ "8fadd3c4294a6939" ] ] }, { "id": "8c13bbcc86d93be8", "type": "link in", "z": "8179bf22c4c31682", "g": "bcd2727d77a80ce3", "name": "Hash: User-Questions-Filename", "links": [], "x": 270, "y": 280, "wires": [ [ "858268a5d48a4486" ] ], "l": true }, { "id": "a35b8cc53c276d62", "type": "link call", "z": "8179bf22c4c31682", "g": "bcd2727d77a80ce3", "name": "", "links": [ "43eebf1623f29074" ], "linkType": "static", "timeout": "30", "x": 650, "y": 280, "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": 490, "y": 280, "wires": [ [ "a35b8cc53c276d62" ] ] }, { "id": "998b007182d85455", "type": "link out", "z": "8179bf22c4c31682", "g": "bcd2727d77a80ce3", "name": "Return", "mode": "return", "links": [], "x": 950, "y": 280, "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": 810, "y": 280, "wires": [ [ "998b007182d85455" ] ] }, { "id": "804feccd90b3276c", "type": "exec", "z": "8179bf22c4c31682", "g": "10a6c6b12749dda9", "command": "", "addpay": "command", "append": "", "useSpawn": "false", "timer": "1", "winHide": false, "oldrc": false, "name": "Generate random xx char string", "x": 750, "y": 420, "wires": [ [ "c4e40d6f6678bb55" ], [ "c4e40d6f6678bb55", "e62119d30db09cce" ], [] ] }, { "id": "869469819396a632", "type": "link in", "z": "8179bf22c4c31682", "g": "10a6c6b12749dda9", "name": "Generate random 6 char string", "links": [], "x": 270, "y": 420, "wires": [ [ "8e670403cf071aaf" ] ], "l": true }, { "id": "c4e40d6f6678bb55", "type": "link out", "z": "8179bf22c4c31682", "g": "10a6c6b12749dda9", "name": "Return", "mode": "return", "links": [], "x": 1010, "y": 400, "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": 1020, "y": 440, "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", "b174f7bc1d398a56" ], "x": 610, "y": 2200, "wires": [ [ "bc5ca736a6e324e5" ] ], "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", "54e638b390e13c61" ], "x": 1570, "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": 1370, "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);\n\ndelete msg.payload;\ndelete msg.filename;\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": 1380, "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": 1180, "y": 1600, "wires": [ [ "f20711a44b43b7d4", "2a858bd15a2d257e" ] ] }, { "id": "9c05ca2751f619a7", "type": "link out", "z": "8179bf22c4c31682", "g": "bcaed4334222c14a", "name": "No Saved Session", "mode": "link", "links": [ "e80aabc47c664088" ], "x": 1170, "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": 1150, "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 auth_url = global.get('config.oauth.url.auth') + \"?response_type=code&client_id=\" + global.get('config.oauth.client_id') + \"&redirect_uri=\" + encodeURIComponent(global.get('config.oauth.url.callback')) + \"&scope=openid&state=\" + String(Date.now());\n\nif (Object.keys(msg.req.cookies || {}).length > 0) {\n\n if ( msg.req.cookies.hasOwnProperty('auth')) {\n\n var filename = String(env.get('HOME') + '/' + global.get('config.paths.token_sessions')) + msg.req.cookies.auth + '.json';\n\n fs.stat( filename, function (err) {\n\n if (err) {\n status.text = \"No Saved Session\";\n status.fill = \"yellow\";\n\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 Auth Cookie\";\n status.fill = \"yellow\";\n\n msg.statusCode = 303;\n\n msg.headers = {\n Location: auth_url\n }\n\n no_session = msg;\n\n node.status(status);\n\n node.send([\n have_session,\n no_session\n ]);\n }\n\n} else {\n\n status.text = \"No Cookies\";\n status.fill = \"yellow\";\n\n node.status(status);\n\n msg.statusCode = 303;\n\n msg.headers = {\n Location: auth_url\n }\n\n no_session = msg;\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": 910, "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": 670, "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": 1560, "y": 1620, "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": 2330, "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": 2480, "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": 1290, "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": 1070, "y": 1860, "wires": [ [ "95f44fbb0ddd39fc" ], [ "366892fde876296f" ] ], "outputLabels": [ "True", "False" ] }, { "id": "8b1fef39c34f5513", "type": "link in", "z": "8179bf22c4c31682", "g": "75c44e5f7f101beb", "name": "Session: Token", "links": [ "da0811fbd7963934" ], "x": 860, "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": 1300, "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", "413dbeb6f2d0d2d0", "d24ebda198149601" ], "x": 2870, "y": 2780, "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": 3010, "y": 2780, "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": 610, "y": 1820, "wires": [ [] ], "icon": "node-red/arrow-in.svg", "l": true }, { "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 {\n\n status.text = \"Request\";\n callback = null;\n request = msg;\n\n msg.statusCode = 400;\n\n}\n\nnode.status(status);\n\nnode.send([\n callback,\n request\n]);\n", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 750, "y": 2200, "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", "9d0d1d9a6c596428" ], "x": 920, "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": 910, "y": 2240, "wires": [], "icon": "font-awesome/fa-exclamation-triangle", "l": true }, { "id": "21ec376b58ac0c54", "type": "link in", "z": "8179bf22c4c31682", "g": "7225c45ad941c14f", "name": "Oauth2: Finish", "links": [ "7873f07f92e9be20", "8964a5bda9eb7113", "a30dab395f333826" ], "x": 2240, "y": 2500, "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": 2460, "y": 2500, "wires": [], "icon": "node-red/arrow-in.svg", "l": true }, { "id": "54e638b390e13c61", "type": "link in", "z": "8179bf22c4c31682", "g": "f5e65e1ae7e8b812", "name": "Oauth2: Validate Current Session", "links": [ "9cbf4beaceba5255" ], "x": 1190, "y": 2280, "wires": [ [ "36c7736ada06ef15" ] ], "icon": "node-red/arrow-in.svg", "l": true }, { "id": "36c7736ada06ef15", "type": "function", "z": "8179bf22c4c31682", "g": "f5e65e1ae7e8b812", "name": "Session Valid?", "func": "// confirm status code return.\n// - does a non http/200 mean not authed?\n\nvar session_valid = null;\nvar refresh_token = null;\nvar must_auth = msg;\n\nvar status = { fill: \"red\", shape: \"ring\", text: \"ERR: Incomplete\" };\n\ndelete msg.payload;\ndelete msg.retry;\ndelete msg.headers;\ndelete msg.url;\ndelete msg.responseUrl;\n\nvar idToken = [];\n\nif ( Object.keys(msg.session.oauth2 || {}).length > 0 ){\n\n if (\n msg.session.oauth2.hasOwnProperty('access_token') &&\n msg.session.oauth2.hasOwnProperty('refresh_token') &&\n msg.session.oauth2.hasOwnProperty('id_token')\n ){\n\n\n var iToken = String(msg.session.oauth2.id_token).split('.');\n\n for (var i = 1; i < iToken.length; i++) {\n\n var base64 = Buffer.from(iToken[i - 1], 'base64');\n\n //decoded[(i - 1)] = Buffer.from(aToken[i - 1]).toString(decoded);\n //idToken[(i - 1)] = iToken[i - 1];\n idToken[(i - 1)] = base64.toString('ascii');\n\n }\n\n idToken[1] = JSON.parse(idToken[1]);\n\n //msg.idToken = idToken; // temp, remove post dev\n\n \n msg.refresh_expires = msg.session.datetime;\n msg.token_expires = idToken[1].exp;\n msg.now = Math.floor(Date.now() / 1000);\n\n if(\n msg.refresh_expires > msg.now &&\n msg.token_expires <= msg.now\n ) {\n \n status.text = \"Refresh Token\";\n\n refresh_token = msg;\n must_auth = null;\n\n } else if (\n msg.refresh_expires > msg.now &&\n msg.token_expires > msg.now\n ) {\n\n session_valid = msg;\n must_auth = null;\n status.text = \"Session Valid\";\n status.fill = \"green\";\n\n }\n\n } else {\n\n status.text = \"Failure: missing properties\";\n status.fill = \"yellow\";\n\n msg.statusCode = 303;\n\n msg.headers = {\n\n Location: global.get('config.oauth.url.auth') + \"?response_type=code&client_id=\" + global.get('config.oauth.client_id') + \"&redirect_uri=\" + encodeURIComponent(global.get('config.oauth.url.callback')) + \"&scope=openid&state=\" + String(Date.now())\n\n }\n\n }\n\n}\n\n\nnode.status(status);\n\nnode.send([\n session_valid,\n refresh_token,\n must_auth\n]);", "outputs": 3, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1440, "y": 2280, "wires": [ [ "7873f07f92e9be20" ], [ "1e2dce9d25c567d6", "55efe159b8d86e8f" ], [ "412814a194fb2e27", "a30dab395f333826" ] ], "outputLabels": [ "Authenticated", "Refresh Token", "Needs to Authenticate (redirect)" ], "icon": "font-awesome/fa-unlock-alt" }, { "id": "7873f07f92e9be20", "type": "link out", "z": "8179bf22c4c31682", "g": "f5e65e1ae7e8b812", "name": "Session Valid", "mode": "link", "links": [ "21ec376b58ac0c54" ], "x": 1640, "y": 2260, "wires": [], "icon": "font-awesome/fa-unlock", "l": true, "info": "# Session Valid\n\nThe saved session has not yet expired.\nThe flow can continue as the user is considered authenticated." }, { "id": "a30dab395f333826", "type": "link out", "z": "8179bf22c4c31682", "g": "f5e65e1ae7e8b812", "name": "Session not Valid", "mode": "link", "links": [ "21ec376b58ac0c54" ], "x": 1650, "y": 2300, "wires": [], "icon": "font-awesome/fa-lock", "l": true, "info": "# Session not Valid\n\n> Missing details from saved session.\n\nThis path has set HTTP/303 with the location set to the oauth2 provider authentication url." }, { "id": "412814a194fb2e27", "type": "debug", "z": "8179bf22c4c31682", "g": "f5e65e1ae7e8b812", "name": "debug 152", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1630, "y": 2340, "wires": [] }, { "id": "1e2dce9d25c567d6", "type": "debug", "z": "8179bf22c4c31682", "g": "7225c45ad941c14f", "name": "debug 151", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1890, "y": 2240, "wires": [] }, { "id": "55efe159b8d86e8f", "type": "function", "z": "8179bf22c4c31682", "g": "f5e65e1ae7e8b812", "name": "Build: Token Request", "func": "msg.method = \"POST\"\n\nmsg.url = global.get('config.oauth.url.token') + \"?grant_type=refresh_token\";\n\nmsg.headers = {}\n\nmsg.headers[\"content-type\"] = \"application/x-www-form-urlencoded\"\nmsg.headers[\"Authorization\"] = 'Basic ' + Buffer.from(global.get('config.oauth.client_id') + ':' + global.get('config.oauth.client_secret')).toString('base64');\n\nmsg.payload = \"grant_type=refresh_token&scope=openid&client_id=\" + global.get('config.oauth.client_id') + \"&client_secret=\" + global.get('config.oauth.client_secret') + \"&refresh_token=\" + msg.session.oauth2.refresh_token;\n\nmsg.token_refresh = true;\n\nreturn msg", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1920, "y": 2280, "wires": [ [ "50e12d2b699abb59" ] ] }, { "id": "50e12d2b699abb59", "type": "http request", "z": "8179bf22c4c31682", "g": "f5e65e1ae7e8b812", "name": "Refresh Token", "method": "use", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 2100, "y": 2280, "wires": [ [ "3254bbe21538dc25" ] ] }, { "id": "3254bbe21538dc25", "type": "switch", "z": "8179bf22c4c31682", "g": "f5e65e1ae7e8b812", "name": "", "property": "statusCode", "propertyType": "msg", "rules": [ { "t": "eq", "v": "200", "vt": "num" }, { "t": "else" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 2230, "y": 2280, "wires": [ [ "b371f5e8c32059f3", "e6f37f07e9217707" ], [ "68cdc18107b77029" ] ] }, { "id": "b371f5e8c32059f3", "type": "debug", "z": "8179bf22c4c31682", "g": "f5e65e1ae7e8b812", "name": "refresh", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 2380, "y": 2220, "wires": [] }, { "id": "e6f37f07e9217707", "type": "link out", "z": "8179bf22c4c31682", "g": "f5e65e1ae7e8b812", "name": "Oauth2: Token Refresh", "mode": "link", "links": [ "97fb6e1471c0f7cd" ], "x": 2430, "y": 2260, "wires": [], "icon": "node-red/arrow-in.svg", "l": true }, { "id": "68cdc18107b77029", "type": "debug", "z": "8179bf22c4c31682", "g": "f5e65e1ae7e8b812", "name": "debug 153", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 2390, "y": 2320, "wires": [] }, { "id": "3629b0bb901c20a7", "type": "debug", "z": "8179bf22c4c31682", "g": "69f0d6271fe16536", "name": "debug 141", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1610, "y": 2640, "wires": [] }, { "id": "d43b2afbfaad2d31", "type": "debug", "z": "8179bf22c4c31682", "g": "69f0d6271fe16536", "name": "debug 144", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 770, "y": 2740, "wires": [] }, { "id": "150344ba8db2ceee", "type": "link in", "z": "8179bf22c4c31682", "g": "69f0d6271fe16536", "name": "Session: Save Token", "links": [ "261436c730a46051" ], "x": 360, "y": 2700, "wires": [ [ "bcab3f1c2966f5aa" ] ], "icon": "node-red/arrow-in.svg", "l": true, "info": "# Oauth2 Process\n\nThis node processes the Oauth2 Packet received from the provider.\nIt is expected to be passed to this node as part of `msg.payload`" }, { "id": "bcab3f1c2966f5aa", "type": "function", "z": "8179bf22c4c31682", "g": "69f0d6271fe16536", "name": "Set User Details", "func": "// confirm status code return.\n// - does a non http/200 mean not authed?\n\nvar success = null;\nvar failure = msg;\n\nvar status = { fill: \"red\", shape: \"ring\", text: \"ERR: Incomplete\" };\n\nmsg.oauth2 = msg.payload;\ndelete msg.payload;\ndelete msg.retry;\ndelete msg.headers;\ndelete msg.url;\ndelete msg.responseUrl;\ndelete msg.statusCode;\n\nvar idToken = [];\n\n\n//msg.oauth2.expires = Math.floor(Date.now() / 1000) + msg.oauth2.expires_in;\n\n//msg.oauth2.refresh_expires = Math.floor(Date.now() / 1000) + msg.oauth2.refresh_expires_in;\n\n\nif ( Object.keys(msg.oauth2 || {}).length > 0 ){\n\n if (\n msg.oauth2.hasOwnProperty('access_token') &&\n msg.oauth2.hasOwnProperty('refresh_token') &&\n msg.oauth2.hasOwnProperty('id_token')\n ){\n\n\n var iToken = String(msg.oauth2.id_token).split('.');\n\n for (var i = 1; i < iToken.length; i++) {\n\n var base64 = Buffer.from(iToken[i - 1], 'base64');\n\n //decoded[(i - 1)] = Buffer.from(aToken[i - 1]).toString(decoded);\n //idToken[(i - 1)] = iToken[i - 1];\n idToken[(i - 1)] = base64.toString('ascii');\n\n }\n\n idToken[1] = JSON.parse(idToken[1]);\n\n\n msg.session = {\n \"datetime\": Math.floor(Date.now() / 1000) + msg.oauth2.refresh_expires_in,\n \"user\": {\n \"username\": idToken[1].preferred_username,\n \"mail\": idToken[1].email\n },\n \"oauth2\": msg.oauth2,\n \"type\": \"oauth2\"\n };\n\n msg.cookies = {\n \"auth\": {\n maxAge: msg.oauth2.refresh_expires_in * 1000\n }\n };\n\n msg.length = 60;\n\n success = msg;\n failure = null;\n status.text = \"Success\";\n status.fill = \"green\";\n\n } else {\n\n // success = null;\n // failure = msg;\n status.text = \"Failure: missing properties\";\n status.fill = \"yellow\";\n\n }\n\n}\n\n//msg.idToken = idToken;\n\n\n\nnode.status(status);\n\nnode.send([\n success,\n failure\n]);", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 580, "y": 2720, "wires": [ [ "5eaba17d961e2efb" ], [ "d43b2afbfaad2d31" ] ], "outputLabels": [ "Success", "Failure" ], "icon": "font-awesome/fa-question" }, { "id": "10120b4cdade08c6", "type": "link call", "z": "8179bf22c4c31682", "g": "69f0d6271fe16536", "name": "Get Session Filename", "links": [ "17276c106d99423c" ], "linkType": "static", "timeout": "30", "x": 1640, "y": 2680, "wires": [ [ "05880bb4ed6cab41" ] ], "icon": "font-awesome/fa-info-circle" }, { "id": "05880bb4ed6cab41", "type": "function", "z": "8179bf22c4c31682", "g": "69f0d6271fe16536", "name": "", "func": "var save_path = String(env.get('HOME') + '/' + global.get('config.paths.token_sessions'));\n\nvar status = {fill:\"red\",shape:\"ring\",text:\"message\"};\n\nif( msg.token_refresh ) {\n\n msg.filename = save_path + msg.filename;\n\n status.fill = 'green';\n status.text = 'Token Refresh';\n\n} else {\n\n msg.filename = save_path + msg.filename;\n\n status.fill = 'yellow';\n status.text = 'New Auth';\n\n}\n\nmsg.payload = msg.session;\n\nnode.status(status);\n\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1840, "y": 2680, "wires": [ [ "c3a8957e4400e12f" ] ] }, { "id": "c3a8957e4400e12f", "type": "file", "z": "8179bf22c4c31682", "g": "69f0d6271fe16536", "name": "Save session", "filename": "filename", "filenameType": "msg", "appendNewline": true, "createDir": false, "overwriteFile": "true", "encoding": "none", "x": 1990, "y": 2680, "wires": [ [ "1380f91c814b8e2f" ] ] }, { "id": "1380f91c814b8e2f", "type": "function", "z": "8179bf22c4c31682", "g": "69f0d6271fe16536", "name": "Confirm session saved", "func": "var success = null;\nvar callback = null;\nvar failure = msg;\n\nvar status = { fill: \"red\", shape: \"ring\", text: \"incomplete\"};\n\nvar url = '/auth';\n\nfs.stat(msg.filename, function (err) {\n\n if (err) {\n status.text = \"false\";\n status.fill = \"yellow\";\n\n } else {\n status.text = \"true\";\n status.fill = \"green\";\n\n if (! msg.token_refresh ) {\n\n msg.cookies.auth.value = msg.hash.value;\n msg.headers = {\n Location: \"http://127.0.0.1:1881/\"\n }\n\n msg.statusCode = 302;\n\n callback = msg;\n failure = null;\n\n }else {\n msg.payload = 'Token refresh';\n \n success = msg;\n failure = null;\n }\n \n\n \n\n \n delete msg.hash;\n delete msg.filename;\n delete msg.retry\n delete msg.payload;\n }\n\n node.status(status);\n\n node.send([\n success,\n callback,\n failure\n ]);\n\n})\n\n\n\n", "outputs": 3, "noerr": 0, "initialize": "", "finalize": "", "libs": [ { "var": "fs", "module": "fs" } ], "x": 2180, "y": 2680, "wires": [ [ "d24ebda198149601" ], [ "4ff84724b26afc75" ], [ "54179a47b3037bcb" ] ], "outputLabels": [ "Success", "Callback", "Failure" ], "icon": "font-awesome/fa-question" }, { "id": "d24ebda198149601", "type": "link out", "z": "8179bf22c4c31682", "g": "69f0d6271fe16536", "name": "Session Saved", "mode": "link", "links": [ "e80aabc47c664088" ], "x": 2400, "y": 2640, "wires": [], "icon": "node-red/arrow-in.svg", "l": true }, { "id": "a49db4bcea29097d", "type": "debug", "z": "8179bf22c4c31682", "g": "9f3711f96411e2cc", "name": "debug 133", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "true", "targetType": "full", "statusVal": "", "statusType": "auto", "x": 1890, "y": 2480, "wires": [] }, { "id": "9d0d1d9a6c596428", "type": "link in", "z": "8179bf22c4c31682", "g": "9f3711f96411e2cc", "name": "Oauth2: Code to Token", "links": [ "60a97c78327c3a6a" ], "x": 1160, "y": 2480, "wires": [ [ "a4a3bb52d2eaa071" ] ], "icon": "font-awesome/fa-lock", "l": true }, { "id": "a4a3bb52d2eaa071", "type": "function", "z": "8179bf22c4c31682", "g": "9f3711f96411e2cc", "name": "create token packet", "func": "\n\nmsg.url = global.get('config.oauth.url.token');\n\nmsg.method = \"POST\";\nmsg.headers = {}\nmsg.headers[\"content-type\"] = \"application/x-www-form-urlencoded\"\n\nmsg.payload = \"grant_type=authorization_code&scope=openid&client_id=\" + global.get('config.oauth.client_id') + \"&client_secret=\" + global.get('config.oauth.client_secret') + \"&redirect_uri=\" + global.get('config.oauth.url.callback') + \"&code=\" + msg.oauth2.code\n\n\n//delete msg.oauth2Request;\n//delete msg.req;\n//delete msg.res;\ndelete msg.retry;\ndelete msg.oauth2;\n\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1350, "y": 2480, "wires": [ [ "07ee83c8d9bdbcb2" ] ], "icon": "node-red-contrib-filesystem/fs-stats.svg" }, { "id": "07ee83c8d9bdbcb2", "type": "http request", "z": "8179bf22c4c31682", "g": "9f3711f96411e2cc", "name": "Fetch Access Token", "method": "use", "ret": "obj", "paytoqs": "ignore", "url": "", "tls": "", "persist": false, "proxy": "", "insecureHTTPParser": false, "authType": "", "senderr": false, "headers": [], "x": 1540, "y": 2480, "wires": [ [ "a49db4bcea29097d", "8b072412d6eea267" ] ], "icon": "font-awesome/fa-arrow-down" }, { "id": "8b072412d6eea267", "type": "link out", "z": "8179bf22c4c31682", "g": "9f3711f96411e2cc", "name": "Process Token", "mode": "link", "links": [ "97fb6e1471c0f7cd" ], "x": 1720, "y": 2480, "wires": [], "icon": "font-awesome/fa-unlock", "l": true }, { "id": "444cde06405f24e3", "type": "comment", "z": "8179bf22c4c31682", "g": "9f3711f96411e2cc", "name": "ToDo", "info": "check for http 400, and return error on screen", "x": 1730, "y": 2440, "wires": [] }, { "id": "8e670403cf071aaf", "type": "function", "z": "8179bf22c4c31682", "g": "10a6c6b12749dda9", "name": "Build: Command", "func": "msg.command = 'bash -c \"tr -dc \\'A-Za-z0-9\\' 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, '"');\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, '"');\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, '"'); // 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, '"')\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.file = String(msg.files[i]);\n new_msg.filename = String(msg.path + msg.files[i]);\n new_msg._linkSource = msg._linkSource;\n\n node.send([new_msg, null]);\n\n}\n\nif (filesfound == 0 ) {\n\n new_msg.cron.task = 'No Tokens Found';\n new_msg._linkSource = msg._linkSource;\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\n//delete 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": "path", "pathType": "msg", "filename": "file", "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" ] ] } ]