Regarding Graphcool permissions: Can I set up a pe...
# prisma-whats-new
r
Regarding Graphcool permissions: Can I set up a permission query so that when querying
allFoobars
I only get the Foobars that I’m allowed to see? I tried something like
Copy code
SomeFoobarExists(
    filter: {
      id: $node_id
      owner: {
        id: $user_id
      }
    }
  )
but this just gives me a permission error instead of a “scoped” result of Foobars owned by the current user.
n
@richeterre currently permissions don't filter queries, they just prevent access
so you can use the same filter rules in the actual query that you use in the permission itself
Copy code
allFoobars(filter: { owner: { id: "user-id" } } ) { id }
r
Ah, so I have to make sure I never query for anything that I don’t have permission to see
Ok cool, I’ll do it that way for now 🙂
@nilan, another question: Is it possible to make a relation mandatory? So in the current example, can I enforce that a Foobar must be created with an owner ID passed?
n
that feature is currently in beta
👍 1