Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty results when using graphiql as non-admin. #17

Open
d0t15t opened this issue Aug 2, 2018 · 3 comments
Open

Empty results when using graphiql as non-admin. #17

d0t15t opened this issue Aug 2, 2018 · 3 comments

Comments

@d0t15t
Copy link
Contributor

d0t15t commented Aug 2, 2018

I've created a role 'api' and assigned it to 'Use GraphQL query' in Drupal-Permissions. The user can then reach the /graphql/graphiql page, but queries return only empty results. When logged in as an admin, the same query returns all nodes as expected.

graphiql___drupal_7_base 2
graphiql___drupal_7_base

@olragon
Copy link
Owner

olragon commented Aug 4, 2018

User need permission to read node_article

@d0t15t
Copy link
Contributor Author

d0t15t commented Aug 7, 2018

Sorry i forgot to mention, the user has the permission: "View published content" (There are no node level view permissions in core drupal). The user can view all the same nodes as the admin, yet gets empty results in Graphiql. When i assign the test role the permission "Administer content", then it receives the expected results in Graphiql.

@olragon
Copy link
Owner

olragon commented Aug 7, 2018

You can try to run entity_access('view', 'node', $node). All thing related to permissions is checked through entity_access($op, $entity_type, $entity).

https://github.com/olragon/graphql_api/blob/master/src/Schema.php#L336:24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants