User by Company - Asp.net Identity

1

I'd like some help with Identity please. Home Here the user registration is by Branch, I customized the ApplicationUser by putting the field FilialID and the field in the AspNetUsers table, but now at the time of login it would have to be verified username , password and branch because I have, for example, user "eduardo" at branch "01" and user "eduardo" at branch "02". Home The Branch I get by parameter in querystring , and the login screen continues only with the UserName and Password fields. Can you do that? Where do I start? Thanks in advance for your help.

    
asked by anonymous 20.07.2015 / 14:38

2 answers

0

Login must be done with unique users. This is usually, but especially if you are using Asp.net Identity .

There can not be two users ' Eduardo '. Even if they are in different branches.

Users should be ' Eduardo1 ' and ' eduardo.Souza ', for example. Or maybe use the email. Anyway, they must be different. And that's good! Imagine if you stayed the way you wanted, and sometime one of the Edwardians would move to the branch where the other one is! You would have two users in the same branch with the same name.

Regarding the access differentiated 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.

    
20.07.2015 / 16:24
0

Regarding the model, everything is fine now, but what if you need changes, like, now a user controls two branches !? you may have problems with that. What you can do is to 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
...
    
24.11.2017 / 18:59