Filter objects for authorizations
Syntax
$objects.filterPermission($roles)
$objects.filterPermission(
roles: [...],
account: $acc)
Description
Filters a set of specialized objects so that only the elements on which the given user has one of the given roles are included.
Parameters
| Name | Type | Type Description | Mandatory | Default |
|---|---|---|---|---|
| objects | Set of business objects | Set of business objects to be filtered | Yes | |
| roles | Set of roles or role names | Set of roles or role names | yes | |
| account | `tl.accounts:Person` |
User for whom the specialist objects are to be filtered | no | The logged-in user |
Return value
Type: Set of business objects
All business objects in the given set on which the user has one of the given roles.
Examples
Example 1
all(`myModule:MyType`).filterPermission("admin")
Output: All elements of the type `myModule:MyType` on which the logged-in user has the role admin.