Title
b

Butch

12/12/2017, 5:07 PM
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

matic

12/12/2017, 5:13 PM
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:
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

Butch

12/12/2017, 5:22 PM
very nice, was just typing somethign like that up, Thanks!
m

matic

12/12/2017, 5:23 PM
awesome, no problem 🙂