Sharing files in private folders programmatically (React/JavaScript)

Hello to all members of SOLID Community ! :slight_smile:

I have a question on SOLID file sharing, any references are welcome!

Basically, assume a simple use-case described as follows:
Given a private folder that contains a list of plain .txt files inside a pod. There is a React web app, that displays a popup where It asks to provide a webID of a friend (or any person). When I type the webID and hit send button, I want the user of that webID who also has an instance of same React web app running to get a notification that someone shared a file with him, and upon hitting on notification he would be able to read the content of that txt file from first user’s solid pod.

I have been reviewing various react / node libraries for SOLID, unfortunately I can’t find a simple plain explanation of the ways of sharing and setting access privileges to files programmatically. I am aware that if the file will be inside a private folder, that requires some manipulation with .acl file where I could somehow specify who exactly can read that data?

Could someone provide an explanation for that, or a link to a resource that could explain that process ?

1 Like

AFAIK I don’t know of any comprehensive guide to sharing resources in Solid =/

There is a tutorial on how to use the sharing pane in the data browser to grant others access to resources that might be of interest, and there is of course the code behind the pane itself if you want to see how it handles it.

The Solid React SDK has Access Control on its roadmap, but that part of it is not available yet.

I really think I need to write a tutorial on how to do resource sharing programmatically… When I have time :stuck_out_tongue: Until then I can recommend reading up on the specification (Web Access Control), that covers how Solid servers should implement access control.

If you want to see some examples I recommend setting up a server and look at the templates that are provided for new user PODs:

None of these resources show how a resource is shared with another specific WebID. But to give you an idea, here is my generated file for test.txt.acl that I created locally:

@prefix : <#>.
@prefix n0: <http://www.w3.org/ns/auth/acl#>.
@prefix c: </profile/card#>.
@prefix c0: <https://megoth-test3.dev.inrupt.net/profile/card#>.

:ControlReadWrite
    a n0:Authorization;
    n0:accessTo <test.txt>;
    n0:agent c:me;
    n0:mode n0:Control, n0:Read, n0:Write.
:Read a n0:Authorization; n0:accessTo <test.txt>; n0:agent c0:me; n0:mode n0:Read.

Hope this is of help :slight_smile: I’ll let you know if I’m ever able to write tutorial :wink:

4 Likes

Setting rights, read access to a specific list of friends could be done like this

(Nb, to fix : we must not suppose that the Acl of a file is file.txt.acl, but get it by the “Link” :blush: )

Yes, my problem is that it requires control access of the container. I could change the ACL of the container, but it would require control access of the container of the container, and so on.