Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/acl-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down Expand Up @@ -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