https://authzed.com logo
Title
c

corkrean

05/10/2023, 8:21 PM
Got it. You'll need to use relations that establish the child projects of workspaces and the child boards of projects to be able to walk the graph "upwards". This means that you will need to write two relationships every time you create a project or board. One to establish it as the child and the other to establish its parent. Here is an example of a schema that achieves this:
definition app/user {}

definition app/workspace {
    relation viewer: app/user
    relation editor: app/user
    permission read = viewer
    permission write = editor

    relation childproject: app/project
    permission guest_read = childproject->guestread
}

definition app/project {
    relation workspace: app/workspace
    relation viewer: app/user
    relation editor: app/user
    permission read = viewer + workspace->read
    permission write = editor + workspace->write

    relation childboard: app/board
    permission guest_read =  childboard->viewer 
}

definition app/board {
    relation project: app/project
    relation viewer: app/user
    relation editor: app/user
    permission read = viewer + project->read
    permission write = editor + project->write
}