-
Hey there, just evaluating using SpiceDB for a couple of upcoming projects, it looks like a really fantastic tool, congratulations on this implementation. Thank you for open sourcing it! One of the things I'm looking to do is implement RBAC within a couple of apps. This all seems 100% possible with SpiceDB already, but I'm wondering if there's a better way to implement role hierarchy. For example, if a user has the writer relation, I'd like to be able to have them automatically inherit the capabilities of the viewer relation, rather than defining writer against all of the permissions that viewer has access to. For permissions themselves this of course can be implemented using union operations, but would it be possible to do something similar for relations? I think the semantics differ really so I'm not sure what that should look like necessarily. I don't think this would be how to do it, but you should get the idea from this:
In this case, the writer relation would have both the view and write permissions. Honestly, I can see that this might've been something you've already discussed but decided not to do. In cases like the above it looks a little pointless, and in larger cases you could certainly argue that it's not as clear. Either way, it's not a deal breaker for my use-case by any means - it's just something I'd seen in some other systems (e.g. quite a long time ago when I worked with Symfony, the RBAC system there supported role inheritance). |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This is something that Zanzibar supports out of the box, and that we actually supported in our v0 APIs. It is something that we explicitly chose to move away from when we created the schema. You can accomplish what you want by just referencing a computed permission from another permission:
By having a strict separation between permissions (computed) and relations (direct relationships) we get:
consider the schema:
Now:
|
Beta Was this translation helpful? Give feedback.
-
Aha, that's pretty handy there. So the above is saying "if you can write, you are also able to view things"? That's perfect in that case. That all makes sense. I had a feeling it may have been a conscious decision to omit it. Thanks for taking the time to explain why! |
Beta Was this translation helpful? Give feedback.
This is something that Zanzibar supports out of the box, and that we actually supported in our v0 APIs. It is something that we explicitly chose to move away from when we created the schema.
You can accomplish what you want by just referencing a computed permission from another permission:
By having a strict separation between permissions (computed) and relations (direct relationships) we get: