Skip to content

access/universal functions throw error instead of creating .acl when no .acl exists #1549

@ianconsolata

Description

@ianconsolata

Search terms you've used

setAccess, setAccessFor

Bug description

The documentation states

If the Resource did not have an ACL yet, a new one will be initialised. This means that changes to the ACL of a parent Container can no longer affect access people have to this Resource, although existing access will be preserved.
However, in practice, when trying to setAccessFor a newly created resource with no .acl file the function throws an error because it receives a 404.

To Reproduce

  1. Call setAccessFor(reousourceUrl, "public", { read: true }, options) on a resource with no .acl

Expected result

The .acl file should be initialized, and set with the requested access.

Actual result

An error message is thrown with the following message:

Error: Fetching the metadata of the Resource at https://ian.staging.mysilio.me/spaces/home/public.ttl.acl failed: [404] [Not Found].

The error bubbles up from from responseToResourceInfo :

export function responseToResourceInfo(
, which seems to throw on all not ok responses (including 404s).

That function is used in the getReourceInfoWithAcr call that happens on the first line of setPublicAccess (called by setAccessFor:

const resourceInfo = await getResourceInfoWithAcr(resourceUrl, options);

getResourceInfoWithAcr calls getResourceInfo which calls responseToResourceInfo which throws. This happens on the first line of all the access setters, so I am not sure if any of them correctly implement the .acl creation described in the documentation.

Environment

System:
    OS: macOS 11.6.5
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 7.10 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
    npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
  Browsers:
    Brave Browser: 96.1.33.106
    Chrome: 99.0.4844.84
    Firefox: 98.0.2
    Safari: 15.3
  npmPackages:
    @babel/core: ^7.12.3 => 7.14.3
    @inrupt/solid-client: ^1.19.0 => 1.19.0
    @inrupt/solid-client-authn-browser: ^1.11.2 => 1.11.2
    @inrupt/vocab-common-rdf: ^1.0.3 => 1.0.3
    @inrupt/vocab-solid-common: ^0.7.5 => 0.7.5
    @size-limit/preset-small-lib: ^4.8.0 => 4.10.3
    @storybook/addon-essentials: ^6.0.28 => 6.2.9
    @storybook/addon-info: ^5.3.21 => 5.3.21
    @storybook/addon-links: ^6.0.28 => 6.1.1
    @storybook/addons: ^6.0.28 => 6.1.1
    @storybook/react: ^6.0.28 => 6.2.9
    @testing-library/react-hooks: ^3.4.2 => 3.4.2
    @types/jest: ^25.2.3 => 25.2.3
    @types/react: ^17.0.30 => 17.0.30
    @types/react-dom: ^17.0.9 => 17.0.9
    @types/url-parse: ^1.4.3 => 1.4.3
    babel-loader: ^8.2.1 => 8.2.2
    dequal: ^2.0.2 => 2.0.2
    molid: ^0.3.0 => 0.3.0
    react: ^17.0.1 => 17.0.2
    react-dom: ^17.0.2 => 17.0.2
    react-is: ^17.0.2 => 17.0.2
    react-test-renderer: ^17.0.2 => 17.0.2
    size-limit: ^4.8.0 => 4.10.3
    swr: ^1.0.1 => 1.0.1
    ts-jest: ^25.5.1 => 25.5.1
    tsdx: ^0.14.1 => 0.14.1
    tslib: ^2.3.1 => 2.3.1
    typedoc: ^0.22.6 => 0.22.6
    typescript: ^4.4.4 => 4.4.4
    url-parse: ^1.4.7 => 1.5.1
    whatwg-fetch: ^3.5.0 => 3.5.0
  npmGlobalPackages:
    corepack: 0.10.0
    npm: 8.3.1
    yalc: 1.0.0-pre.53
    ```

Metadata

Metadata

Labels

TriagedThis means that we've a ticket to look at this in the futurebugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions