How to discover ACL document of a resource using common libs

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?

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.

1 Like

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

1 Like

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

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 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: