Skip to content

TypeScript API / laikacms/auth / hasScope

Function: hasScope() ​

ts
function hasScope(granted, required): boolean;

Does granted satisfy required, accounting for wildcards?

  • a global grant (admin/*) satisfies anything;
  • an exact match satisfies;
  • a resource:* grant satisfies any resource:action on that resource.

Parameters ​

ParameterType
grantedreadonly Scope[]
requiredScope

Returns ​

boolean

Released under the MIT License.