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

[ZModel] Insufficient type checking for "in" operator #1236

Open
ymc9 opened this issue Apr 11, 2024 · 0 comments
Open

[ZModel] Insufficient type checking for "in" operator #1236

ymc9 opened this issue Apr 11, 2024 · 0 comments
Labels

Comments

@ymc9
Copy link
Member

ymc9 commented Apr 11, 2024

model User {
  id Int @id @default(autoincrement())
  email String @unique
  name String?
  posts Post[]
  teamMemberships TeamMembership[]

  @@allow('all', true)
}

model TeamMembership {
  id Int @id @default(autoincrement())
  teamId Int
  user User @relation(fields: [userId], references: [id])
  userId Int

  @@allow('all', true)
}

model Post {
  id Int @id @default(autoincrement())
  title String

  owner User? @relation(fields: [ownerId], references: [id])
  ownerId Int?
  teamId Int

  @@allow('all', true)
  @@deny('all', teamId in auth().teamMemberships)
}

Inside the @@deny rule, the "in" expression should result in a type-checker error.

@ymc9 ymc9 added the schema label Apr 11, 2024
@ymc9 ymc9 added this to the v2.0.0 milestone Apr 11, 2024
@ymc9 ymc9 modified the milestones: v2.0.0, v2.1.0 May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant