You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use Oso for a large energy-provider in the Netherlands. We built our own data-filtering adapter for Strapi (nodeJS).
Works like a charm.
But now i come across a problem.
In the system we have users. Then we have a new entity: UserRelation, this defines a relationship between user A and user B.
Using this entity we can define relationships between users like, John is friend of Lisa. etc.
We have rules for reading, updating etc users and i want to re-use these when defining rules for UserRelations
So i define this rule for listing user relations on the /user-relations endpoint.
allow(user: User, "read", relation: UserRelation) if
allow(user, "read", relation.user_from) and
allow(user, "read", relation.user_to);
But now i get this error.
error: Invalid state: Type `User` occurs more than once as the target of a relation
OperationalError::InvalidState: Invalid state: Type `User` occurs more than once as the target of a relation
But this (incomplete) rule works:
allow(user: User, "read", relation: UserRelation) if
allow(user, "read", relation.user_from);
Why is this behaviour? Is this something we can disable ? I would like to re-use my rules.
i use npm oso "^0.26.0"
Help much appreciated 🙏
The text was updated successfully, but these errors were encountered:
#cant use this..# Invalid state: Type `User` occurs more than once as the target of a relation
relation_is_within_organization(user: User, relation: UserRelation) if
relation.type.organization.id = user.organization.id and
relation.user_from.organization.id = user.organization.id and
relation.user_to.organization.id = user.organization.id;
This is wierd, because this means i cannot make rules where i test multiple attributes on a user's value
Hi folks 👋 ,
We use Oso for a large energy-provider in the Netherlands. We built our own data-filtering adapter for Strapi (nodeJS).
Works like a charm.
But now i come across a problem.
In the system we have users. Then we have a new entity: UserRelation, this defines a relationship between user A and user B.
Using this entity we can define relationships between users like, John is friend of Lisa. etc.
We have rules for reading, updating etc users and i want to re-use these when defining rules for UserRelations
So i define this rule for listing user relations on the /user-relations endpoint.
But now i get this error.
But this (incomplete) rule works:
Why is this behaviour? Is this something we can disable ? I would like to re-use my rules.
i use npm oso "^0.26.0"
Help much appreciated 🙏
The text was updated successfully, but these errors were encountered: