hasura / hasura/graphql-engine

Relationships on logical models

Open
#9,893 4 comments 12 reactions 1 assignee Claimed by @dameleney View on GitHub
k/enhancement
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.