# spicedb


01/31/2022, 7:57 PM
Hi there. I had a question about making complex queries with spiceDb. Given the following schema: definition user {} definition resource { relation owner: user relation viewer: user | user:* permission view = viewer + owner } I am wondering if it is possible to obtain a list of 'resource's that are owned by some user (foo) that can be viewed by another user (bar). More plainly I am trying to get the intersection of resources that are owned by foo and viewable by bar. I tried looking through the api documentation and examples but I wasn't able to figure out how to make queries beyond basic checking permissions, writing relationships/schema etc. I would appreciate any advice. Thanks!