Hi,
I’m trying to write a function to change a person’s access to a folder. Later I would even like to give someone access to a folder in general with a function. The login works so far that I can also use other functions to upload data to a folder or to query a folder’s contents.
When executing the following function, I get the following error message when saving:
[Error] Failed to load resource: the server responded with a status of 403 (Forbidden) https://myAccount.solidcommunity.net/myTestFolder/.acl.acl
[Error] Unhandled Promise Rejection: Error: Storing the Resource at [https://myAccount.solidcommunity.net/myTestFolder/.acl.acl] failed: [403] [Forbidden].
The SolidDataset that was sent to the Pod is listed below.
SolidDataset: https://myAccount.solidcommunity.net/myTestFolder/.acl
Thing (no URL yet — identifier:
#……
)Property: http://www.w3.org/1999/02/22-rdf-syntax-ns#type
- http://www.w3.org/ns/auth/acl#Authorization (URL)
Property: http://www.w3.org/ns/auth/acl#default- https://paixsn.solidcommunity.net/mynewtest/ (URL)
Property: http://www.w3.org/ns/auth/acl#mode- http://www.w3.org/ns/auth/acl#Append (URL)
Property: http://www.w3.org/ns/auth/acl#agent- https://px.solidweb.org/profile/card#me (URL)
(4 new values added / 0 values removed)Thing: https://myAccount.solidcommunity.net/myTestFolder/.acl#ControlReadWrite
Property: http://www.w3.org/1999/02/22-rdf-syntax-ns#type
- http://www.w3.org/ns/auth/acl#Authorization (URL)
Property: http://www.w3.org/ns/auth/acl#accessTo- https://myAccount.solidcommunity.net/myTestFolder/ (URL)
Property: http://www.w3.org/ns/auth/acl#agent- https://myAccount.solidcommunity.net/profile/card#me (URL)
- mailto:name@mail.com (URL)
Property: http://www.w3.org/ns/auth/acl#default
- https://myAccount.solidcommunity.net/myTestFolder/ (URL)
Property: http://www.w3.org/ns/auth/acl#mode- http://www.w3.org/ns/auth/acl#Control (URL)
- http://www.w3.org/ns/auth/acl#Read (URL)
- http://www.w3.org/ns/auth/acl#Write (URL)
(0 new values added / 0 values removed)
Thing (no URL yet — identifier:
#…….
)Property: http://www.w3.org/1999/02/22-rdf-syntax-ns#type
- http://www.w3.org/ns/auth/acl#Authorization (URL)
Property: http://www.w3.org/ns/auth/acl#mode- http://www.w3.org/ns/auth/acl#Read (URL)
Property: http://www.w3.org/ns/auth/acl#accessTo- https://paixsn.solidcommunity.net/mynewtest/ (URL)
Property: http://www.w3.org/ns/auth/acl#agent- https://px.solidweb.org/profile/card#me (URL)
(4 new values added / 0 values removed)
(anonyme Funktion) (my-demo-app.e31bb0bc.js:123650)
asyncFunctionResume
(anonyme Funktion)
promiseReactionJobWithoutPromise
promiseReactionJob
My Funktion:
async function testAccess() {
if (!session.info.isLoggedIn) {
// You must be authenticated.
document.getElementById(
"fileWriteStatus"
).textContent = `...you can't do this until you first login!`;
return;
}
const myDatasetWithAcl = await getSolidDatasetWithAcl( "https://myAccount.solidcommunity.net/myTestFolder/", {
fetch: session.fetch
});
const accessByAgent = getAgentAccessAll(myDatasetWithAcl, {
fetch: session.fetch
});
let resourceAcl;
if (!hasResourceAcl(myDatasetWithAcl)) {
if (!hasAccessibleAcl(myDatasetWithAcl)) {
throw new Error(
"The current user does not have permission to change access rights to this Resource."
);
}
if (!hasFallbackAcl(myDatasetWithAcl)) {
throw new Error(
"The current user does not have permission to see who currently has access to this Resource."
);
}
resourceAcl = createAclFromFallbackAcl(myDatasetWithAcl);
} else {
resourceAcl = getResourceAcl(myDatasetWithAcl);
}
const updatedAcl = setAgentResourceAccess(
resourceAcl,
"https://friendsAccount.solidweb.org/profile/card#me",
{ read: true, append: false, write: false, control: false }
);
const savedAcl = saveAclFor(resourceAcl, updatedAcl, {
fetch: session.fetch
});
}
Return results:
myDatasetWithAcl:
[Log] DatasetCore (my-demo-app.e31bb0bc.js, line 143728)
internal_acl: {resourceAcl: DatasetCore, fallbackAcl: null}
internal_resourceInfo: {sourceIri: "https://myAccount.solidcommunity.net/myTestFolder/„, isRawData: false, contentType: “text/turtle”, linkedResources: {acl: [“https://myAccount.solidcommunity.net/myTestFolder/.acl”], describedBy: [“https://myAccount.solidcommunity.net/myTestFolder/.meta”], type: [“The W3C Linked Data Platform (LDP) Vocabulary”, “The W3C Linked Data Platform (LDP) Vocabulary”]}, aclUrl: “https://myAccount.solidcommunity.net/myTestFolder/.acl”, …}
quads: Set {Quad {id: “”, subject: NamedNode, predicate: NamedNode, object: NamedNode, graph: DefaultGraph}, Quad {id: “”, subject: NamedNode, predicate: NamedNode, object: NamedNode, graph: DefaultGraph}, Quad {id: “”, subject: NamedNode, predicate: NamedNode, object: Literal, graph: DefaultGraph}, Quad {id: “”, subject: NamedNode, predicate: NamedNode, object: Literal, graph: DefaultGraph}, Quad {id: “”, subject: NamedNode, predicate: NamedNode, object: NamedNode, graph: DefaultGraph}, …} (13)
DatasetCore Prototyp
accessByAgent:
[Log] Object (my-demo-app.e31bb0bc.js, line 143736)
https://myAccount.solidcommunity.net/profile/card#me: {read: true, append: true, write: true, control: true}
https://myFriendsAccount.solidweb.org/profile/card#me: {read: false, append: true, write: false, control: false}
mailto:name@mail.com: {read: true, append: true, write: true, control: true}
Object Prototyp
resourceAcl → else branch:
[Log] DatasetCore (my-demo-app.e31bb0bc.js, line 143761)
internal_accessTo: "https://myAccount.solidcommunity.net/myTestFolder/„
internal_resourceInfo: {sourceIri: “https://myAccount.solidcommunity.net/myTestFolder/.acl”, isRawData: false, contentType: “text/turtle”, linkedResources: {acl: [“https://myAccount.solidcommunity.net/myTestFolder/.acl.acl”], describedBy: [“https://myAccount.solidcommunity.net/myTestFolder/.acl.meta”], type: [“The W3C Linked Data Platform (LDP) Vocabulary”]}, aclUrl: “https://myAccount.solidcommunity.net/myTestFolder/.acl.acl”, …}
quads: Set {Quad {id: “”, subject: NamedNode, predicate: NamedNode, object: NamedNode, graph: DefaultGraph}, Quad {id: “”, subject: NamedNode, predicate: NamedNode, object: NamedNode, graph: DefaultGraph}, Quad {id: “”, subject: NamedNode, predicate: NamedNode, object: NamedNode, graph: DefaultGraph}, Quad {id: “”, subject: NamedNode, predicate: NamedNode, object: NamedNode, graph: DefaultGraph}, Quad {id: “”, subject: NamedNode, predicate: NamedNode, object: NamedNode, graph: DefaultGraph}, …} (17)
DatasetCore Prototyp
updatedAcl:
[Log] DatasetCore (my-demo-app.e31bb0bc.js, line 143778)
internal_accessTo: "https://myAccount.solidcommunity.net/myTestFolder/„
internal_changeLog: {additions: Array, deletions: Array}
internal_resourceInfo: {sourceIri: “https://myAccount.solidcommunity.net/myTestFolder/.acl”, isRawData: false, contentType: “text/turtle”, linkedResources: {acl: [“https://myAccount.solidcommunity.net/myTestFolder/.acl.acl”], describedBy: [“https://myAccount.solidcommunity.net/myTestFolder/.acl.meta”], type: [“The W3C Linked Data Platform (LDP) Vocabulary”]}, aclUrl: “https://myAccount.solidcommunity.net/myTestFolder/.acl.acl”, …}
quads: Set {Quad {subject: BlankNode, predicate: NamedNode, object: NamedNode, graph: DefaultGraph, equals: function, …}, Quad {subject: BlankNode, predicate: NamedNode, object: NamedNode, graph: DefaultGraph, equals: function, …}, Quad {subject: BlankNode, predicate: NamedNode, object: NamedNode, graph: DefaultGraph, equals: function, …}, Quad {subject: BlankNode, predicate: NamedNode, object: NamedNode, graph: DefaultGraph, equals: function, …}, Quad {id: “”, subject: NamedNode, predicate: NamedNode, object: NamedNode, graph: DefaultGraph}, …} (16)
DatasetCore Prototyp
savedAcl:
[Log] Promise (my-demo-app.e31bb0bc.js, line 143783)
result: Error: Storing the Resource at [https://myAccount.solidcommunity.net/myTestFolder/.acl.acl] failed: [403] [Forbidden]. The SolidDataset that was sent to the Pod is listed below. # SolidDataset: https://myAccount.solidcommunity.net/myTestFolder/.acl ## Thing (no URL yet — identifier:
#………
) Property: http://www.w3.org/1999/02/22-rdf-syntax-ns#type - http://www.w3.org/ns/auth/acl#Authorization (URL) Property: http://www.w3.org/ns/auth/acl#default - https://myAccount.solidcommunity.net/myTestFolder/ (URL) Property: http://www.w3.org/ns/auth/acl#mode - http://www.w3.org/ns/auth/acl#Append (URL) Property: http://www.w3.org/ns/auth/acl#agent - https://myFriendsAccount.solidweb.org/profile/card#me (URL) (4 new values added / 0 values removed) ## Thing: https://myAccount.solidcommunity.net/myTestFolder/.acl#ControlReadWrite Property: http://www.w3.org/1999/02/22-rdf-syntax-ns#type - http://www.w3.org/ns/auth/acl#Authorization (URL) Property: http://www.w3.org/ns/auth/acl#accessTo - https://myAccount.solidcommunity.net/myTestFolder/ (URL) Property: http://www.w3.org/ns/auth/acl#agent - https://myAccount.solidcommunity.net/profile/card#me (URL) - mailto:name@mail.com (URL) Property: http://www.w3.org/ns/auth/acl#default - https://myAccount.solidcommunity.net/myTestFolder/ (URL) Property: http://www.w3.org/ns/auth/acl#mode - http://www.w3.org/ns/auth/acl#Control (URL) - http://www.w3.org/ns/auth/acl#Read (URL) - http://www.w3.org/ns/auth/acl#Write (URL) (0 new values added / 0 values removed) ## Thing (no URL yet — identifier:#……….
) Property: http://www.w3.org/1999/02/22-rdf-syntax-ns#type - http://www.w3.org/ns/auth/acl#Authorization (URL) Property: http://www.w3.org/ns/auth/acl#mode - http://www.w3.org/ns/auth/acl#Read (URL) Property: http://www.w3.org/ns/auth/acl#accessTo - https://myAccount.solidcommunity.net/myTestFolder/ (URL) Property: http://www.w3.org/ns/auth/acl#agent - https://myFriendsAccount.solidweb.org/profile/card#me (URL) (4 new values added / 0 values removed)status: “rejected”
Promise Prototyp