lively-scientist-17848
07/18/2024, 12:58 PMchilly-king-10285
07/18/2024, 12:58 PMchilly-king-10285
07/18/2024, 12:59 PMpermits property of the corresponding class in the OPL. Here is an example of how permissions are defined in OPL: typescript class Document implements Namespace { related: { owners: User[] editors: User[] viewers: User[] parents: Folder[] } permits = { view: (ctx: Context): boolean => this.related.viewers.includes(ctx.subject) || this.related.editors.includes(ctx.subject) || this.related.owners.includes(ctx.subject) || this.related.parents.traverse((parent) => parent.permits.view(ctx)), } } In this example, the view permission is granted if the subject is included in the viewers, editors, or owners of the document, or if the subject can view the parent folder. However, there is no explicit mention of a way to grant a permission if there are no relations of a given type on an object. You might need to implement custom logic in your TypeScript function to handle this case. For more information, you can refer to the [Ory documentation](https://www.ory.sh/docs/keto/modeling/create-permission-model#define-permissions-in-the-opl).