Memflex
Memflex copied to clipboard
Question: solution for multi-tenant project
So I am using memflex but I have a problem, and I was wondering if there are any good ideas around.
I have a multi tenant system where i split the incoming call based on url/domain
This works well, but here is the problem. It is important that no tenant can see other tenants customers which means for all purposes the user needs to be tied to a tenant.
That is still easy, I can simply tie which tenant he/she belongs to from the user entity.
However now I start to run into problems such as if I ask for all users in a role I get system-wide all users for that role not for that one tenant that is active. This is still manageable since I can instantiate all users for the particular role and check if they are part of the current tenant. Definitely not optimal, so any thoughts here would be welcome. And also this is a big issue if my clients system should grow huge so that the total number of customers reach big numbers.
But the real problem lies in that a user is unique in the system and that means if say a user created his account based on his email address he cannot register with two different tenants of mine.
So now I am pondering to simply live with the limitation or if I have to make an insertion into memflex and adding tenant that the user can belong to, thusly allowing the same username with two different tenants. and also GetUsersInRole could take note of which tenant I want.
So is there a smarter way? I am very interessted!