@inrupt/solid-client / access/universal

# Module: access/universal¶

## Functions¶

### getAccessFor¶

getAccessFor(resourceUrl, actorType, actor, options?): Promise<Access | null>

Get an overview of what access is defined for a given actor (Agent or Group).

This function works with Solid Pods that implement either the Web Access Control spec or the Access Control Policies proposal, with some caveats:

• If access to the given Resource has been set using anything other than the functions in this module, it is possible that it has been set in a way that prevents this function from reliably reading access, in which case it will resolve to null.

• It will only return access specified explicitly for the given Agent or Group. If additional restrictions are set up to apply to the given Agent or Group in a particular situation, those will not be reflected in the return value of this function.

• It will only return access specified explicitly for the given Resource. In other words, if the Resource is a Container, the returned Access may not apply to contained Resources.

• If the current user does not have permission to view access for the given Resource, this function will resolve to null.

since 1.5.0

#### Parameters¶

Name

Type

Description

resourceUrl

UrlString

URL of the Resource you want to read the access for.

actorType

"agent" | "group"

type of actor whose access is being read: Agent or Group.

actor

Identifier of the individual Agent or Group whose access being read.

options?

typeof internal\_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

#### Returns¶

Promise<Access | null>

What access the given Agent or Group has.

#### Defined in¶

src/access/for.ts:68

getAccessFor(resourceUrl, actorType, options?): Promise<Access | null>

Get an overview of what access is defined for everyone.

This function works with Solid Pods that implement either the Web Access Control spec or the Access Control Policies proposal, with some caveats:

• If access to the given Resource has been set using anything other than the functions in this module, it is possible that it has been set in a way that prevents this function from reliably reading access, in which case it will resolve to null.

• It will only return access specified explicitly for specifically everyone. If additional restrictions are set up to apply to some actors in a particular situation (e.g. individual Agents or Groups), those will not be reflected in the return value of this function.

• It will only return access specified explicitly for the given Resource. In other words, if the Resource is a Container, the returned Access may not apply to contained Resources.

• If the current user does not have permission to view access for the given Resource, this function will resolve to null.

since 1.5.0

#### Parameters¶

Name

Type

Description

resourceUrl

UrlString

URL of the Resource you want to read the access for.

actorType

"public"

type of actor whose access is being read.

options?

typeof internal\_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

#### Returns¶

Promise<Access | null>

What access have been granted to the general public.

#### Defined in¶

src/access/for.ts:100

getAccessFor(resourceUrl, actorType, actor?, options?): Promise<Access | null>

#### Parameters¶

Name

Type

resourceUrl

UrlString

actorType

Actor

actor?

WebId | UrlString | typeof internal\_defaultFetchOptions

options?

typeof internal\_defaultFetchOptions

#### Returns¶

Promise<Access | null>

#### Defined in¶

src/access/for.ts:105

### getAccessForAll¶

getAccessForAll(resourceUrl, actorType, options?): Promise<Record<UrlString, Access> | null>

Get an overview of what access is defined for a given set of actors: all Agents or all Groups.

This function works with Solid Pods that implement either the Web Access Control spec or the Access Control Policies proposal, with some caveats:

• If access to the given Resource has been set using anything other than the functions in this module, it is possible that it has been set in a way that prevents this function from reliably reading access, in which case it will resolve to null.

• It will only return access specified explicitly for the given actor (Agent or Group). If additional restrictions are set up to apply to the given Agent in a particular situation, those will not be reflected in the return value of this function.

• It will only return access specified explicitly for the given Resource. In other words, if the Resource is a Container, the returned Access may not apply to contained Resources.

• If the current user does not have permission to view access for the given Resource, this function will resolve to null.

since 1.5.0

#### Parameters¶

Name

Type

Description

resourceUrl

UrlString

URL of the Resource you want to read the access for.

actorType

Exclude<Actor, "public">

type of actor whose access is being read.

options

Object

-

options.fetch

