import type { SolidDataset, ThingPersisted, Url, UrlString, WebId } from "../interfaces"; import type { WithAccessibleAcr } from "./acp"; import type { Policy, ResourcePolicy } from "./policy"; /** * A Matcher can be applied to a [[Policy]] to determine under what circumstances that Policy is applied to a Resource. * @since Not released yet. */ export type Matcher = ThingPersisted; /** * A ResourceMatcher is like a [[Matcher]], but applied to a [[ResourcePolicy]] and therefore not re-used across different Resources, but only used for a single Resource and stored in that Resource's Access Control Resource. * @since Not released yet. */ export type ResourceMatcher = ThingPersisted; /** * ```{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. * ``` * * Add a Matcher that refines the scope of a given the [[Policy]]. If an agent * requesting access to a resource is **not** present in **any** of the "All Of" Matchers, * they will not be granted access. * * Also see [[addAnyOfMatcherUrl]] and [[addNoneOfMatcherUrl]]. * * @param policy The [[Policy]] to which the Matcher should be added. * @param matcher The Matcher to add to the policy. * @returns A new [[Policy]] clone of the original one, with the new Matcher added. * @since Not released yet. */ export declare function addAllOfMatcherUrl
(policy: P, matcher: Matcher | Url | UrlString): 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. * ``` * * Removes a Matcher that refines the scope of a given the [[Policy]]. If an agent * requesting access to a resource is **not** present in **any** of the "All Of" Matchers, * they will not be granted access. * @param policy The [[Policy]] from which the Matcher should be removed. * @param matcher The Matcher to remove from the policy. * @returns A new [[Policy]] clone of the original one, with the Matcher removed. * @since Not released yet. */ export declare function removeAllOfMatcherUrl
(policy: P, matcher: Matcher | Url | UrlString): 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. * ``` * * Overwrites the Matcher refining the scope of a given the [[Policy]]. If an agent * requesting access to a resource is **not** present in **any** of the "All Of" Matchers, * they will not be granted access. * @param policy The [[Policy]] to which the Matcher should be added. * @param matcher The Matcher to set for the Policy. * @returns A new [[Policy]] clone of the original one, with the "All Of" Matchers replaced. * @since Not released yet. */ export declare function setAllOfMatcherUrl
(policy: P, matcher: Matcher | Url | UrlString): 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. * ``` * * Get the "All Of" [[Matcher]]s for the given [[Policy]] * @param policy The [[policy]] from which the Matchers should be read. * @returns A list of the "All Of" [[Matcher]]s * @since Not released yet. */ export declare function getAllOfMatcherUrlAll
(policy: P): UrlString[]; /** * ```{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. * ``` * * Add a Matcher that extends the scope of a given the [[Policy]]. If an agent * requesting access to a resource is present in **any** of the "Any Of" Matchers, * they will be granted access. * * Also see [[addAllOfMatcherUrl]] and [[addNoneOfMatcherUrl]]. * * @param policy The [[Policy]] to which the Matcher should be added. * @param matcher The Matcher to add to the policy. * @returns A new [[Policy]] clone of the original one, with the new Matcher added. * @since Not released yet. */ export declare function addAnyOfMatcherUrl
(policy: P, matcher: Matcher | Url | UrlString): 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. * ``` * * Removes a Matcher that extends the scope of a given the [[Policy]]. If an agent * requesting access to a resource is present in **any** of the "Any Of" Matchers, * they will be granted access. * @param policy The [[Policy]] from which the Matcher should be removed. * @param matcher The Matcher to remove from the policy. * @returns A new [[Policy]] clone of the original one, with the Matcher removed. * @since Not released yet. */ export declare function removeAnyOfMatcherUrl
(policy: P, matcher: Matcher | Url | UrlString): 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. * ``` * * Overwrite the Matcher extending the scope of a given the [[Policy]]. If an agent * requesting access to a resource is present in **any** of the "Any Of" Matchers, * they will be granted access. * @param policy The [[Policy]] to which the Matcher should be added. * @param matcher The Matcher to set for the Policy. * @returns A new [[Policy]] clone of the original one, with the "Any Of" Matchers replaced. * @since Not released yet. */ export declare function setAnyOfMatcherUrl
(policy: P, matcher: Matcher | Url | UrlString): 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. * ``` * * Get the "Any Of" [[Matcher]]s for the given [[Policy]] * @param policy The [[policy]] from which the Matchers should be read. * @returns A list of the "Any Of" [[Matcher]]s * @since Not released yet. */ export declare function getAnyOfMatcherUrlAll
(policy: P): UrlString[]; /** * ```{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. * ``` * * Add a Matcher that restricts the scope of a given the [[Policy]]. If an agent * requesting access to a resource is matched by another Matcher, but **also** * by the given Matcher, they will **not** be granted access. * * Also see [[addAllOfMatcherUrl]] and [[addAnyOfMatcherUrl]]. * * @param policy The [[Policy]] to which the Matcher should be added. * @param matcher The Matcher to add to the policy. * @returns A new [[Policy]] clone of the original one, with the new Matcher added. * @since Not released yet. */ export declare function addNoneOfMatcherUrl
(policy: P, matcher: Matcher | Url | UrlString): 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. * ``` * * Removes a Matcher that restricts the scope of a given the [[Policy]]. If an agent * requesting access to a resource is matched by another Matcher, but **also** * in any of the "None Of" Matchers, they will **not** be granted access. * * @param policy The [[Policy]] from which the Matcher should be removed. * @param matcher The Matcher to remove from the policy. * @returns A new [[Policy]] clone of the original one, with the Matcher removed. * @since Not released yet. */ export declare function removeNoneOfMatcherUrl
(policy: P, matcher: Matcher | Url | UrlString): 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. * ``` * * Set the Matchers restricting the scope of a given [[Policy]]. If an agent * requesting access to a resource is matched by another Matcher, but **also** * by any of the "None Of" Matchers, they will not be granted access. * * @param policy The [[Policy]] to which the Matcher should be added. * @param matcher The Matcher to set for the Policy. * @returns A new [[Policy]] clone of the original one, with the "None Of" Matchers replaced. * @since Not released yet. */ export declare function setNoneOfMatcherUrl
(policy: P, matcher: Matcher | Url | UrlString): 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. * ``` * * Get the "None Of" [[Matcher]]s for the given [[Policy]] * @param policy The [[policy]] from which the Matchers should be read. * @returns A list of the forbidden [[Matcher]]s * @since Not released yet. */ export declare function getNoneOfMatcherUrlAll
(policy: P): UrlString[];
/**
* ```{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 [[Matcher]].
*
* @param url URL that identifies this [[Matcher]].
* @since Not released yet.
*/
export declare function createMatcher(url: Url | UrlString): Matcher;
/**
* ```{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 [[ResourceMatcher]] for the given Resource.
*
* @param resourceWithAcr The Resource to which the new Matcher is to apply.
* @param name Name that identifies this [[Matcher]].
* @since Not released yet.
*/
export declare function createResourceMatcherFor(resourceWithAcr: WithAccessibleAcr, name: string): ResourceMatcher;
/**
* ```{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 [[Matcher]] with the given URL from an [[SolidDataset]].
*
* @param matcherResource The Resource that contains the given [[Matcher]].
* @param url URL that identifies this [[Matcher]].
* @returns The requested [[Matcher]], if it exists, or `null` if it does not.
* @since Not released yet.
*/
export declare function getMatcher(matcherResource: SolidDataset, url: Url | UrlString): Matcher | 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 [[ResourceMatcher]] with the given name from an Resource's Access Control
* Resource.
*
* @param resourceWithAcr The Resource whose Access Control Resource contains the given [[ResourceMatcher]].
* @param name Name that identifies this [[ResourceMatcher]].
* @returns The requested [[ResourceMatcher]], if it exists, or `null` if it does not.
* @since Not released yet.
*/
export declare function getResourceMatcher(resourceWithAcr: WithAccessibleAcr, name: string): ResourceMatcher | 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.
* ```
*
* Gets the [[Matcher]]s from a [[SolidDataset]].
*
* @param matcherResource The Resource that contains (zero or more) [[Matcher]]s.
* @returns The [[Matcher]]s contained in this resource.
* @since Not released yet.
*/
export declare function getMatcherAll(matcherResource: SolidDataset): Matcher[];
/**
* ```{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.
* ```
*
* Gets the [[ResourceMatcher]]s from a Resource's Access Control Resource.
*
* @param resourceWithAcr The Resource whose Access Control Resource contains (zero or more) [[ResourceMatcher]]s.
* @returns The [[ResourceMatcher]]s contained in this Resource's Access Control Resource.
* @since Not released yet.
*/
export declare function getResourceMatcherAll(resourceWithAcr: WithAccessibleAcr): ResourceMatcher[];
/**
* ```{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.
* ```
*
* Removes the given [[Matcher]] from the given [[SolidDataset]].
*
* @param matcherResource The Resource that contains (zero or more) [[Matcher]]s.
* @returns A new SolidDataset equal to the given Matcher Resource, but without the given Matcher.
* @since Not released yet.
*/
export declare function removeMatcher