# Sharing files in private folders programmatically (React/JavaScript)

**URL:** <https://forum.solidproject.org/t/sharing-files-in-private-folders-programmatically-react-javascript/1347>\
**Category:** Solid App Development FAQs\
**Created:** [February 25, 2019, 1:46am UTC](https://forum.solidproject.org/t/sharing-files-in-private-folders-programmatically-react-javascript/1347 "2019-02-25T01:46:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aorumbayev](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/aorumbayev/32/721_2.png) [@aorumbayev](https://forum.solidproject.org/u/aorumbayev)\
**Post date:** [February 25, 2019, 1:46am UTC](https://forum.solidproject.org/t/sharing-files-in-private-folders-programmatically-react-javascript/1347/1 "2019-02-25T01:46:06Z")

</div>

Hello to all members of SOLID Community ! 🙂

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 ?

---

<div class="post-metadata">

**Author:** ![megoth](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/megoth/32/8_2.png) [@megoth](https://forum.solidproject.org/u/megoth)\
**Post date:** [March 1, 2019, 12:27am UTC](https://forum.solidproject.org/t/sharing-files-in-private-folders-programmatically-react-javascript/1347/2 "2019-03-01T00:27:51Z")

</div>

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](http://forum.solidproject.org/t/how-to-change-the-sharing-settings-for-a-resource/114) 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](https://github.com/solid/solid-panes/blob/master/sharing/sharingPane.js).

[The Solid React SDK has Access Control on its roadmap](https://github.com/Inrupt-inc/solid-react-sdk#access-control), 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 😛 Until then I can recommend reading up on [the specification (Web Access Control)](https://github.com/solid/web-access-control-spec), 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](https://github.com/solid/node-solid-server/tree/release/v5.0.0/default-templates/new-account):

- [The root ACL](https://github.com/solid/node-solid-server/blob/release/v5.0.0/default-templates/new-account/.acl)
- [The container ACL for the public folder](https://github.com/solid/node-solid-server/blob/release/v5.0.0/default-templates/new-account/public/.acl)
- [The container ACL for the private folder](https://github.com/solid/node-solid-server/blob/release/v5.0.0/default-templates/new-account/private/.acl)
- [The resource ACL for favicon.ico](https://github.com/solid/node-solid-server/blob/release/v5.0.0/default-templates/new-account/favicon.ico.acl)

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:

```auto
@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 🙂 I’ll let you know if I’m ever able to write tutorial 😉

---

<div class="post-metadata">

**Author:** ![Smag0](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/smag0/32/310_2.png) [@Smag0](https://forum.solidproject.org/u/Smag0)\
**Post date:** [May 1, 2020, 12:09pm UTC](https://forum.solidproject.org/t/sharing-files-in-private-folders-programmatically-react-javascript/1347/4 "2020-05-01T12:09:14Z")

</div>

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” 😊 )

> <https://github.com/scenaristeur/agora/blob/42399e0f941660362a3bcf8322b39fd987a89f72/src/views/post-tabs-element.js#L668>

---

<div class="post-metadata">

**Author:** ![divoplade](https://avatars.discourse-cdn.com/v4/letter/d/dbc845/32.png) [@divoplade](https://forum.solidproject.org/u/divoplade)\
**Post date:** [May 1, 2020, 12:24pm UTC](https://forum.solidproject.org/t/sharing-files-in-private-folders-programmatically-react-javascript/1347/5 "2020-05-01T12:24:46Z")

</div>

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.
