Skip to main content

Function: isSubsetOf()

isSubsetOf(held, granted): boolean

Defined in: packages/authz/src/permission.ts:35

Whether granted is a subset of held: a bundle no larger than the grantor's own (17 D7, role ⪯ grantor.role).

granted is a bundle's codes as stored, unknown ones included. A code this build does not define is never in held (a scope's permissions are known codes only), so it counts as not held and the answer is false: a bundle written by a newer release is not delegable or revocable by an older one. Filtering the stored codes to the known ones first would drop it and answer true, failing open.

Parameters​

held​

readonly ("subject.create" | "subject.read" | "person.create" | "person.read" | "grant.create" | "grant.read" | "grant.revoke" | "accreditation.apply" | "accreditation.admit" | "accreditation.publish" | "accreditation.read" | "entity-statement.read" | "identifier.create" | "identifier.read" | "identifier.publish" | "identifier.update")[]

The grantor's permissions.

granted​

readonly string[]

The permissions being conferred, as stored.

Returns​

boolean

true when every granted code is held.