简体   繁体   中英

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

  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. These polices are then applied at run time.

for more information visit http://msdn.microsoft.com/en-us/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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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