Skip to content

ambiten


ambiten / core/src / checkPermission

Function: checkPermission() ​

checkPermission(role, permission): Promise<boolean>

Defined in: packages/core/src/middleware/rbac/rbacMiddleware.ts:45

Check if a user has a specific permission

Parameters ​

role ​

Role

The role of the user

permission ​

Permission

The permission to check

Returns ​

Promise<boolean>

A promise that resolves to true if the user has the permission, false otherwise

Example ​

ts
const hasPermission = await checkPermission('admin', 'createUser');
if (hasPermission) {
// User has permission to create a user
} else {
// User does not have permission to create a user
}

Context-aware execution infrastructure for multi-tenant systems.