Base solution for your next web application
Open Closed

Add one more property to the login #9505


User avatar
0
lweng567 created

Hi, with my application requirment, a tenant may have one more branches, i will need user to input whcih branch under a tenant during authentication. so how should i go about it by adding a branch name in login screen and also supporting third-party connecting to the api thanks Laurie


8 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi

    • What is your product version?
    • What is your product type (Angular or MVC)?
    • What is product framework type (.net framework or .net core)?
  • User Avatar
    0
    lweng567 created

    our product version is V9.1.0 latest Product type is Angular and asp.net core

  • User Avatar
    0
    maliming created
    Support Team

    hi

    I think you can add new property by changing TenantChangeComponent and pass it to the application backend.

    src/account/shared/tenant-change.component.ts

  • User Avatar
    0
    lweng567 created

    Alternativiely, i was thinking setting up each branch as a tenant. If i do that, how can i grant access to some supper user who have access to more than one tenants? Does Zero support such a relationship, ie, one user has more than one Tenant?

    thanks

  • User Avatar
    0
    maliming created
    Support Team

    hi

    You can use the User Impersonation feature.

    https://docs.aspnetzero.com/en/aspnet-core-angular/latest/Features-Angular-User-Management#user-impersonation

  • User Avatar
    0
    lweng567 created

    i dont think User Impersonation will meet my requirement. With my requirement, if my business has two regions, each region will be set up as a tenant, and each region will have its user groups, but as a CEO, he needs to have access to these two regions, i would prefer not to set up my CEO with two user login (one for each region). For these scenario, how to set him up so that he can have acccess to both Tenants, and he can select which tenant to login? THanks Laurie

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi **@lweng567 **

    I think, setting up a tenant for each branch is not a good approach. It will bring other problems like showing data from multiple branches to same user.

    I suggest you to define a Branch entity, assign users to Branches and when a user logins, allow user to select a branch if user has more than 1 branch. Then, you can store selected BranchId in the session (see https://aspnetboilerplate.com/Pages/Documents/Articles\How-To\add-custom-session-field-aspnet-core) and filter necessary data by creating a Branch data filter (see https://aspnetboilerplate.com/Pages/Documents/Articles\How-To\add-custom-data-filter-ef-core)

  • User Avatar
    0
    lweng567 created

    that looks like what i need. Thanks