https://authzed.com logo
#spicedb
Title
# spicedb
u

Unhinged

10/12/2022, 12:38 PM
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

vroldanbet

10/12/2022, 12:43 PM
in order to list all resources the user has permission for, please use
LookupResources
API
u

Unhinged

10/12/2022, 12:58 PM
hi thx, that looks like the answer. But unavailable in the Playground.
v

vroldanbet

10/12/2022, 12:59 PM
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

Unhinged

10/12/2022, 1:02 PM
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

vroldanbet

10/12/2022, 1:05 PM
if you can express those semantics with a
permission
then you certainly can.
LookupResources
has a specific
permission
as argument.
j

Joey

10/12/2022, 3:15 PM
no; LookupResources is not exposed currently in the Playground
we could look into adding it
u

Unhinged

10/13/2022, 6:43 AM
thanks, ill try it out