``` query permitViewOrg($user_id: ID!, $node_id: I...
# prisma-whats-new
b
Copy code
query permitViewOrg($user_id: ID!, $node_id: ID!) {
  SomeOrganizationExists(filter: {
    id: $node_id
    users_some: {
      id: $user_id
      role_in: [ADMIN, SUPER_ADMIN]
    }
  })
}
This covers it for reading the org they belong to, but limits usage for super admins
m
Have you tried using
AND
filter?
Sorry `OR`*, my bad
Actually, you might have to with from
SomeOrganizationExists
to
SomeUserExists
and then make reference to organisations. Something like this:
Copy code
query permitViewOrg($user_id: ID!, $node_id: ID!) {
  SomeUserExists(filter: {
    OR: [{
      id: $user_id,
      role: SUPER_ADMIN
    }, {
      id: $user_id,
      role: ADMIN,
      organizations_some: {
        id: $node_id
      }
    }]
  })
}
b
very nice, was just typing somethign like that up, Thanks!
m
awesome, no problem 🙂