権限を試す
todos
テーブル用のGraphQL APIによる権限のテストを始めましょう。
クエリ
では、2つの要求ヘッダーを追加して、データのクエリを行いましょう。
x-hasura-role
:user
x-hasura-user-id
:1
query {todos {idtitleis_publicis_completeduser_id}}
以下のような応答が得られるはずです。
ユーザーid 1
に対して、受信した応答がフィルターされることに注意してください。x-hasura-user-id
から 2
に値を変更すると、ユーザーid 2
に対してのみデータが返されます。これにより、前のステップで設定した権限が確認されます。
users
テーブルでも、同様に権限設定をテストできます。
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
![Promo](/learn/ja/graphql/hasura/static/hasura-free-ff60e409244e0ea12b5a3045d1a9096b.png)
![footer illustration](https://graphql-engine-cdn.hasura.io/learn-hasura/assets/footer-img.png)