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

alsyia

03/11/2024, 4:37 PM
Hey everyone! I'm new to SpiceDB and currently trying some toy modelling. I have teams belonging to an organization, with roles on both, and I basically want permissions on the org to be inherited on the teams. This is wht I came up with:
Copy code
definition Organization {
    relation admin: User | Team#member
    relation contributor: User | Team#member
    relation viewer: User | Team#member

    permission view = viewer + contributor + admin
    permission edit = admin
    permission delete = admin
}

definition Team {
    relation organization: Organization
    relation team: Team
    relation member: User

    relation viewer: User | Team#member
    relation admin: User | Team#member

    permission view = viewer + admin + organization->viewer + organization->admin
    permission edit = admin + organization->admin
    permission delete = admin + organization->admin
}
Is there a shorter/cleaner way? Having to repeat the
organization->admin
part for every permission for example is a bit cumbersome 🤔