Replies: 3 comments 1 reply
-
@dgg what you present is a recurring use-case for SpiceDB, and is something similar to our GCP Cloud IAM example, which should cover your requirements. This example shows how to model a schema that supports creating roles with specific permissions in runtime. If you don't need runtime-defined activities/roles, I'd suggest skipping that and modeling the activities in the schema. I assume this is not your case but for the sake of illustrating
To implement "admin has access to all devices" you need to have an entity that connects to all devices. Everything is a graph and the key is to create the relations that connects those.
|
Beta Was this translation helpful? Give feedback.
-
Thanks for getting back to me. |
Beta Was this translation helpful? Give feedback.
-
Well, I gave a fair shot at the IAM example. I really like the idea of SpiceDb, the tooling around it and the APIs... for the very simple examples that I was able to successfully model. There are examples, and they are somehow described (not explained) but I would find more comfortable with recommending SpiceDb if there was more documentation on the modelling topic. The whys, the procedures, the patterns, the pitfalls, ... Without those, I found very difficult to move beyond a simple example. A very good example on the kind of documentation that I am missing would be the training material that MongoDB University offers around data modelling (https://learn.mongodb.com/courses/introduction-to-mongodb-data-modeling). |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
My team is evaluating the future usage of SpiceDb/AuthZed for authorization of the applications hosted in our upcoming platform.
In order to evaluate it, we want to model and run some tests with a schema that we have used in an application. But we are having quite some problems with the modelling side of it that is making us wonder whether this is the right product for us.
The model is (we believe) simple:
A user belongs to one and only one tenant. But can be invited to many other tenants.
Each user is member of a single role in each of the tenants (the single one the belongs to or any of that the user was invited).
Each role can perform multiple activities.
On top of the activities, the user can access some or all (present and future) of certain devices. However, if the user is member of the "admin" role in one of the tenants, it has access to all (present and future) devices as well as the ability to perform all activities.
We started to model the role/perform activity and user/access device to begin with (leaving aside the multi-tenant complication for later).
We came with this model (https://play.authzed.com/s/ZmlkPjNebzgl/schema):
That, alongside these relationships (https://play.authzed.com/s/ZmlkPjNebzgl/relationships)
Allows us to test (https://play.authzed.com/s/ZmlkPjNebzgl/assertions) the access to perform act
activities by role:
And explicit access:
We are not able to model successfully the fact that all user assigned to admin role can access all devices.
We would also like to omit the assignation of the admin role to each and any of the activities if that would be possible (it is a minor annoyance).
We have read blog posts, checked community examples and watched the videos, but we cannot "connect the dots" on how to implement the super-user pattern on the transitive user/role relationship.
Thanks in advance for all the help.
Beta Was this translation helpful? Give feedback.
All reactions