delightful-yak-60786
04/22/2025, 7:40 AMGroup:g1#members@User:u1
Item:i1#viewers@(Group:g1#members)
with the following OPL spec
class User implements Namespace { }
class Group implements Namespace {
related: {
members: (User | Group)[];
};
}
class Item implements Namespace {
related: {
viewers: (User | SubjectSet<Group, "members">)[];
};
permits = {
view: (ctx: Context): boolean => this.related.viewers.includes(ctx.subject),
};
}
I dont understand the query required to list all the Items
that User:u1
can view with the Relationship API & List. Here is an example of the code (Go)
rr, _, err := c.r.RelationshipAPI.GetRelationships(ctx).
Namespace("Item").
PageSize(10).
PageToken(""). // can be empty
Relation("viewers").
SubjectId("u1"). //
Execute()