hasura / hasura/graphql-engine
Relationships on logical models
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Is your proposal related to a problem?
It is currently not possible to add relationships to [logical models](https://hasura.io/docs/latest/schema/postgres/logical-models/). This makes it impossible to add permissions that check if a relationship exists.
_Example:_
_Logical model `measurements` has a field called `company_id` that defines which company is linked to the measurement. I would like to add a permission to this logical model that checks if the current user has access to data of this company. Normally I would check the company relation of the table (in this case logical model) and check if the user is linked to it. If this is the case the user has access to the data. If it isn't we do not return the data._
Because of this issue I won't be able to use the native query/logical model functionality in a production environment.
### Describe the solution you'd like
Adding relationships to logical models and using them in the permission configurations (just like in normal tables).
### Describe alternatives you've considered
An alternative would be to add permission configurations to native queries. So permissions would not only be available on logical models, but also on the queries itself. As native queries already have relationship functionality only the permissions have to be added.
Contributor guide
Assessment
This issue has not been assessed yet.