How can I create a new ACL file on my pod?


#1

I am trying to create an acl file for my own notifications directory but am running into problems. Here is what I’ve done:

  • Created a directory /public/notifications/ which I want to use for holding notifications.
  • I tried sending various POST requests to /public/notifications/ with solid.auth.fetch but I’m having no luck. I’ve tried playing around with the Content-Type by setting it to text/turtle, `text/plain’, and leaving it empty, but each of these append a file extension which I don’t want. I checked the node implementation and it looks up the mime-type for a file, but since there is no mime-type for ACL files, I’m running into this problem. Maybe there is a mime-type I can use which will force the server to forget trying to add an extension, but preserve the fact that the file is a utf-8 (or even ascii) text file
  • I also tried sending a PUT request to /public/notifications/notifications.acl but this gives me a permissions error. I think this is a bug because the error message claims I have no permissions to access this resource.
No permission to access this resource

You are currently logged in as https://myaccount.solid.community/profile/card#me,
      but do not have permission to access 
https://myaccount.solid.community/public/notifications/notifications.acl.

TL;DR: How can I upload an acl file with solid.auth.fetch?


#2

I have a similar problem (unsolved) - trying to grant access to a web-app depending on the HTTP Origin header.

The ACL files are named “/XXXX/.acl” - not “/XXXX.acl”.

See also How to change the Sharing settings for a resource?


#3

well, that depends on what resource you’re talking about. Ultimately you need to check the Link header in the response to actually know, but for now you can be pretty sure that

  1. If it’s a “directory” then it will be /.acl
  2. If it’s an actual file then it will be /that-file.acl

#4

Ah, thanks for clarifying that!


#5

It turns out that the permissions error is just a bug with the solid auth client. If I want to create a new acl file I can use the following lines of code

const data = "@prefix  acl:  <http://www.w3.org/ns/auth/acl#>. ..."

solid.auth.fetch('https://myaccount.solid.community/public/notifications/', {
  method: "GET",
  headers: {
    "Content-Type": "text/turtle",
    "Content-Length": data.length,
    "Slug": ".acl",
  },
  body: data
}).then(resp => {
  console.log(resp)
})