User by Company - Asp.net Identity

Asked

Viewed 100 times

1

I’d like some help with the Identity please.
Here the user registration is by Affiliate, I made the customization of Applicationuser fielding Filialid and the field in the table Aspnetusers, everything working perfect, but now at login time would have to be checked username, password and affiliate because I have, for example, user "Eduardo" in branch "01" and user "Eduardo" in branch "02".
The Branch I pick by parameter on querystring, and the login screen continues only with the fields Username and Password. Is there a way to do this? Where do I start? Thanks for the help.

  • You could put examples of your code so we can improve the answers?

2 answers

0

Login needs to be done with unique users. This is as a rule, but especially if you are using Asp.net Identity.

There can be two users 'Eduardo'. Even if they’re in different branches.

Users should be 'Eduardo1' and 'Eduardo. Souza', for example. Or maybe use email. Anyway, they should be different. And that’s a good thing! Imagine if it turned out the way you wanted it to, and at some point one of the Eduardos move to the branch where the other one is! You would have two users in the same branch, with the same name.


With regard to differentiated access by the branch, all right. Your system knows which branch each user belongs to, and can use this to control access/display the appropriate options.

0

As for the model, it’s okay now, but what if you need changes, like, now a user controls two branches!? You might have problems with that. What you can do is keep the Aspnetusers table as is and create a Branch Table, with the relationship pointing to that of users.

//Tabela AspNetUser
Id
Username
Email
EmailConfirmed
...

//Tabela Filiais
FilialID
UsuarioAspNetID
FilialNome
...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.