From b52cc8b234cb8fa92ce35ac9c546ae9ee1004e42 Mon Sep 17 00:00:00 2001 From: Rohan Vazarkar Date: Thu, 25 May 2017 10:40:53 -0400 Subject: [PATCH] Hopefully fix ACL ingestion again --- src/js/utils.js | 65 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/src/js/utils.js b/src/js/utils.js index 175ccf7..c434a58 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -181,36 +181,57 @@ export function buildACLProps(rows) { var rel = row.ActiveDirectoryRights var extright = row.ACEType + var rights = [] + if (extright === 'All'){ - rel = "AllExtendedRights" - }else if (extright === 'User-Force-Change-Password'){ - rel = "ForceChangePassword" - }else if (rel === "ExtendedRight"){ - rel = extright + rights.append("AllExtendedRights") + } + if (extright === 'User-Force-Change-Password'){ + rights.append("ForceChangePassword") + } + if (rel === "ExtendedRight"){ + rights.append(extright) } - rel = rel.replace(/-/g,"") - - if (rel.includes('WriteOwner')){ - rel = 'WriteOwner' + if (rel.includes("GenericAll")){ + rights.append("GenericAll") } - var hash = (atype + rel + btype).toUpperCase() - if (btype === 'Computer') { - return + if (rel.includes("WriteDacl")){ + rights.append("WriteDacl") } - if (datadict[hash]) { - datadict[hash].props.push({ - account: a, - principal: b - }) - } else { - datadict[hash] = { - statement: 'UNWIND {props} AS prop MERGE (a:{} {name:prop.account}) WITH a,prop MERGE (b:{} {name: prop.principal}) WITH a,b,prop MERGE (a)-[r:{} {isACL:true}]->(b)'.format(atype, btype, rel), - props: [{ account: a, principal: b }] + if (rel.includes("WriteOwner")){ + rights.append("WriteOwner") + } + + if (rel.includes("GenericWrite")){ + rights.append("GenericWrite") + } + + if (rel.includes("WriteProperty") && extright === "Member"){ + rights.append("AddMember") + } + + $.each(rights, function(index, record){ + var hash = (atype + record + btype).toUpperCase() + if (btype === 'Computer') { + return } - } + + if (datadict[hash]) { + datadict[hash].props.push({ + account: a, + principal: b + }) + } else { + datadict[hash] = { + statement: 'UNWIND {props} AS prop MERGE (a:{} {name:prop.account}) WITH a,prop MERGE (b:{} {name: prop.principal}) WITH a,b,prop MERGE (a)-[r:{} {isACL:true}]->(b)'.format(atype, btype, record), + props: [{ account: a, principal: b }] + } + } + }) + }) return datadict