Documentation / @zerotal/auth / tokenCan
Function: tokenCan()
tokenCan(
row,ability):boolean
Defined in: auth/src/PersonalAccessToken.ts:147
Check whether a token grants a specific ability (scope).
Parameters
row
The stored token row (as loaded by BearerTokenMiddleware).
ability
string
The ability name to check for, e.g. "write".
Returns
boolean
true when the token may perform ability.
Remarks
A null abilities column or the wildcard ['*'] is treated as full access.
If the stored abilities JSON fails to parse, this fails closed (returns
false) rather than granting access.