checkPermission
@abimongo/core / checkPermission
Function: checkPermission()
checkPermission(
role,permission):Promise<boolean>
Defined in: core/src/middleware/rbac/rbacMiddleware.ts:45
Check if a user has a specific permission
Parameters
role
The role of the user
permission
The permission to check
Returns
Promise<boolean>
A promise that resolves to true if the user has the permission, false otherwise
Example
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
}