如何使用 ASP.NET 角色处理成员级别

发布于 2024-10-24 20:51:02 字数 189 浏览 6 评论 0原文

我正在建立一个基于订阅的网站,目前有三个订阅级别,即马匹、足球以及马匹和足球。我正在考虑实现基于标准角色的授权,其中“马”订阅者将获得角色,包括使用“马”部分等的角色。

我是否应该使用标准角色提供程序,并且当成员订阅该网站时,为其订阅分配角色他,或者使用分层角色提供程序,当询问成员的角色时,只有然后使用该成员的订阅级别来“计算”该成员的一组角色。

I am building a subscription based web site, which currently has three subscription levels, i.e. Horses, Soccer, and Horses and Soccer. I was thinking of implementing standard role based authorization, where a Horses subscriber would get roles including those to use the Horses section, etc.

Should I use a standard role provider, and when a member subscribes to the site, assign roles for his subscription to him, or use a hierarchical role provider, that when asked for the roles for a member, only then uses the member's subscription level to 'calculate' a set of roles for the member.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

尘世孤行 2024-10-31 20:51:02

与方法 2 相比,方法 1 更具控制性和确定性。

这取决于您拥有多少个“公共”区域。如果有手动公共区域并且角色仅适用于选定的少数内容,我会选择选项 2,否则选项1.

Approach 1 is more controlled and deterministic as opposed to approach 2.

It will depend on how many 'public' areas you have.. If there are manu public areas and roles apply only to chosen few content, I would go with option 2 otherwise option 1.

梦里的微风 2024-10-31 20:51:02

似乎是 aspnet 角色,并且分配角色对我来说似乎是一个很好的解决方案,需要最少的代码

Seems to be aspnet roles and assing the roles seems like a good solution to me that requires minimal amount of code

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文