Test out permissions
Let's go ahead and start testing the permissions through the GraphQL API for todos
table.
Query
Now let's go ahead and query the data by adding two request headers:
x-hasura-role
:user
x-hasura-user-id
:1
query {todos {idtitleis_publicis_completeduser_id}}
You should get a response looking something like this:
Note that the response received is filtered for the user id 1
. If you change the value for x-hasura-user-id
to 2
, the data would be returned only for the user id 2
. This confirms the permissions that we configured in the previous steps.
You can test the permission configuration similarly for the users
table as well.
Did you find this page helpful?
Start with GraphQL on Hasura for Free
- Build apps and APIs 10x faster
- Built-in authorization and caching
- 8x more performant than hand-rolled APIs