@inrupt/solid-client / acp/policy

Module: acp/policy

Table of contents

Type aliases

Functions

Type aliases

AccessModes

Ƭ AccessModes: Object

The different Access Modes that a Policy can allow or deny for a Resource.

since 1.6.0

Type declaration

Name

Type

append

boolean

read

boolean

write

boolean

Defined in

src/acp/policy.ts:71


Policy

Ƭ Policy: ThingPersisted

A Policy can be applied to Resources to grant or deny AccessModes to users who match the Policy’s Rules.

since 1.6.0

Defined in

src/acp/policy.ts:61


ResourcePolicy

Ƭ ResourcePolicy: ThingPersisted

A Resource Policy is like a regular Policy, but rather than being re-used for different Resources, it is used for a single Resource and is stored in that Resource’s Access Control Resource.

since 1.6.0

Defined in

src/acp/policy.ts:66

Functions

createPolicy

createPolicy(url): Policy

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Initialise a new, empty Policy.

since 1.6.0

Parameters

Name

Type

Description

url

Url | UrlString

URL that identifies this Policy.

Returns

Policy

Defined in

src/acp/policy.ts:94


createResourcePolicyFor

createResourcePolicyFor(resourceWithAcr, name): ResourcePolicy

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Initialise a new, empty ResourcePolicy for the given Resource.

since 1.6.0

Parameters

Name

Type

Description

resourceWithAcr

WithAccessibleAcr

The Resource to which the Policy is to apply.

name

string

The name that identifies this Policy.

Returns

ResourcePolicy

Defined in

src/acp/policy.ts:433


getAllowModes

Const getAllowModes<P>(policy): AccessModes

See getAllowModesV1. Will be updated to point to getAllowModesV2 when pod.inrupt.com is transitioned to the updated vocabulary.

Type parameters

Name

Type

P

extends ThingPersisted

Parameters

Name

Type

policy

P

Returns

AccessModes

Defined in

src/acp/policy.ts:302


getAllowModesV1

getAllowModesV1<P>(policy): AccessModes

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Given a Policy, return which AccessModes it allows.

since 1.6.0

deprecated The Access Control Policies proposal will be updated to use a different vocabulary for allow- and deny-modes. To be compatible with servers that implement that, use getAllowModesV2.

Type parameters

Name

Type

P

extends ThingPersisted

Parameters

Name

Type

Description

policy

P

The Policy for which you want to know the Access Modes it allows.

Returns

AccessModes

Defined in

src/acp/policy.ts:289


getAllowModesV2

getAllowModesV2<P>(policy): AccessModes

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Given a Policy, return which AccessModes it allows.

since Not released yet.

Type parameters

Name

Type

P

extends ThingPersisted

Parameters

Name

Type

Description

policy

P

The Policy for which you want to know the Access Modes it allows.

Returns

AccessModes

Defined in

src/acp/policy.ts:268


getDenyModes

Const getDenyModes<P>(policy): AccessModes

See getDenyModesV1. Will be updated to point to getDenyModesV2 when pod.inrupt.com is transitioned to the updated vocabulary.

Type parameters

Name

Type

P

extends ThingPersisted

Parameters

Name

Type

policy

P

Returns

AccessModes

Defined in

src/acp/policy.ts:420


getDenyModesV1

getDenyModesV1<P>(policy): AccessModes

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Given a Policy, return which AccessModes it disallows.

since 1.6.0

deprecated The Access Control Policies proposal will be updated to use a different vocabulary for allow- and deny-modes. To be compatible with servers that implement that, use getDenyModesV2.

Type parameters

Name

Type

P

extends ThingPersisted

Parameters

Name

Type

Description

policy

P

The Policy on which you want to know the Access Modes it disallows.

Returns

AccessModes

Defined in

src/acp/policy.ts:407


getDenyModesV2

getDenyModesV2<P>(policy): AccessModes

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Given a Policy, return which AccessModes it disallows.

since Not released yet.

Type parameters

Name

Type

P

extends ThingPersisted

Parameters

Name

Type

Description

policy

P

The Policy on which you want to know the Access Modes it disallows.

Returns

AccessModes

Defined in

src/acp/policy.ts:386


getPolicy

getPolicy(policyResource, url): Policy | null

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Get the Policy with the given URL from an SolidDataset.

since 1.6.0

Parameters

Name

Type

Description

policyResource

SolidDataset

The Resource that contains the given Policy.

url

Url | UrlString

URL that identifies this Policy.

Returns

Policy | null

The requested Policy, if it exists, or null if it does not.

Defined in

src/acp/policy.ts:114


getPolicyAll

getPolicyAll(policyResource): Policy[]

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Get all Policy’s in a given SolidDataset.

since 1.6.0

Parameters

Name

Type

Description

policyResource

SolidDataset

The Resource that contains Access Policies.

Returns

Policy[]

Defined in

src/acp/policy.ts:136


getResourceAcrPolicy

getResourceAcrPolicy(resourceWithAcr, name): ResourcePolicy | null

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Get the ResourcePolicy with the given name that applies to a Resource’s Access Control Resource from that Access Control Resource.

since 1.6.0

Parameters

Name

Type

Description

resourceWithAcr

WithAccessibleAcr

The Resource whose ACR contains the given Policy.

name

string

The name that identifies this Policy.

Returns

ResourcePolicy | null

The requested Policy, if it exists and applies to the Resource’s ACR, or null if it does not.

Defined in

src/acp/policy.ts:492


getResourceAcrPolicyAll

getResourceAcrPolicyAll(resourceWithAcr): ResourcePolicy[]

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Get all ResourcePolicy’s that apply to a given Resource’s Access Control Resource from that Access Control Resource.

since 1.6.0

Parameters

Name

Type

Description

resourceWithAcr

WithAccessibleAcr

The Resource whose Access Control Resource contains Access Policies.

Returns

ResourcePolicy[]

Defined in

src/acp/policy.ts:546


getResourcePolicy

getResourcePolicy(resourceWithAcr, name): ResourcePolicy | null

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Get the ResourcePolicy with the given name that applies to a Resource from its Access Control Resource.

since 1.6.0

Parameters

Name

Type

Description

resourceWithAcr

WithAccessibleAcr

The Resource whose ACR contains the given Policy.

name

string

The name that identifies this Policy.

Returns

ResourcePolicy | null

The requested Policy, if it exists and applies to the given Resource, or null if it does not.

Defined in

src/acp/policy.ts:459


getResourcePolicyAll

getResourcePolicyAll(resourceWithAcr): ResourcePolicy[]

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Get all ResourcePolicy’s that apply to a Resource in its Access Control Resource.

since 1.6.0

Parameters

Name

Type

Description

resourceWithAcr

WithAccessibleAcr

The Resource whose Access Control Resource contains Access Policies applying to it.

Returns

ResourcePolicy[]

Defined in

src/acp/policy.ts:523


policyAsMarkdown

policyAsMarkdown(policy): string

Gets a human-readable representation of the given Policy to aid debugging.

Note that changes to the exact format of the return value are not considered a breaking change; it is intended to aid in debugging, not as a serialisation method that can be reliably parsed.

since 1.6.0

Parameters

Name

Type

Description

policy

Policy | ResourcePolicy

The Policy to get a human-readable representation of.

Returns

string

Defined in

src/acp/policy.ts:727


removePolicy

removePolicy<Dataset>(policyResource, policy): Dataset

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Remove the given Policy from the given SolidDataset.

since 1.6.0

Type parameters

Name

Type

Dataset

extends Readonly<Object>

Parameters

Name

Type

Description

policyResource

Dataset

The Resource that contains Access Policies.

policy

Url | UrlString | Policy

The Policy to remove from the resource.

Returns

Dataset

Defined in

src/acp/policy.ts:155


removeResourceAcrPolicy

removeResourceAcrPolicy<ResourceExt>(resourceWithAcr, policy): ResourceExt

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Remove the given ResourcePolicy that applies to a given Resource’s Access Control Resource from that Access Control Resource.

since 1.6.0

Type parameters

Name

Type

ResourceExt

extends WithAccessibleAcr

Parameters

Name

Type

Description

resourceWithAcr

ResourceExt

The Resource whose Access Control Resource contains Access Policies.

policy

string | Url | UrlString | ResourcePolicy

The ACR Policy to remove from the Resource’s Access Control Resource.

Returns

ResourceExt

Defined in

src/acp/policy.ts:625


removeResourcePolicy

removeResourcePolicy<ResourceExt>(resourceWithAcr, policy): ResourceExt

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Remove the given ResourcePolicy from the given Resource’s Access Control Resource.

since 1.6.0

Type parameters

Name

Type

ResourceExt

extends WithAccessibleAcr

Parameters

Name

Type

Description

resourceWithAcr

ResourceExt

The Resource whose Access Control Resource contains Access Policies.

policy

string | Url | UrlString | ResourcePolicy

The Policy to remove from the Resource’s Access Control Resource.

Returns

ResourceExt

Defined in

src/acp/policy.ts:570


setAllowModes

Const setAllowModes<P>(policy, modes): P

See setAllowModesV1. Will be updated to point to setAllowModesV2 when pod.inrupt.com is transitioned to the updated vocabulary.

Type parameters

Name

Type

P

extends ThingPersisted

Parameters

Name

Type

policy

P

modes

AccessModes

Returns

P

Defined in

src/acp/policy.ts:257


