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

Update permission buggy when used in @@deny #1235

Closed
baenio opened this issue Apr 10, 2024 · 1 comment
Closed

Update permission buggy when used in @@deny #1235

baenio opened this issue Apr 10, 2024 · 1 comment
Milestone

Comments

@baenio
Copy link

baenio commented Apr 10, 2024

Description and expected behavior
While writing the policies, I found out that the update permission in my @@deny is not working as expected. The following two policies will still update the id:

@@deny("update", future().id != id)
@@allow("update", true)

I also found out, that I can't run npx zenstack generate, when I write it like this:

@@deny("update", future().id != this.id)

// error
node_modules/.zenstack/policy.ts:1130:29 - error TS2304: Cannot find name 'id'.

Environment:

  • ZenStack version: 1.12.0
  • Prisma version: 5.12.1
  • Database type: Postgresql
@baenio
Copy link
Author

baenio commented Apr 10, 2024

There is of course a workaround for that, but I think, that it should still be possible to write it like initially. Especially the allow policy will be much longer, which will lead to unreadability.

// workaround, which will work
@@allow("update", future().id == id)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants