Hello, how can I create a recursive
# spicedb
f
Hello, how can I create a recursive relationship? I have an user, and a node I want the user to have permission on a node, and on all it's children, and all the children of its children, etc here is a playground with some assertions https://play.authzed.com/s/ZsvMkvhg-BZv/schema
v
SpiceDB will fail to compute if it finds a recursion cycle. You can define your schema in a way that the data graph cycles, but the permissions compute it in a way that do not (e.g. permission that navigates in a direction that does not cycle).
f
so there is no way for me to do this? I have to manually add the permissions for each parent?
v
sorry, I didn't get to read your schema. What you do is perfectly supported. What I meant whas that SpiceDB fails when it finds recursion cycles. This is how we recommend doing it::
Copy code
definition user {}

definition node {
    relation perm: user
    relation parent: node

    permission some_perm = perm + parent->some_perm
}
`
f
oh, ok, perfect! thanks!
28 Views