setAllowModesV1

setAllowModesV1<P>(policy, modes): P

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Given a Policy and a set of AccessModes, return a new Policy based on the given Policy, but with the given Access Modes allowed on it.

since 1.6.0

deprecated The Access Control Policies proposal will be updated to use a different vocabulary for allow- and deny-modes. To be compatible with servers that implement that, use setAllowModesV2.

Type parameters

Name

Type

P

extends ThingPersisted

Parameters

Name

Type

Description

policy

P

The Policy on which to set the modes to allow.

modes

AccessModes

Modes to allow for this Policy.

Returns

P

Defined in

src/acp/policy.ts:236


setAllowModesV2

setAllowModesV2<P>(policy, modes): P

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Given a Policy and a set of AccessModes, return a new Policy based on the given Policy, but with the given Access Modes allowed on it.

since Not released yet.

Type parameters

Name

Type

P

extends ThingPersisted

Parameters

Name

Type

Description

policy

P

The Policy on which to set the modes to allow.

modes

AccessModes

Modes to allow for this Policy.

Returns

P

Defined in

src/acp/policy.ts:193


setDenyModes

Const setDenyModes<P>(policy, modes): P

See setDenyModesV1. Will be updated to point to setDenyModesV2 when pod.inrupt.com is transitioned to the updated vocabulary.

Type parameters

Name

Type

P

extends ThingPersisted

Parameters

Name

Type

policy

P

modes

AccessModes

Returns

P

Defined in

src/acp/policy.ts:375


setDenyModesV1

setDenyModesV1<P>(policy, modes): P

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Given a Policy and a set of AccessModes, return a new Policy based on the given Policy, but with the given Access Modes disallowed on it.

since 1.6.0

deprecated The Access Control Policies proposal will be updated to use a different vocabulary for allow- and deny-modes. To be compatible with servers that implement that, use setDenyModesV2.

Type parameters

Name

Type

P

extends ThingPersisted

Parameters

Name

Type

Description

policy

P

The Policy on which to set the modes to disallow.

modes

AccessModes

Modes to disallow for this Policy.

Returns

P

Defined in

src/acp/policy.ts:354


setDenyModesV2

setDenyModesV2<P>(policy, modes): P

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Given a Policy and a set of AccessModes, return a new Policy based on the given Policy, but with the given Access Modes disallowed on it.

since Not released yet.

Type parameters

Name

Type

P

extends ThingPersisted

Parameters

Name

Type

Description

policy

P

The Policy on which to set the modes to disallow.

modes

AccessModes

Modes to disallow for this Policy.

Returns

P

Defined in

src/acp/policy.ts:315


setPolicy

setPolicy<Dataset>(policyResource, policy): Dataset

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Insert the given Policy into the given SolidDataset, replacing previous instances of that Policy.

since 1.6.0

Type parameters

Name

Type

Dataset

extends Readonly<Object>

Parameters

Name

Type

Description

policyResource

Dataset

The Resource that contains Access Policies.

policy

Policy

The Policy to insert into the Resource.

Returns

Dataset

A new dataset equal to the given resource, but with the given Policy.

Defined in

src/acp/policy.ts:174


setResourceAcrPolicy

setResourceAcrPolicy<ResourceExt>(resourceWithAcr, policy): ResourceExt

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Insert the given ResourcePolicy into the given Resource’s Acccess Control Resource, replacing previous instances of that Policy, to apply to the Access Control Resource itself.

since 1.6.0

Type parameters

Name

Type

ResourceExt

extends WithAccessibleAcr

Parameters

Name

Type

Description

resourceWithAcr

ResourceExt

The Resource whose Access Control Resource contains Access Policies.

policy

ResourcePolicy

The Policy to insert into the Resource’s Access Control Resource.

Returns

ResourceExt

A new Resource equal to the given Resource, but with the given Policy in its Access Control Resource, applying to that Access Control Resource.

Defined in

src/acp/policy.ts:707


setResourcePolicy

setResourcePolicy<ResourceExt>(resourceWithAcr, policy): ResourceExt

Note

There is no Access Control Policies specification yet. As such, this function is still experimental and subject to change, even in a non-major release.

Insert the given ResourcePolicy into the given Resource’s Acccess Control Resource, replacing previous instances of that Policy.

since 1.6.0

Type parameters

Name

Type

ResourceExt

extends WithAccessibleAcr

Parameters

Name

Type

Description

resourceWithAcr

ResourceExt

The Resource whose Access Control Resource contains Access Policies.

policy

ResourcePolicy

The Policy to insert into the Resource’s Access Control Resource.

Returns

ResourceExt

A new Resource equal to the given Resource, but with the given Policy in its Access Control Resource.

Defined in

src/acp/policy.ts:682