权限设计模式 [英] Design pattern for permissions

查看:133
本文介绍了权限设计模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我将开发一个将处理权限的Web应用程序,
这意味着该站点中有一个拥有所有权限的管理员,一个具有某些权限的未注册用户,重新注册的用户,等等..
我的问题是与情况相对应的设计模式是什么?
谢谢.

Hi,
I''m going to develop a web application that will take care of permissions,
it means that there is an administrator that have all permissions in the site, an unregisterd user that have some permissions, retgisterd user and so on..
My question is what is the design pattern that corresponding to the situation??
Thank you.

推荐答案

您可以使用角色角色"模式对此进行建模.您可以在此处找到更多信息 [
You can potentially model this with the Actor Role pattern. You can find more information here[^].


Pete为您提供了一种可靠的分析方法-使用它.

我只会给你一个主意,但是它应该可以帮助您避免一个常见的谬误.
这是谬论:人们往往从发明他们所设想的角色开始这种设计:管理员,工程师,经理,操作员……您已经开始,看起来像这样.

不要做!这些具体角色将来可能会使用,也可能不会使用.它们应该比这更灵活.

从您的应用程序功能开始-它们是最稳定的,因为它们反映了您的应用程序所针对的特定于应用程序的功能.确定或多或少的独立小组活动,因此,与小组一起开展一项活动就不可能没有另一项活动.该角色将是演员到活动组的子集上的映射.

请注意,您甚至不必创建角色-您的客户可以根据其组织结构来做到这一点.给他们一个元数据工具来创建它们!他们将很有趣,可以单击活动并将其添加到要创建的角色中.对您来说,这将很容易;而且您将避免人为的决定.

祝你好运,
—SA
Pete offers you a robust analysis method — use it.

I will give you only one idea, but it should help you to avoid one common fallacy.
Here is the fallacy: people tend to start this designs from inventing the roles they envision: administrator, engineer, manager, operator… You already started, it looks like.

Don''t do it! These concrete roles may or may not be used in future. They should be more flexible than that.

Start with your application functions — they are the most stable as they reflect your application-specific functionality your application is centered around. Identify more or less independent groups activities, so withing the group one activity is impossible without the other one. The role would be a mapping of an actor onto a subset of the groups of activity.

Note, you don''t even have to create the roles — your customer can do it based on the structure of their organization. Give them a meta-data tool to create them! They will have fun clicking the activities and adding them to the role they want to invent. For you it will be easy enough; and you will avoid artificial decisions.

Good luck,
—SA


这篇关于权限设计模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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