在 MVC 中扩展 ASP.NET 角色提供程序
我想知道这是否可以做到,以及是否有地方可以为我指明正确的方向。
基本上,目前,我正在使用 asp.net 的内置角色提供程序,在我的控制器操作上,我使用自定义属性过滤器,如下所述 这里。
但是我想做的是进一步扩展它来做类似的事情这:
管理员-查看、编辑、删除
管理器 - 查看、编辑
基本上是细化权限。我在网上搜索过,但如果不编写自己的身份验证/授权提供程序,似乎找不到任何方法来做到这一点:(
任何帮助将不胜感激!!
干杯, 缺口
I want know if this can be done and if there is somewhere that you can point me in the right direction.
Basically, at the moment, i am using the built in Role Provider for asp.net, on my controller actions, i use a custom attribute filter as described here.
But what i would like to do is extend it even further to do something like this:
Admin - View, Edit, Delete
Manager - View, Edit
So basically, granular permissions. I have searched around on the net, but can't seem to find any way of doing this without writing my own authentication/authorisation providers :(
Any help would be greatly appreciated!!
Cheers,
Nick
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有几种方法可以解决这个问题。最简单(但不一定是最好)的方法是使用导航元素、查看/编辑/删除以及每个链接周围的 if 语句检查当前用户角色的部分视图。
或者,在频谱的另一端是一个名为 AzMan 的东西(Microsoft 的授权管理器),它允许您创建非常精细的角色和基于任务的授权。
AzMan 已经存在很长时间了,但据我所知,它现在已合并到 MS 的企业库中。
There are several ways to tackle this. The easiest (but not necessarily best) way is to have partial views with the navigation elements, view/edit/delete and if statements surrounding each link checking the currebt User's role.
Alternatively, at the other end of the spectrum is something called AzMan (Microsoft's Authorisation Manager) which allows you to create very granular role and task-based authorizations.
AzMan been around for ages but as far as I know it is now incorporated into MS's enterprise library.