I am working on a system where I have implemented the membership provider to handle accounts.
What I require is a way of having various users say "Admins" create child accounts for their staff. I would guess this is some sort of hierarchy design.
Previously I have done this where the authentication/security of the application has been completely custom so no membership provider involved.
The number of users will be in the hundreds of thousands and I wanted to use the provider because it saves time on developing a custom solution.
Should I use the provider or develop a custom solution to handle this stype of parent/child user data, or extend the provider add extra field say "Creator" and use the ID of whoever created the user in the first place so I can get a list of users whenever the admin logs in using his ID.
Any help appreciated.
Thanks
I'd try to avoid messing with the membership tables. Create a separate UserData
table in the database. This should have the same UserId
primary key as the membership users table, and then contain other custom information. In particular, a ParentId
column. For child users, this can refer to the appropriate administrator, and for administrators it can be set to null
.
In ASP.NET when a user logs in, let the membership system authenticate them and then query the UserData
table to find out additional information (in this case, who their parent user is).