I have a requirement, as per the diagram in the attachment.
Im going to have a multi-tenant application. My application does have following roles.
Super Admin - Admin of all tenants. Account Manager - Admin of selected tenants Tenant Admin - Admin of a tenant Customers - These users can consume services from different tenant
My requirement is, if a customer has to consume a service from a tenant (tenant 1), he/she must register with the system. If the same customer has to consume a service from another tenant (tenant 2), he/she does not have to register again. He/She should be able to use the same credentials used for the former tenant to the latter tenant too. May I know, how can this be achieved?
4 Answer(s)
-
0
Hi @Mahinthan
Instead of using User entity, It would be better for you to create and use a new entity for your use case. Because Users must be Tenant specific and can't access another tenant's data directly. There is a linked accounts feature which you can link one user to another and they can easily switch between those accounts but I'm not sure if it will work for you or not.
-
0
Thanks @ismcagdas for the idea,
Alternatively, is it possible to dedicate one tenant (tenant X) to store all users and if they try to login to tenant 1, the authentication to be executed against tenant X. It means, whenever a user registers to tenant 1, the user is created in tenant X.
Looking forward your advise
-
0
This is something I have also asked for. The simple ability to have a user in the host with access to certain tenants. It would be a great feature.
-
0
Hi @Mahinthan
You can do that. You can register to User creation event (see https://aspnetboilerplate.com/Pages/Documents/EventBus-Domain-Events) and you can check the TenantId of the created user. If the TenantId is equal to "Tenant X", you can create another user using the same information but with the different TenantId.
However, you have to handle User edit and delete events as well and it might be hard to manage.