
Question:
I want to create associations between users in my application. For instance there is a Program Director (Role:PD) which has many Residents (Role:Resident), similarly there is an APD (Role: Asistant Program Director) to each PD.
To each PD I want to show him only those Residents which belong to him i.e I want to filter the Residents by the given PD. I can filter the users by Resident role (by using the combination of GetAllUsers() & GetUsersInRole() methods) but I cannot seem to filter the Residents by their Program Directors as there is no way I can make associations between two role types in Membership tables.
What can I do to have this kind of functionality? Do I need to extend the Role Provider to handle this?
Solution:1
This sounds more like a data relation between objects rather than an extension of the rle provider. Roles are basically a grouping of user types rather than actual users.
I would approach this using an additional table to define the relationship between a PD and their Residents, and use the roles to design the administration page, e.g display all users in role PD, and below display all users in role Resident to assign
Solution:2
I think that you don't really want to create associations amongst the roles, but rather associations amongst the users (i.e. a PD user will have many resident users, but a PD role will not have many resident roles).
I don't think that there is a built in way to do this, but setting up your own database table to hold relationships between the users shouldn't be too hard.
Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
EmoticonEmoticon