Ory Permission Language: support `;` in types
nidomiro opened this issue · 0 comments
nidomiro commented
Preflight checklist
- I could not find a solution in the existing issues, docs, nor discussions.
- I agree to follow this project's Code of Conduct.
- I have read and am following this repository's Contribution Guidelines.
- This issue affects my Ory Network project.
- I have joined the Ory Community Slack.
- I am signed up to the Ory Security Patch Newsletter.
Describe the bug
;
are not allowed in type-definitions: expected identifier or '}', got ";"
using a ,
instead of ;
works
Reproducing the bug
paste the following into Permission Rules
at Ory Network:
import { Namespace, SubjectSet, Context } from '@ory/keto-namespace-types';
class User implements Namespace {
related: {
manager: User[];
};
}
class Group implements Namespace {
related: {
members: (User | Group)[];
};
}
class Folder implements Namespace {
related: {
parents: Folder[];
viewers: SubjectSet<Group, 'members'>[];
};
permits = {
view: (ctx: Context): boolean =>
this.related.viewers.includes(ctx.subject) ||
this.related.parents.traverse((p) => p.permits.view(ctx)),
};
}
class File implements Namespace {
related: {
parents: Folder[];
viewers: (User | SubjectSet<Group, 'members'>)[];
owners: (User | SubjectSet<Group, 'members'>)[];
};
// Some comment
permits = {
view: (ctx: Context): boolean =>
this.related.parents.traverse((p) => p.permits.view(ctx)) ||
this.related.viewers.includes(ctx.subject) ||
this.related.owners.includes(ctx.subject),
edit: (ctx: Context) => this.related.owners.includes(ctx.subject),
};
}
The ts-file is formatted with prettier (with single-quote option)
Relevant log output
expected identifier or '}', got ";"
Relevant configuration
No response
Version
Ory Network (15.11.2022)
On which operating system are you observing this issue?
Ory Network
In which environment are you deploying?
Ory Network
Additional Context
No response