zenstack icon indicating copy to clipboard operation
zenstack copied to clipboard

[Bug] Rules with !auth().someBool causes failure

Open hongkongkiwi opened this issue 11 months ago • 0 comments

Description and expected behavior

This fails

  @@deny('update', (
    !auth().isPlatformAdmin &&
    future().isPlatformAdmin
  ))

It fails with a very unhelpful error message:

✖ Generating PrismaClient enhancer
Prisma Enhancer: Unsupported expression type: InvocationExpr

Changing it to this works:

  @@deny('update', (
    auth().isPlatformAdmin == false &&
    future().isPlatformAdmin
  ))

If not a bug, I guess it would be good to flag this in the validation on the vscode plugin. But I guess it might be a bug.

Environment (please complete the following information):

  • ZenStack version: 2.10.2
  • Prisma version: 6.1.0
  • Database type: Postgresql

hongkongkiwi avatar Jan 06 '25 22:01 hongkongkiwi