Skip to content

frontend-web-editor


Function: DefineAbility()

DefineAbility(roles): MongoAbility<[Actions, Subjects]>

Defined in: app/casl/ability.ts:18

Defines the ability (permissions) for a given set of roles.

Parameters

roles

PermissionDto[]

An array of Role objects that define the permissions for the user.

Returns

MongoAbility<[Actions, Subjects]>

A MongoAbility instance that represents the user's permissions.

This function converts the provided roles into a format that can be used by CASL's MongoAbility. It uses the createMongoAbility function to create an ability instance based on the provided roles.