每个表的 DynamicData 自定义角色/安全性
我有一个动态数据 ASP.NET 应用程序,需要为某些用户提供表 X、Y 和 Z,而其他用户只需提供 X 和 Z。所有这 3 个表都使用标准的 ListDetails 页面模板,我们确实希望避免创建x、y 和 z 的自定义页面。 处理这种安全性的最佳方法是什么?
我们所有的权限都存储在具有布尔属性的客户用户类中。 因此,在此示例中,我们有 CanViewX、CanViewY 和 CanViewZ。
我们不想将表名硬编码到代码中。
编辑
我突然意识到,现在可能需要更多的解释,因为它有赏金...我们正在使用 DynamicData 框架,我们希望避免为列表、列表详细信息、编辑等创建客户页面将在站点中访问的每个不同的表。 我们有特殊要求,可以防止一个用户触摸表 A,但他们可以触摸 B 和 C。而其他用户可能只能触摸 A 和 B。
我们正在寻找一种建议和解决方案,以了解如何处理此问题而无需必须在代码中的任何位置对表名称进行硬编码。
I have a dynamic data ASP.NET application with a requirement to give some users tables X, Y, and Z and others only X and Z. All 3 of these tables are using the standard ListDetails page templates, and we really want to avoid creating custom pages for x, y, and z. What is the best way to handle this security?
All of our permissions are stored in a customer user class with boolean properties. So in this example, we have CanViewX, CanViewY, and CanViewZ.
We do not want to hard code the table name into the code.
EDIT
It dawned on me that this may have needed a little more explanation now that it has a bounty on it... We are using the DynamicData framework and we would like to avoid creating customer pages for the list, listdetails, edit, etc. for each of the different tables that will be accessible in the site. We have special requirements that would prevent one user from touching table A, but they can touch B, and C. While other users may only be able to touch A and B.
We are looking for a recommendation and solution on how to handle this without having to hardcode the table names anywhere in our code.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您是否尝试按照此项目中的步骤操作:
http://csharpbits.notaclue.net/2008/05/introduction-this-project-is-going-to.html
希望有所帮助。
Have you tried following the steps in this project:
http://csharpbits.notaclue.net/2008/05/introduction-this-project-is-going-to.html
Hope that helps.
C#:
C#:
除了前面提到的我的博客文章之外,您还可以查看保护动态数据示例在使用路由处理程序的 codeplex 上。
As well as the article from my blog mentioned earlier you could also look at the Securing Dynamic Data sample on codeplex which uses a Route Handler.
我想提一下,在新的 Dyanmic Data Preview 3 中,有一个新功能 DomainService,它支持基于角色的安全性,请参阅来自 MIX09 的 David Ebbo 的 Serssion Microsoft ASP.NET 4.0 数据访问:Web 表单 MIX09-T47F 的成功模式
I would like to mention that in the new Dyanmic Data Preview 3 there is a new feature DomainService which supports Roles based security please see David Ebbo's Serssion from MIX09 here Microsoft ASP.NET 4.0 Data Access: Patterns for Success with Web Forms MIX09-T47F