I’m in the process of determining an approach for design. I would like your inputs
I have 2 types of users
- Corporate Internal Users
- Customer Users
The fundamental differences between them technically is
- Corporate: Don’t need to save passwords in the system but only roles (authentication against AD)
- Customer Users:Save password in the system and have an associated customer ID.
I have a table User which have the columns like so
User Name
Password
Roles
Customer ID
If I abstract the user creation process using an abstract factory pattern, I get the 2 types of user objects.
Now when it comes to creating a repository, how do I handle it? Do I create 2 different repositories to handle individual user type objects (mapping to same table)
Can corporate users also be customers? If so, would you expect them to use the same ID? If so, you might want to look at implementing the Party-Role pattern (aka Actor-Participant).
It would allow you a unified solution for handling both internal user roles and corporate vs. customer distinction.
hth.