Hey guys, I'm new here and got a question! We've modeled our access management logic and figured out that SpiceDb might be the right thing to use, but we struggle with achieving some stuff. We've had already a few schemas, so that we know it's possible to get it right, but we lack some idea how to manage few things.
The idea: We are building multi-tenancy solution for Users. User has default Tenant, but can also be invited to other Tenants. There are Modules, to whom each Tenant may have access, and some not. Those Modules have a different roles, specific for each Module. User can have a Role assigned at some Module, but for a single Tenant (i.e. User's default/main Tenant is 'CitiBank', but can be guest at 'BCG', 'CitiBank' and 'BCG' both have access to Module 'Payments', but the User has access in CitiBank at role 'Operator' but at 'BCG' is in role of 'Auditor'). But can't access it if the Tenant does not have access to Module, so these two rules + role need to be set.
The goal: We want to have a single-source-of-true, so we also want to be able to query SpiceDb to get the list of the Tenants, Modules assigned to Tenant, Levels for each Module, Users assgined to Tenant (default and guest), and also for each User be able to define what are the User Roles are set for each Module.
To give you better picture, we've created diagram describing the relationships. We have a few schemas already created, that lack some of the business requirements so far, so I would like ask you guys if you have idea how to manage that in a proper conventional way, so we can easily call the spicedb to retrieve all of the data, by setting right relationships and permissions.
Many thanks for your input!
https://cdn.discordapp.com/attachments/844600078948630559/1285887685449220136/lhu_authz.png?ex=66ebe7ba&is=66ea963a&hm=e388ca7579562afe527288d02d51bad282468294b4626fd7aeed054e3c41fb28&