realm-graphql-service icon indicating copy to clipboard operation
realm-graphql-service copied to clipboard

querying one entity that has read only permission won't give any result

Open cedvdb opened this issue 6 years ago • 5 comments
trafficstars

Using

		query product($id: String!) {
			product(id: $id) {
				id
			}
		}

On an entity that has read only permission won't give any result back.

cedvdb avatar Apr 12 '19 07:04 cedvdb

If you query all products, do you see the one with that id?

nirinchev avatar Apr 12 '19 16:04 nirinchev

If you query all products, do you see the one with that id?

Not sure what you mean.

If I add the class level permission of Query, I do receive a result. If I don't add the class level permission, by definition I cannot query all products.

cedvdb avatar Apr 15 '19 13:04 cedvdb

You say that issuing a query like product(id: "123") returns nothing. What is the result of a products query (which should return all objects) - do you get an object with id: 123 or is it missing altogether? I'm just trying to narrow down the potential issue. Also, if you use a native SDK (e.g. node/swift/etc.), do you get the object - i.e. is this an issue that only affects GraphQL or all clients trying to connect to that partial realm?

nirinchev avatar Apr 15 '19 14:04 nirinchev

You say that issuing a query like product(id: "123") returns nothing. What is the result of a products query (which should return all objects)

Unless I'm mistaking, if a class has permissions:

    canRead: true,
    canQuery: false,

Your statement "which should return all objects" is false.

But If I set the permissions to

    canRead: true,
    canQuery: true,

Then I do receive the object.

Also, if you use a native SDK (e.g. node/swift/etc.), do you get the object - i.e. is this an issue that only affects GraphQL or all clients trying to connect to that partial realm?

I assume the answer is yes and that it's a problem with gql only. But I didn't try and I'm kind of in a hurry so I cannot do it right now. Maybe tomorrow

cedvdb avatar Apr 16 '19 09:04 cedvdb

Just to be more clear, as I see this is still pending.

I think the issue arose when

    canRead: true,
    canQuery: false,

won't give any result for

		query product($id: String!) {
			product(id: $id) {
				id
			}
		}

cedvdb avatar Jul 19 '19 15:07 cedvdb