Hi is there a way to reverse a search on expected ...
# spicedb
u
Hi is there a way to reverse a search on expected relations ? given this simple model definition user{ } definition document{ relation owner : user relation reader : user permission read = reader + owner } document:document1#owner@user:user1 document:document2#reader@user:user1 I can then get the document that the user owns: Expected Relation : document:document1#owner: - "[user:user1] is " but not all document that the user is related to ( document1 and document2 ) with somthing like "user:user1#document" or can I ? I could ad a reverse relation but the I would need to make two entries user->document and document->user each time, which seem difficult to maintain.
v
in order to list all resources the user has permission for, please use
LookupResources
API
u
hi thx, that looks like the answer. But unavailable in the Playground.
v
not available in the playground, but you can check it with
zed
command line
@Joey any way users can do
Lookup
calls in Playground?
u
thx, I'll have a look. Can it also be combined with the intersection operator, so you get all documents the user can read, but only for some intersection of say a organisational group membership
v
if you can express those semantics with a
permission
then you certainly can.
LookupResources
has a specific
permission
as argument.
j
no; LookupResources is not exposed currently in the Playground
we could look into adding it
u
thanks, ill try it out