billions-elephant-38030
05/10/2024, 4:37 PMUser
can only have a single ownership
relation of a Organisation
chilly-king-10285
05/10/2024, 4:37 PMchilly-king-10285
05/10/2024, 4:38 PMbillions-elephant-38030
05/10/2024, 4:58 PMchilly-king-10285
05/10/2024, 4:58 PMchilly-king-10285
05/10/2024, 4:58 PMUser
objects could have a relationship to one Organisation
object. This is naturally supported in Keto as you can add the same Organisation
relation to many User
objects. However, if you want to ensure that an Organisation
can only have a relationship with one User
(i.e., one-to-many from the Organisation's
perspective), you would need to enforce this at the application level. This means that when you add a new User
relation to an Organisation
, you would first check if a User
relation already exists for that Organisation
. If it does, you could choose to not add the new relation, or remove the existing relation before adding the new one. Here are the relevant knowledge sources: - [Define relationships in the OPL](https://www.ory.sh/docs/keto/modeling/create-permission-model#define-relationships-in-the-opl) - [Relation declaration](https://www.ory.sh/docs/keto/reference/ory-permission-language#relation-declaration)