Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Tenant-free User #9687


User avatar
0
kasem created

Prerequisites

  • What is your product version? 9.1
  • What is your product type (Angular or MVC)? Angular
  • What is product framework type (.net framework or .net core)? .net core

Hi,

I need your help to make the User a global entity (tenant unrelated). I still need multi-tenancy supported, but not for user (Users table). User needs to be without TenantId or at least disable user tenantId data filter (IMayHaveTenant) but also make username and email globally unique across tenants. Permissions should continue working tenant based and since you have TenantId in AbpRoles and AbpPermission I assume it should work with the desired change.

To better describe the problem, I need the same user/account (record) to exist in multiple tenants with different roles (not through linked accounts, but through AbpUserRoles). For example:

| UserId | TenantId | RoleId | | --- | --- | --- | | 1 | 1 | 1 | | 1 | 2 | 2 | | 1 | 2 | 3 |

I don't want the authentication to be affected by the current user tenant, selected through login, but rather make it a global authentication.

One of the solutions I thought about is having all users signin and signup in the Default tenant (statically set this) no matter in what tenant your session exists and also remove MayHaveTenant from User. Please let me know if this is applicable and how I can achieve the needed.

Thank you


3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @kasem

    This is not supported. Removing multi tenancy from User entity will cause many unpredictable problems as well. I think it is better to duplicate user records for all tenants.

    If you can explain your use case in detials, we may offer you a better solution.

  • User Avatar
    0
    kasem created

    Hi @ismcagdas

    Thank you for your feedback. I understand. I'll try to play with since it's the business requirements. How can I change your current implementation to validate a unique email and username across tenants?

    Regards Kasem

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @kasem

    In the user creation (you can override UserManager's CreateAsync method) you can cehck AbpUserAccounts table which contains all users across all tenants.