Hello, I am messing around with the
# spicedb
s
Hello, I am messing around with the playground a bit, so this is what I have in the schema.
Copy code
definition user {}

definition group {
    relation member: user
}

definition service {
    relation viewer: group#member
    relation editor: group#member
    relation admin: group#member

    permission view = viewer
    permission edit = editor
    permission delete = admin
}
And I define group members within the relationships. The question I have is how would I make a relationship that one team will inherit members of another team and have its own. I assume I would need to define something like a parent in the schema, but I am pretty new to spiceDB so any sort of help would be appreciated. Meaning that as you can see I have 3 groups one for each, viewer, editor and admins, I would like the admins to also automatically be members of the editor and viewer teams as well as their admin team.
v
There is two different aspects to what you are doing here: - nested group-membership - permission inheritance / reuse The former can be achieved like this: https://play.authzed.com/s/nHXNGWx9qYs_7/schema Essentially you create a parent to child relation, and then you recurse in the permission to all the parent teams members. To make an admin have delete, but also edit and view you don't need nested groups necessarily. You'd do it by composing permissions:
Copy code
definition user {}

definition group {
    relation member: user
}

definition service {
    relation viewer: group#member
    relation editor: group#member
    relation admin: group#member

    permission view = viewer + edit
    permission edit = editor + delete
    permission delete = admin
}
This is a very common pattern in SpiceDB Schema language. It gives you: - admins, editors and viewers can view - editors and admins can edit - admins can delete
s
The idea is for a different example, but used this simplified version to explain my problem, the former is the thing I was looking for, thank you very much!
5 Views