(input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response>

-

#### Returns¶

Promise<Record<UrlString, Access> | null>

What access is set for the given resource, grouped by resp. Agent or Group.

#### Defined in¶

src/access/for.ts:173

### getAgentAccess¶

getAgentAccess(resourceUrl, webId, options?): Promise<Access | null>

Get an overview of what access is defined for a given Agent.

This function works with Solid Pods that implement either the Web Access Control spec or the Access Control Policies proposal, with some caveats:

• If access to the given Resource has been set using anything other than the functions in this module, it is possible that it has been set in a way that prevents this function from reliably reading access, in which case it will resolve to null.

• It will only return access specified explicitly for the given Agent. If additional restrictions are set up to apply to the given Agent in a particular situation, those will not be reflected in the return value of this function.

• It will only return access specified explicitly for the given Resource. In other words, if the Resource is a Container, the returned Access may not apply to contained Resources.

• If the current user does not have permission to view access for the given Resource, this function will resolve to null.

since 1.5.0

#### Parameters¶

Name

Type

Description

resourceUrl

UrlString

URL of the Resource you want to read the access for.

webId

WebId

WebID of the Agent you want to get the access for.

options

Object

-

options.fetch

(input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response>

-

#### Returns¶

Promise<Access | null>

#### Defined in¶

src/access/universal.ts:93

### getAgentAccessAll¶

getAgentAccessAll(resourceUrl, options?): Promise<Record<WebId, Access> | null>

Get an overview of what access is defined for all Agents with respect to a given Resource.

This function works with Solid Pods that implement either the Web Access Control spec or the Access Control Policies proposal, with some caveats:

• If access to the given Resource has been set using anything other than the functions in this module, it is possible that it has been set in a way that prevents this function from reliably reading access, in which case it will resolve to null.

• It will only return access specified explicitly for the returned Agents. If additional restrictions are set up to apply to the listed Agents in a particular situation, those will not be reflected in the return value of this function.

• It will only return access specified explicitly for the given Resource. In other words, if the Resource is a Container, the returned Access may not apply to contained Resources.

• If the current user does not have permission to view access for the given Resource, this function will resolve to null.

since 1.5.0

#### Parameters¶

Name

Type

Description

resourceUrl

UrlString

URL of the Resource you want to read the access for.

options

Object

-

options.fetch

(input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response>

-

#### Returns¶

Promise<Record<WebId, Access> | null>

The access information to the Resource, grouped by Agent.

#### Defined in¶

src/access/universal.ts:201

### getGroupAccess¶

getGroupAccess(resourceUrl, webId, options?): Promise<Access | null>

Get an overview of what access is defined for a given Group.

This function works with Solid Pods that implement either the Web Access Control spec or the Access Control Policies proposal, with some caveats:

• If access to the given Resource has been set using anything other than the functions in this module, it is possible that it has been set in a way that prevents this function from reliably reading access, in which case it will resolve to null.

• It will only return access specified explicitly for the given Group. If additional restrictions are set up to apply to the given Group in a particular situation, those will not be reflected in the return value of this function.

• It will only return access specified explicitly for the given Resource. In other words, if the Resource is a Container, the returned Access may not apply to contained Resources.

• If the current user does not have permission to view access for the given Resource, this function will resolve to null.

since 1.5.0

#### Parameters¶

Name

Type

Description

resourceUrl

UrlString

URL of the Resource you want to read the access for.

webId

WebId

WebID of the Group you want to get the access for.

options

Object

-

options.fetch

(input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response>

-

#### Returns¶

Promise<Access | null>

#### Defined in¶

src/access/universal.ts:239

### getGroupAccessAll¶

getGroupAccessAll(resourceUrl, options?): Promise<Record<UrlString, Access> | null>

Get an overview of what access is defined for all Groups with respect to a given Resource.

This function works with Solid Pods that implement either the Web Access Control spec or the Access Control Policies proposal, with some caveats:

• If access to the given Resource has been set using anything other than the functions in this module, it is possible that it has been set in a way that prevents this function from reliably reading access, in which case it will resolve to null.

• It will only return access specified explicitly for the returned Groups. If additional restrictions are set up to apply to the listed Groups in a particular situation, those will not be reflected in the return value of this function.

• It will only return access specified explicitly for the given Resource. In other words, if the Resource is a Container, the returned Access may not apply to contained Resources.

• If the current user does not have permission to view access for the given Resource, this function will resolve to null.

since 1.5.0

#### Parameters¶

Name

Type

Description

resourceUrl

UrlString

URL of the Resource you want to read the access for.

options

Object

-

options.fetch

(input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response>

-

#### Returns¶

Promise<Record<UrlString, Access> | null>

The access information to the Resource, sorted by Group.

#### Defined in¶

src/access/universal.ts:279

### getPublicAccess¶

getPublicAccess(resourceUrl, options?): Promise<Access | null>

Get an overview of what access is defined for everyone.

This function works with Solid Pods that implement either the Web Access Control spec or the Access Control Policies proposal, with some caveats:

• If access to the given Resource has been set using anything other than the functions in this module, it is possible that it has been set in a way that prevents this function from reliably reading access, in which case it will resolve to null.

• It will only return access specified explicitly for everyone. If additional restrictions are set up to apply to users in a particular situation, those will not be reflected in the return value of this function.

• It will only return access specified explicitly for the given Resource. In other words, if the Resource is a Container, the returned Access may not apply to contained Resources.

• If the current user does not have permission to view access for the given Resource, this function will resolve to null.

since 1.5.0

#### Parameters¶

Name

Type

Description

resourceUrl

UrlString

URL of the Resource you want to read the access for.

options

Object

-

options.fetch

(input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response>

-

#### Returns¶

Promise<Access | null>

#### Defined in¶

src/access/universal.ts:384

### setAccessFor¶

setAccessFor(resourceUrl, actorType, access, actor, options?): Promise<Access | null>

Set access to a Resource for a specific Actor (Agent or Group).

This function works with Solid Pods that implement either the Web Access Control spec or the Access Control Policies proposal, with some caveats:

• If access to the given Resource has been set using anything other than the functions in this module, it is possible that it has been set in a way that prevents this function from reliably setting access, in which case it will resolve to null.

• It will only set access explicitly for the given Actor (Agent or Group). In other words, additional restrictions could be present that further restrict or loosen what access the given Actor has in particular circumstances.

• The provided access will only apply to the given Resource. In other words, if the Resource is a Container, the configured Access may not apply to contained Resources.

• If the current user does not have permission to view or change access for the given Resource, this function will resolve to null.

Additionally, two caveats apply to users with a Pod server that uses WAC:

• 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.

• Setting different values for controlRead and controlWrite is not supported, and will throw an error. If you expect (some of) your users to have Pods implementing WAC, be sure to pass the same value for both.

since 1.5.0

#### Parameters¶

Name

Type

Description

resourceUrl

UrlString

URL of the Resource you want to change the Agent’s access to.

actorType

"agent" | "group"

type of actor whose access is being read.

access

Partial<Access>

What access permissions you want to set for the given Agent to the given Resource. Possible properties are read, append, write, controlRead and controlWrite: set to true to allow, to false to stop allowing, or undefined to leave unchanged. Take note that controlRead and controlWrite can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error.

actor

Actor (Agent or Group) you want to set access for.

options?

typeof internal\_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

#### Returns¶

Promise<Access | null>

What access has been set for the given Agent explicitly.

#### Defined in¶

src/access/for.ts:224

setAccessFor(resourceUrl, actorType, access, options?): Promise<Access | null>

This function works with Solid Pods that implement either the Web Access Control spec or the Access Control Policies proposal, with some caveats:

• If access to the given Resource has been set using anything other than the functions in this module, it is possible that it has been set in a way that prevents this function from reliably setting access, in which case it will resolve to null.

• It will only set access explicitly for the general public. In other words, additional restrictions could be present that further restrict or loosen what access everyone has in particular circumstances.

• The provided access will only apply to the given Resource. In other words, if the Resource is a Container, the configured Access may not apply to contained Resources.

• If the current user does not have permission to view or change access for the given Resource, this function will resolve to null.

Additionally, two caveats apply to users with a Pod server that uses WAC:

• 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.

• Setting different values for controlRead and controlWrite is not supported, and will throw an error. If you expect (some of) your users to have Pods implementing WAC, be sure to pass the same value for both.

since 1.5.0

#### Parameters¶

Name

Type

Description

resourceUrl

UrlString

URL of the Resource you want to change the Agent’s access to.

actorType

"public"

type of actor whose access is being read.

access

Partial<Access>

What access permissions you want to set for the given Agent to the given Resource. Possible properties are read, append, write, controlRead and controlWrite: set to true to allow, to false to stop allowing, or undefined to leave unchanged. Take note that controlRead and controlWrite can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error.

options?

typeof internal\_defaultFetchOptions

Optional parameter options.fetch: An alternative fetch function to make the HTTP request, compatible with the browser-native fetch API.

#### Returns¶

Promise<Access | null>

What access has been set for the given Agent explicitly.

#### Defined in¶

src/access/for.ts:267

setAccessFor(resourceUrl, actorType, access, actor?, options?): Promise<Access | null>

#### Parameters¶

Name

Type

resourceUrl

UrlString

actorType

Actor

access

Partial<Access>

actor?

WebId | UrlString | typeof internal\_defaultFetchOptions

options?

typeof internal\_defaultFetchOptions

#### Returns¶

Promise<Access | null>

#### Defined in¶

src/access/for.ts:273

### setAgentAccess¶

setAgentAccess(resourceUrl, webId, access, options?): Promise<Access | null>

This function works with Solid Pods that implement either the Web Access Control spec or the Access Control Policies proposal, with some caveats:

• If access to the given Resource has been set using anything other than the functions in this module, it is possible that it has been set in a way that prevents this function from reliably setting access, in which case it will resolve to null.

• It will only set access explicitly for the given Agent. In other words, additional restrictions could be present that further restrict or loosen what access the given Agent has in particular circumstances.

• The provided access will only apply to the given Resource. In other words, if the Resource is a Container, the configured Access may not apply to contained Resources.

• If the current user does not have permission to view or change access for the given Resource, this function will resolve to null.

Additionally, two caveats apply to users with a Pod server that uses WAC:

• 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.

• Setting different values for controlRead and controlWrite is not supported, and will throw an error. If you expect (some of) your users to have Pods implementing WAC, be sure to pass the same value for both.

since 1.5.0

#### Parameters¶

Name

Type

Description

resourceUrl

UrlString

URL of the Resource you want to change the Agent’s access to.

webId

WebId

WebID of the Agent you want to set access for.

access

Partial<Access>

What access permissions you want to set for the given Agent to the given Resource. Possible properties are read, append, write, controlRead and controlWrite: set to true to allow, to false to stop allowing, or undefined to leave unchanged. Take note that controlRead and controlWrite can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error.

options

Object

-

options.fetch

(input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response>

-

#### Returns¶

Promise<Access | null>

What access has been set for the given Agent explicitly.

#### Defined in¶

src/access/universal.ts:142

### setGroupAccess¶

setGroupAccess(resourceUrl, groupUrl, access, options?): Promise<Access | null>

This function works with Solid Pods that implement either the Web Access Control spec or the Access Control Policies proposal, with some caveats:

• If access to the given Resource has been set using anything other than the functions in this module, it is possible that it has been set in a way that prevents this function from reliably setting access, in which case it will resolve to null.

• It will only set access explicitly for the given Group. In other words, additional restrictions could be present that further restrict or loosen what access the given Group has in particular circumstances.

• The provided access will only apply to the given Resource. In other words, if the Resource is a Container, the configured Access may not apply to contained Resources.

• If the current user does not have permission to view or change access for the given Resource, this function will resolve to null.

Additionally, two caveats apply to users with a Pod server that uses WAC:

• 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.

• Setting different values for controlRead and controlWrite is not supported, and will throw an error. If you expect (some of) your users to have Pods implementing WAC, be sure to pass the same value for both.

since 1.5.0

#### Parameters¶

Name

Type

Description

resourceUrl

UrlString

URL of the Resource you want to change the Group’s access to.

groupUrl

UrlString

URL of the Group you want to set access for.

access

Partial<Access>

What access permissions you want to set for the given Group to the given Resource. Possible properties are read, append, write, controlRead and controlWrite: set to true to allow, to false to stop allowing, or undefined to leave unchanged. Take note that controlRead and controlWrite can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error.

options

Object

-

options.fetch

(input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response>

-

#### Returns¶

Promise<Access | null>

What access has been set for the given Group explicitly.

#### Defined in¶

src/access/universal.ts:327

### setPublicAccess¶

setPublicAccess(resourceUrl, access, options?): Promise<Access | null>

This function works with Solid Pods that implement either the Web Access Control spec or the Access Control Policies proposal, with some caveats:

• If access to the given Resource has been set using anything other than the functions in this module, it is possible that it has been set in a way that prevents this function from reliably setting access, in which case it will resolve to null.

• It will only set access explicitly for everybody. In other words, additional restrictions could be present that further restrict or loosen what access a user has in particular circumstances.

• The provided access will only apply to the given Resource. In other words, if the Resource is a Container, the configured Access may not apply to contained Resources.

• If the current user does not have permission to view or change access for the given Resource, this function will resolve to null.

Additionally, two caveats apply to users with a Pod server that uses WAC:

• 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.

• Setting different values for controlRead and controlWrite is not supported, and will throw an error. If you expect (some of) your users to have Pods implementing WAC, be sure to pass the same value for both.

since 1.5.0

#### Parameters¶

Name

Type

Description

resourceUrl

UrlString

access

Partial<Access>

What access permissions you want to set for everybody to the given Resource. Possible properties are read, append, write, controlRead and controlWrite: set to true to allow, to false to stop allowing, or undefined to leave unchanged. Take note that controlRead and controlWrite can not have distinct values for a Pod server implementing Web Access Control; trying this will throw an error.

options

Object

-

options.fetch

(input: RequestInfo, init?: RequestInit) => Promise<Response> & (input: RequestInfo, init?: RequestInit) => Promise<Response>

-

#### Returns¶

Promise<Access | null>

What access has been set for everybody explicitly.

#### Defined in¶

src/access/universal.ts:431