realm / realm-graphql-service

GraphQL service for Realm Object Server
https://realm.io
Apache License 2.0
43 stars 10 forks source link

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

Open cedvdb opened 5 years ago

cedvdb commented 5 years ago

Using

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

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

nirinchev commented 5 years ago

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

cedvdb commented 5 years ago

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.

nirinchev commented 5 years ago

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?

cedvdb commented 5 years ago

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 commented 5 years ago

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
            }
        }