[英]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.