自定义角色会员提供商
我们正在尝试为我们的网络应用程序实现自定义角色成员资格提供程序。对于授权,我们想要检查登录用户的另一个字段,例如 Facilityid 以及他所拥有的角色。例如。我的用户 1 具有角色 1 和设施 1 可以访问某些选项,而设施 2 的相同用户角色具有不同的选项。那么有没有一种方法可以扩展现有的角色/配置文件提供程序,以使用此附加字段以及分配的角色来授权用户。
We are trying to implement Custom Role membership provider for our web app. For authorization we want to check for one more field like Facilityid for the logged on user along with role he has. eg. my User1 having Role1 with Facility1 can access some option and same user role for Facility2 have different option. So is there a way we can extend the existing role/profile provider to authorize user with this additional field along with role assigned.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据您期望的复杂程度,您可能只想让 Facility1 和 Facility2 作为角色,即使它们可能有很多相同的方面。通过这种方式,您不需要扩展成员资格提供程序。
Depending on how complicated you expect this to be you might want to just have Facility1 and Facility2 be roles, even though they may share a lot of the same aspects. In this manner, you should not need to extend the membership provider.
可以有 n 个设施,因此拥有这么多角色看起来并不可行。如果我们能找到一种方法,可以将 Facilityid 从应用程序传递到此安全模块 roleprovider,并仅为该设施的用户获取适当的角色。
There can be n facilities so having those many roles does not look fesiable. If we can find a way by which we can pass the Facilityid from the application to this security module roleprovider and fetch appropriate role for user only for that facility.