简体   繁体   English

Asp.net会员权限和角色

[英]Asp.net membership permissions and roles

I am new to the ASP.NET membership interface. 我是ASP.NET成员资格界面的新手。

I understand how the User and Roles work with each other, but i cant seem to understand how to connect between the roles and the permissions. 我理解用户和角色如何相互协作,但我似乎无法理解如何在角色和权限之间建立联系。

The Membership and the Roles auto creates tables in my db, but I don't see any reference to the permissions aspect. 成员资格和角色自动在我的数据库中创建表,但我没有看到任何对权限方面的引用。

Any ideas? 有任何想法吗?

ASP.NET Membership works on the aspect that your application will provide checks for the roles that a user currently belongs to and handle the processing of permissions from there. ASP.NET Membership适用于您的应用程序将检查用户当前所属角色并从中处理权限处理的方面。

Simply put, in your application code, you will have to insert something similar to handle verifying a user has permission to a function: 简单地说,在您的应用程序代码中,您将必须插入类似于处理验证用户具有函数权限的句柄:

if (Roles.IsUserInRole("RoleName")) {
    // Do something here
}

This essentially creates the premise of permissions, when a user is assigned a Role, they then can perform actions based on what the system allows them to in which the role(s) they belong to grants them the ability to do so. 这实际上创建了权限的前提,当为用户分配角色时,他们可以根据系统允许的角色执行操作,其中所属的角色授予他们这样做的能力。

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

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