انتقل إلى المحتوى الرئيسي

Function: hasPermission()

hasPermission(scope, permission): boolean

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

The permission check every handler makes first (slice 1 D1.8): does the actor's grant carry this permission? A function over the scope's permissions, which came from a grant's bundle at principal.resolve. It never reads a claim the identity provider issued, so changing a group or attribute there changes nothing until a grant changes. A handler checks the permission, THEN the scope.

Parameters​

scope​

Scope

The caller's minted scope. A platform scope has no permissions and does not compile here.

permission​

"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"

What the operation requires.

Returns​

boolean

Whether the grant carries it.