Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ory Permission Language: support ; in types #1135

Closed
5 of 6 tasks
nidomiro opened this issue Nov 15, 2022 · 0 comments · Fixed by #1151
Closed
5 of 6 tasks

Ory Permission Language: support ; in types #1135

nidomiro opened this issue Nov 15, 2022 · 0 comments · Fixed by #1151
Assignees
Labels
bug Something is not working.

Comments

@nidomiro
Copy link
Contributor

Preflight checklist

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

@nidomiro nidomiro added the bug Something is not working. label Nov 15, 2022
hperl added a commit that referenced this issue Nov 24, 2022
hperl added a commit that referenced this issue Nov 25, 2022
hperl added a commit that referenced this issue Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants