I have been asked to develop a multitenant application where, Company/Users can log in, a user can belong to a company, but I has been asked specifically that they don't want to be inviting users to their company manually because they think it's a lot of work, but they also want to avoid exposing other companies when a user creates an account.

For example:

  • Company 1

  • Company 2

If I create a user that belongs to "Company 1" there is no way I should be able to know Company 2 even exists.

How can I do this?, because I can't use a dropdown/search/string field because that would expose Company 2

I don't know if you guys understand what I meant before, I mean, what I want to know is if there's a way that I can know at the time of registering an account that user belongs to Company 1 without showing Company 2

  • Robert Harvey answered your question based on the idea that a company's administrator will register users. But it sounds like you may be assuming a user will self-register. What is the correct assumption? Who do you expect to register users? – joshp Jan 22 '18 at 1:54
  • If I create a user that belongs to "Company 1" there is no way I should be able to know Company 2 even exists. How can I do this? Asking the user to introduce the company keyword or organization id or whatever you provide the company to identify it within your system. A token for example. – Laiv Jan 22 '18 at 8:18
  • @joshp: It doesn't have to be an administrator, it just has to be a user with "register new users" permission. In the absence of a dropdown to choose the correct company, someone from the company in question must initiate the transaction. – Robert Harvey Jan 22 '18 at 22:23
  • @RobertHarvey Does OP say a privileged user does the registration? It's practical assumption you make. But when I read the question, some parts make me think he has a different assumption. He says "they don't want to be inviting users" and "exposing other companies when a user creates an account". Does the word user refer to the same person in both of those phrases in one very long sentence? That would be self-registration. And in that case the answer would be different. More like Laiv's comment about the token. – joshp Jan 23 '18 at 1:24
  • @joshp: Not sure what you are getting at, but if the user cannot be given the opportunity to identify the company to which he registers, then someone else must do it. – Robert Harvey Jan 23 '18 at 2:54

In a multi-tenant application, an administrator can only see data from the company that he administrates, and no others. This is possible because the ID of the company to which the administrator belongs is stored in the administrator's profile. You therefore already know which company he belongs to, and you can filter any data coming into the application so that only that particular company's information is displayed.

When the administrator (or any user that has the "register new users" role) registers the new user, simply set the company id in the new user to the company id assigned to the administrator user.

Some multi-tenant applications add an additional role called "super-admin." This role can see data from all companies.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.