[英]How do I import a .csv file into my Hasura PostgreSQL database?
[英]How do I set my hasura permission to only see the rows of my table corresponding to a user?
事情就是這樣。 我在這里描述了 3 個表:
我的應用程序上的人可以下訂單。 那么,我想要
orders
表行的rex
權限的用戶delivery
權限的用戶只能查看orders
表中zip
列設置為delivery
用戶的zip
的行從orders
表中,我可以為每個訂單獲取一個zip
。 使用表zip_user
,我可以從zip
中獲取user_id
。 從那個user_id
中,我可以從users
表中獲取交付用戶。
雖然讓rex
查看所有orders
表很簡單,但我還不能為delivery
用戶配置權限。 我需要做什么?
換句話說,假設用戶在orders
表上執行 select 將x-hasura-user-id
設置為某個用戶 id 並將x-hasura-role
設置為delivery
,那么該用戶如何僅從orders
表中獲取那些與與該用戶的user_id
關聯的zip
匹配?
Hasura 有關系的概念。 如果你有外鍵,它會自動建立關系,如果沒有,你可以在 UI 中自己建立。 建立關系后,您將能夠設置深度權限,因此在orders
表上,您將能夠使用users.id
。
從這里開始: https://hasura.io/docs/1.0/graphql/manual/schema/relationships/index.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.