ASP.NET 成员资格中用户之间的关联
我想在我的应用程序中的用户之间创建关联。例如,有一个项目总监(角色:PD),它有许多住院医师(角色:住院医师),同样,每个 PD 都有一个 APD(角色:助理项目总监)。
对于每个 PD,我只想向他显示属于他的那些居民,即我想按给定的 PD 过滤居民。我可以按居民角色过滤用户(通过使用 GetAllUsers() 和 GetUsersInRole() 方法的组合),但我似乎无法按项目主管过滤居民,因为我无法在两种角色类型之间建立关联会员表。
我该怎么做才能拥有这种功能?我是否需要扩展角色提供程序来处理此问题?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这听起来更像是对象之间的数据关系,而不是规则提供者的扩展。角色基本上是用户类型的分组,而不是实际用户。
我将使用一个附加表来定义 PD 与其居民之间的关系,并使用角色来设计管理页面,例如显示角色 PD 中的所有用户,并在下面显示要分配的角色 Resident 中的所有用户
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
我认为您并不是真的想在角色之间创建关联,而是在用户之间创建关联(即 PD 用户将有许多常驻用户,但 PD 角色不会有许多常驻角色)。
我不认为有内置的方法可以做到这一点,但是设置您自己的数据库表来保存用户之间的关系应该不会太难。
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.