I implemented this in two calls on the backend for...
# spicedb
m
I implemented this in two calls on the backend for my particular use case; I wanted to find documents a user has access to, while also requiring those documents to be within an organization. The first call lists relationships for a resourceType, with a call like this:
Copy code
listRelationshipsForResource(
    resourceType,
    parentSubjectType,
    parentSubjectId,
    parentRelation
  );
With resourceType "documents" and parentRelation "parent_organization". In the schema, every document has a parent_organization relation The second call is a lookupResources call for the subject/user, which would fetch all resources that user has access to (with some filters you can specify ofcourse). With those two sets, you can then compute the subset of documents that the user has access to, which are also owned by that organization. There are some obvious scaling issues here, but we limit # of docs per org etc. so it hasn't been a huge problem