Web Connection
Multi Tenant with Duplicated Usernames
Gravatar is a globally recognized avatar based on your email address. Multi Tenant with Duplicated Usernames
  Kathy
  All
  Jul 25, 2019 @ 11:59am

Hello Rick,
I would appreciate your idea on this.
We have a multi tenant application on Webconnect and some of our clients are sharing users with the same username(user email address).
We're thinking of using the combination of user name and company code.
But, would you have any better suggestion for this case?
Thank you in advance,
Kathy

Gravatar is a globally recognized avatar based on your email address. re: Multi Tenant with Duplicated Usernames
  Rick Strahl
  Kathy
  Jul 26, 2019 @ 01:21pm

Generally, you should have actual tenant ids that are assigned to a particular user so you know which tenant they belong to in one to many relation. You can do the lookup of the tenant to user when you retrieve the tenant ID and then map that back to the user.

This may not always be possible if the tenants are added later, but I would highly recommend doing that mapping. Using combination keys for these sorts of things always ends up being problematic with large index keys, index inconsistencies and potentially slow lookups of these complex keys. So often it's better to add the Ids and generate them for existing data to match the new data scenario.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Multi Tenant with Duplicated Usernames
  Matt Slay
  Kathy
  Jul 26, 2019 @ 04:36pm

We're thinking of using the combination of user name and company code.

I bet you are already using integer UserIDs as primary keys for each user and storing that in various related tables, which I think is what Rick is saying.

It seems to me your question may have to do with the initial logging in or identifying of a user.... You need to ask the UserEmail and a CompanyCode and (as well as a password, of course). Then you user lookup is by UserEmail and CompanyCode, then verify password, and that will give you the UserID that you need for the remaining work they do during there session.

Is that what you were asking?

This would allow the same UserEmail to have an account for multiple Companies in your DB.

Gravatar is a globally recognized avatar based on your email address. re: Multi Tenant with Duplicated Usernames
  Kathy
  Rick Strahl
  Jul 31, 2019 @ 11:49am

Thank you so much for both advice.
And yes my question was more about the initial logging in and if there's anything built-in.
Thanks again.
Kathy

© 1996-2024