How to discover ACL document of a resource using common libs


#1

How can I find out the URI of the ACL document of a given resource? On HTTP level this means to look at the Link header rel="acl", but how can it be done using common libraries?

How are you finding & editing ACLs in your Apps? Any tips / best practises for me?


#2

With solid-file-client you can use getItemLinks(url, options)
with options.links value being set to : exclude, include or include_possible
The function returns the .meta and .acl links.


#3

You might want to check out getACL and getACLorDefault in Solid UI.


#4

ah thanks @megoth, so this is how it can be done with rdflib since all metadata from the fetch is put into the store?


#5

Yes, these methods use the global store in Solid UI, referenced as kb in line 581 for getACL, which has a fetcher-property that updates the store when used. That behavior allows us to query for the ACL-resource using http://www.iana.org/assignments/link-relations/acl as a predicate after we’ve fetched the original resource.

getACLorDefault takes this a bit further by searching for the parent ACL-resource by recursively traversing the parent containers.

Hope this is of help :smiley_cat: