如何在ASP.NET中为角色设置基于事件的授权 [英] How can I set the event based authorization for a role in ASP.NET

查看:61
本文介绍了如何在ASP.NET中为角色设置基于事件的授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的asp.net应用程序中,我需要实现基于事件的授权。例如,在页面添加,编辑和删除按钮就在那里。定义了不同类型的角色。该角色具有查看页面的权限,但在该页面内,用户是否可以添加,删除或编辑记录取决于赋予该角色的权限。例如,有一个名为Auditor的角色,并且只为此角色分配了添加按钮权限。现在,如果具有角色Auditor的用户访问具有添加,编辑和删除按钮的页面,则此用户应该只能添加记录。

简单地说,我想为事件的名称定义按钮,并希望通过分配给角色的权限来控制此事件。

您能否告诉我实现它的最佳方式。



我尝试了什么:



搜索网络但未找到答案

In my asp.net application , I need to implement event based authorization. For example , In a page add,edit and delete buttons are there. There are different types of roles are defined. The role has permission to view the page but inside that page whether user can add or delete or edit the record will depend on the rights given to that role. For example , there is a role with name Auditor and only Add button permission are assigned to this role. Now if a user with role Auditor access a page which has Add,Edit and Delete buttons then this user should be able to Add records only.
Simply , I want to define the name of the event for a button and want to control this event through the permission assigned to a role.
Can you suggest me the best way to achieve it.

What I have tried:

Searched the web but did not find answer

推荐答案

最简单的方法是只显示和启用加载页面时由指定角色的用户执行的按钮。
The simplest way is to show and enable only buttons that can be executed by the user that is in the specified role when the page is loaded.


这篇关于如何在ASP.NET中为角色设置基于事件的授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