diff --git a/src/acl-control.js b/src/acl-control.js index aeff186c3..d130de072 100644 --- a/src/acl-control.js +++ b/src/acl-control.js @@ -612,14 +612,21 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) { var q = str.indexOf('//') var targetDocDir = ((q >= 0 && p < q + 2) || p < 0) ? null : str.slice(0, p + 1) - if (targetDocDir) { + // @@ TODO: The methods used for targetIsStorage are HACKs - it should not be relied upon, and work is + // @@ underway to standardize a behavior that does not rely upon this hack + // @@ hopefully fixed as part of https://github.com/solid/data-interoperability-panel/issues/10 + const targetIsStorage = kb.holds(targetDoc, UI.ns.rdf('type'), UI.ns.space('Storage'), targetACLDoc) + const targetAclIsProtected = hasProtectedAcl(targetDoc) + const targetIsProtected = targetIsStorage || targetAclIsProtected + + if (!targetIsProtected && targetDocDir) { UI.acl.getACLorDefault($rdf.sym(targetDocDir), function (ok2, p22, targetDoc2, targetACLDoc2, defaultHolder2, defaultACLDoc2) { if (ok2) { prospectiveDefaultHolder = p22 ? targetDoc2 : defaultHolder2 } addDefaultButton(prospectiveDefaultHolder) }) - } else { + } else if (!targetIsProtected) { addDefaultButton() } @@ -685,4 +692,10 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) { renderBox() return table } // ACLControlBox + +function hasProtectedAcl (targetDoc) { + // @@ TODO: This is hacky way of knowing whether or not a certain ACL file can be removed + // Hopefully we'll find a better, standardized solution to this - https://github.com/solid/specification/issues/37 + return targetDoc.uri === targetDoc.site().uri +} // ends