Handles permissions according to the WAC specification. Specific access checks are done by the provided AccessChecker.

Hierarchy

Constructors

Properties

accessChecker: AccessChecker
aclStore: ResourceStore
identifierStrategy: IdentifierStrategy
logger: Logger = ...

Methods

  • Determines the available permissions for the given credentials. Will deny all permissions if credentials are not defined

    Parameters

    • acl: Store<Quad, Quad, Quad, Quad>

      Store containing all relevant authorization triples.

    • Optional credentials: Credential

      Credentials to find the permissions for.

    Returns Promise<AclPermission>

  • Extracts all rules from the store that are relevant for the given target, based on either the acl:accessTo or acl:default predicates.

    Returns

    A store containing the relevant triples for the given target.

    Parameters

    • store: Store<Quad, Quad, Quad, Quad>

      Store to filter.

    • target: string

      The identifier of which the acl rules need to be known.

    • directAcl: boolean

      If the store contains triples from the direct acl resource of the target or not. Determines if acl:accessTo or acl:default are used.

    Returns Promise<Store<Quad, Quad, Quad, Quad>>

  • Finds the ACL data relevant for its resource, and potentially its parent if required. All quads in the resulting store(s) can be interpreted as being relevant ACL rules for their target.

    Returns

    The relevant triples.

    Parameters

    • target: ResourceIdentifier

      Target to find ACL data for.

    • includeParent: boolean

      If parent ACL data is also needed.

    Returns Promise<AclSet>

  • Finds the ACL resources from all resources in the path between the two (inclusive) identifiers. It is important that from is a child path of to, otherwise behaviour is undefined.

    The result is a key/value object with the keys being the identifiers of resources in the path that had a corresponding ACL resource, and the value being the contents of that ACL resource.

    The function stops after it finds an ACL resource relevant for the to identifier. This is either its corresponding ACL resource, or one if its parent containers if such a resource does not exist.

    Rethrows any non-NotFoundHttpErrors thrown by the ResourceStore.

    Returns

    A map with the key being the actual identifier of which the ACL was found and a list of all data found within.

    Parameters

    Returns Promise<Record<string, Store<Quad, Quad, Quad, Quad>>>

  • Sets the correct values for non-acl permissions such as create and delete. Also adds the correct values to indicate that having control permission implies having read/write/etc. on the acl resource.

    The main reason for keeping the control value is so we can correctly set the WAC-Allow header later.

    Parameters

    • aclPermissions: AclPermission
    • isAcl: boolean

    Returns AclPermission