@eturino/claims
Version:
Claim, ClaimSet and Ability for permissions (Typescript port of https://github.com/eturino/claims)
18 lines (15 loc) • 441 B
text/typescript
/**
* allowed verbs for a Claim
*/
export const ALLOWED_VERBS = ["admin", "read", "delete", "create", "update", "manage"] as const;
/**
* allowed verbs for a Claim
*/
export type AllowedVerb = (typeof ALLOWED_VERBS)[number];
/**
* returns true if the given string is one of the allowed verbs
* @param verb
*/
export function isAllowedVerb(verb: string): verb is AllowedVerb {
return ALLOWED_VERBS.includes(verb as AllowedVerb);
}