-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support appending to file without read/write access #1521
Comments
solid-client already sends PATCH requests when you build on top of a previously fetched SolidDataset. So if you first fetch the SolidDataset that contains the group, then add people to the group's Thing, then save that SolidDataset again, that should do what you want. |
Hi Vinnl, thanks for the fast response. From my testing, I've tested it with the script below which resulted in this output:
The files are initially empty and have public access to WRITE (editors), READ (posters) and APPEND (posters, subbmitters). This is the testing script: const { saveSolidDatasetAt, createSolidDataset, createThing, buildThing, setThing } = require("@inrupt/solid-client")
const { RDF, SCHEMA_INRUPT } = require('@inrupt/vocab-common-rdf')
const main = async () => {
let courseSolidDataset = createSolidDataset();
const newBookThing1 = buildThing(createThing({ name: "book2" }))
.addStringNoLocale(SCHEMA_INRUPT.name, "ABC123 of Example Literature")
.addUrl(RDF.type, "https://schema.org/Book")
.build();
courseSolidDataset = setThing(courseSolidDataset, newBookThing1);
await testSaving('https://sheep.solidcommunity.net/private/editors.ttl', courseSolidDataset)
await testSaving('https://sheep.solidcommunity.net/private/posters.ttl', courseSolidDataset)
await testSaving('https://sheep.solidcommunity.net/private/submitters.ttl', courseSolidDataset)
}
const testSaving = async(url, dataset) => {
try {
const savedSolidDataset = await saveSolidDatasetAt(url, dataset);
console.log(`success: ${url}`)
} catch (err) {
console.log(`error: ${url} - ${err.response?.status ?? err.message}`)
}
}
main() |
@Otto-AA Yes, that's why I said "when you build on top of a previously fetched SolidDataset". You are creating a new SolidDataset every time ( const { saveSolidDatasetAt, createSolidDataset, createThing, buildThing, setThing } = require("@inrupt/solid-client")
const { RDF, SCHEMA_INRUPT } = require('@inrupt/vocab-common-rdf')
const main = async () => {
let editorsSolidDataset = await getSolidDataset("https://sheep.solidcommunity.net/private/editors.ttl");
const newBookThing1 = buildThing(createThing({ name: "book2" }))
.addStringNoLocale(SCHEMA_INRUPT.name, "ABC123 of Example Literature")
.addUrl(RDF.type, "https://schema.org/Book")
.build();
editorsSolidDataset = setThing(editorsSolidDataset, newBookThing1);
await testSaving('https://sheep.solidcommunity.net/private/editors.ttl', editorsSolidDataset);
}
const testSaving = async(url, dataset) => {
try {
const savedSolidDataset = await saveSolidDatasetAt(url, dataset);
console.log(`success: ${url}`)
} catch (err) {
console.log(`error: ${url} - ${err.response?.status ?? err.message}`)
}
}
main() |
Sorry if I was not clear enough, or I'm still not getting your point. As far as I understand your example requires READ access ( This is what I try to achieve: appending without being able to read or modify existing contents. |
Ah yes, if you want to append without read access, that would indeed need an addition to the API, e.g. something like |
Search terms you've used
I've searched for "patch" and "append"
Feature suggestion
The Solid rest-api describes that we can use a PATCH request to append data with SPARQL. I would like to see an implementation of this, which allows appending a Thing to a specific file with only append access.
Expected functionality/enhancement
Something along
await appendToFile(url, thing)
. I'm not very familiar to the solid-client API, so there may be a better solution.Actual functionality/enhancement
Currently it seems possible to update a file only if one has read and write access.
Use Cases
I would use it to let people append themself to secret groups.
Indirectly this allows granting access to a file
shareMe.txt
via a link:myGroup
where everbody can append, but not read (so the content is secret)asdfasdf
) access toshareMe.txt
https://example-sharer.com/#key=asdfasdf
)asdfasdf
and thus has access toshareMe.txt
Additional information
The text was updated successfully, but these errors were encountered: