I’m trying to use the Inrupt node client to manage permissions on a resource.
import {universalAccess} from @inrupt/solid-client
let resourceURL = 'https://nkws.login.stucco.software/octothorp.es.ttl'
let uacc = await universalAccess.setPublicAccess(resourceURL, {
read: true,
append: false,
write: false,
controlRead: true,
controlWrite: false
},{fetch: session.fetch})
This returns an access object:
{
read: true,
append: false,
write: false,
controlRead: true,
controlWrite: false
}
So seems like it’s working! But as you can tell, actually trying to hit the resource at all returns a 401: https://nkws.login.stucco.software/octothorp.es.ttl
{
"name": "UnauthorizedHttpError",
"message": "",
"statusCode": 401,
"errorCode": "H401",
"details": {}
}
What is the simple, obvious thing I am missing?
Poked at this further, as far as I can tell the problem is that the universalAccess
api doesn’t set the http://www.w3.org/ns/solid/acp#resource predicate, meaning that whatever permissions are being set in the ACR aren’t being applied to the actual resource I’m trying to fetch.
I’m guessing that this is because I’m running Community Solid Server, which expects this, and this was develped against ESS, which implies it differently?
It could be some unset predicate, but the common error codes documentation does indicate that a 401 Unauthorized means:
Indicates that the Resource to access is only accessible to certain agents, but the current user is not logged in.
Are you able to fetch the Resource by passing in a valid session.fetch
? I’m wondering if maybe it’s setting “public” access in the sense that any user is allowed to read it, but not no user? I seem to remember something like that maybe possible being the case in ACP?
1 Like
It seems like it’s possible for that to be the case, but I can create and fetch the document itself, as well as create and fetch the associated .acr file fine. Just adding the missing predicate solves the problem.
My server is also not creating the .acr resource when I create a document, so maybe that’s why the predicate is missing. Much to think about.
Well, since I don’t see anything obvious that you’re doing wrong, if you’re able to create a minimal example that demonstrates the issue, I’d recommend filing a bug - hopefully the folks at Inrupt can take a look.
I believe this is indeed a bug in the library. Some while ago I also encountered a similar issue, also the .acr
file not containing enough triples, leading to it not working. Manually adding those resolved it by then.
Highly recommend OP to file a bug report!