Open Closed

Need Advice on Multi-Tenancy Use Case (Users separate from Tenants) #6136


User avatar
0
theChrisMarsh created

We are looking for APB's advice on our software use case. Specifically the Host versus Tenant architecture.

We are building a product where a certain kind of user (let's call it a Doctor) has data and a user experience (workflows, UI screens) that is associated with just them, using their own personal "Account". For example, their personal claims, or doctors, or health records. This data and user experience is independent of what the Host user accounts would experience.

We then have an Employer that has their own set of data, and multiple users (that may or may not also be Doctors). The tenant structure makes perfect sense for this set of data and functionality, but (here is the main requirement) a Doctor could be associated with an Employer tenant or could be unassociated with any tenant.

Where we need advice is how to use the ABP framework (host vs tenant) for separating the 3 "products":

  • Host Users for the Host need to be able to access the "Host" application (managing tenants, language strings, audit logs, etc).
  • Doctors need to access a "Doctors" application (updating their personal information, choosing which "Employer" they want to associate themselves with if any, etc).
  • Employer Users need to access a tenant-level "Employer" application (updating their company information, approving which "Doctors" can work within their tenant, etc).

How should we architect this solution? How do we use the tenant and base class concepts for separating these out and creating 3 different "products".


1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Just a simple idea:

    Host Users for the Host need to be able to access the "Host" application (managing tenants, language strings, audit logs, etc).

    This is simple, so skip it.

    Doctors

    A doctor can choose which "Employer", which means It can cross tenants. A doctor can be a host user with doctor role. When doctors choose an employer(tenant), create a copy of the user for the doctor in the tenant, and their information should be synchronized.

    • Expand user entity to add employer ID (Tenant ID)
    ObjectExtensionManager.Instance.Modules()
    .ConfigureIdentity(identity =>
    {
      identity.ConfigureUser(user =>
      {
          user.AddOrUpdateProperty<string>( //property type: string
              "EmployerId", //property name
              property =>
              {
                  property.UI.OnCreateForm.IsVisible = false;
                  property.UI.OnEditForm.IsVisible = false;
              }
          );
      });
    });
    

    Employer

    Employer is a tenant.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 26, 2024, 06:07