简体   繁体   English

如何在asp.net成员资格中设置嵌套角色

[英]How to set nested roles in asp.net Membership

I want to set some of the permission for the particular depending of Role of current user. 我想根据当前用户的角色来设置一些特定权限。 For example: I have to role 3 roles let it be 例如:我必须扮演3个角色

  1. Super Admin 超级管理员
  2. Admin 管理员
  3. Supervisor 主管

If I set permission for supervisor, super admin and admin should automatically get the permission. 如果我为主管设置了权限,则超级管理员和管理员应自动获得该权限。 If I set for Admin then super admin should get permission but supervisor should not able to access those pages. 如果我设置为管理员,那么超级管理员应获得许可,但主管不应访问那些页面。

Please help with the solution 请协助解决

NOTE: I don't want to give multiple role to particular user 注意:我不想给特定用户多个角色

There is very effective solution by using "Authorization Manager". 使用“授权管理器”有一个非常有效的解决方案。

It provides a flexible framework for integrating role-based access control into applications. 它提供了一个灵活的框架,用于将基于角色的访问控制集成到应用程序中。 It enables administrators who use those applications to provide access through assigned user roles that relate to job functions. 它使使用这些应用程序的管理员可以通过与工作功能相关的分配用户角色来提供访问权限。

Authorization Manager applications store authorization policy in the form of authorization stores that are stored in Active Directory Domain Services (AD DS), Active Directory Lightweight Directory Services (AD LDS), XML files, or Microsoft SQL Server databases. 授权管理器应用程序以授权存储的形式存储授权策略,该授权存储存储在Active Directory域服务(AD DS),Active Directory轻型目录服务(AD LDS),XML文件或Microsoft SQL Server数据库中。 These polices are then applied at run time. 然后在运行时应用这些策略。

for more information visit http://msdn.microsoft.com/en-us/library/bb897401.aspx 有关更多信息,请访问http://msdn.microsoft.com/zh-cn/library/bb897401.aspx

I don't want to give multiple role to particular user. 我不想给特定用户多个角色。

You should be able to assign multiple roles to users; 您应该能够为用户分配多个角色。 it is how the role base authorization supposed to be. 这就是角色库授权应该是的方式。 A role's authentication should not depend on other roles. 角色的身份验证不应依赖于其他角色。

Please do not implement hierarchy role to role based authentication. 请不要实现基于角色的身份验证的层次结构角色。

It is not a good design practice. 这不是一个好的设计实践。 If you do not careful, they will become circular dependency, and they are very hard to debug. 如果不注意,它们将成为循环依赖项,并且很难调试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM