Open Closed

Login in any tenant from user assigned in the specified role #1639


User avatar
0
devraj.np@gmail.com created
  • ABP Framework version: v4.3

  • UI type: Angular

  • DB provider: EF Core

  • Tiered (MVC) or Identity Server Separated (Angular): yes / no

  • Exception message and stack trace:

  • Steps to reproduce the issue:"

    Description: I have x role in my project. Any user assigned to that role must be able to login in any tenant. What I need to do to make it possible?


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

    Hi,

    Because the database is tenant isolated, I think you can create the same user in each tenant for users with x role.

  • User Avatar
    0
    devraj.np@gmail.com created

    Hi ,

    I tried adding Users and their Roles from default Tenant into other tenants using Identity User. I found the User but could not set values for Tenant Id before i save user . Code:[ var userToAddInformation = await _userManager.FindByIdAsync(userId); userToAddInformation.TenantId = tenId;]

    Also when I try to save a user from my code i could not set user properties from AppUser as it is designed for get only.So i tried using Volo.Abp.Identity.IdentityUser but still i could not set properties like email, username etc also tried IdentityUserManger CreateAsync but it still doesnot work.

  • User Avatar
    0
    alper created
    Support Team Director

    this is not possible in ABP!

    if you need such a requirement, it means you are on the wrong path. reconsider why you need a user to be logged in tenants. alternatively, you can create the same user with the same credentials in each tenant. but the architectural design doesn't allow sharing data between tenants, because each tenant must be considered as a different instance (setup) of your application.

  • User Avatar
    0
    devraj.np@gmail.com created

    hi, alternatively, you can create the same user with the same credentials in each tenant. yes we wanna do this because.. we have business requirement of some role users from host will have to provide services to other tenant. They want some of their user to login into any tenant with their same credentials. I'm trying to add the same user with same credentials for all tenants . but i cannot access these properties like tenantid, username, normalized username etc .

  • User Avatar
    0
    alper created
    Support Team Director

    the hacky way is disabling IMultiTenant data filter to access data btw different tenants. see https://docs.abp.io/en/abp/4.4/Data-Filtering#imultitenant

    but this is possible if all your tenants share the same DB.

    if you change the tenant explained in the following doc, ABP Framework will set the TenantId https://docs.abp.io/en/abp/4.4/Multi-Tenancy#change-the-current-tenant

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 18, 2024, 05:54