不知不觉已经开始写了,看来只要下定决心,速度还是不赖的嘛。这样看来本人的行动力还行,就是翻译的水平差了点,大家也就将就将就吧,反正大致意思是 不会错的!呵呵!!E文好的牛人们呢,有心的你就直接看原文,有心的你就帮忙改改(有点象走江湖的口吻,有钱的捧个钱场,无钱的捧个人场,^-^)如果您 老实在看不下来,那就自己再译一个,我这也算是间接为文档中文化做出了点贡献,呵呵!
It seems that for large or complex situations, this 'access matrix' approach is clearly unsuitable. We need a better system that maintains the advantages (fine-grain control and a clear idea of who has access to what) but removes the disadvantages (difficult to summarize, and difficult to manage large groups of people at once). One solution is phpGACL.
看来对于大型或复杂的情况来说,采用"权限表"方法明显不适用。我们需要一个更好的系统来继承权限表的优点(精细权限控制及谁能访问什么的清晰思路)同时摒弃它的不足(总结和大规模权限管理的困难)。phpGACL就是这样的系统之一。
phpGACL doesn't describe access from the 'bottom-up' like the Access Matrix above. Instead, it describes it 'top-down', like the textual description of Han's access policy. This is a very flexible system that allows you to manage access in large groups, it neatly summarizes the access policy, and it's easy to see who has access to what.
phpGACL并不象上面"权限表"那样采用"自底向上"的方式来描述权限,相反,它采取"由顶向下"来描述权限,象Han所说那段话所表现的权限策略那样。这是一个十分灵活的系统允许你去管理大量的权限,它能简明扼要地总结权限策略而且更容易看清是谁有权访问什么。
An ARO tree defines a hierarchy of Groups and AROs (things that request access). This is very similar to a tree view of folders and files. The 'folders' are the Groups and the 'files' are AROs.
ARO树定义ARO对象(要求访问权限的事物)和组的等级关系,它同文件目录树非常相似,其中的组就相当于文件夹而ARO对象则相当于文件。
Let's make an ACL tree for the people on Han's ship. First we define some categories for the people. It's clear that Han and Chewie run the ship, and the rest of them are just passengers:
让我们为Han的船上的人建立一个ACL树。首先我们先把人分成几类,可以很清楚地知道Han和Chewi是开船的,其他人则是乘客:
phpGACL
Millennium Falcon Passengers(千年隼号乘客) Group(组)
├─Crew(船 员) Group(组)
│ ├─Han ARO
│ └─Chewie ARO
└─Passengers (乘客) Group(组)
├─Obi-wan ARO
├─Luke ARO
├─R2D2 ARO
└─C3PO ARO
This tree by itself doesn't specify any access policy; it just shows how we're grouping the people who might request access (AROs).
Millennium Falcon Passengers(千年隼号乘客)
├─Crew (船员) [ALLOW: ALL(允许:全部)]
│ ├─Han
│ └─Chewie
└─Passengers (乘客) [ALLOW: Lounge(允许:休息室)]
├─Obi-wan
├─Luke
├─R2D2
└─C3PO
Firstly, the default policy is always to deny access. Permissions have been overridden for the "Crew", so they have access to everywhere ("ALL" is a synonym for all rooms: "Cockpit, Lounge, Guns, Engines"). The "Passengers" have access only to the Lounge.
首先,缺省的策略总是拒绝任何访问权限的。许可对于船员来说是无效的,因此他们拥有去任何房间的权限("ALL"权限对所有房间都一样,如驾驶室,休息室,武器室和发动机室)。而乘客则只有到休息室的权限。
Oops! What about Chewie? By grouping him in "Crew", Han has indirectly given him access to the Engines! He doesn't want that after what Chewie recently did to the hyperdrive, so he adds a rule to disallow this:
哎呀!Chewie怎么办呢?他被分入了"船员"组,Han已经间接地给了他到发动机室的权限了!但这并不是他所想的,因此他增加了一条规则来禁止这个权限:
Groups can be extended to any level in the ARO tree. For example, you could add a Group "Jedi" to "Passengers". Most passengers would be categorized under "Passengers", but Luke and Obi-wan would be under "Jedi" and therefore might be extended extra privileges (like access to the Cockpit):
组可以扩展到ARO树中的任何一个层次。例如,你可以增加"绝地战士"组到"乘客"组中,大多数乘客将被分到"乘客"组下,但Luke和Obi-wan将被分到"绝地战士"组下,因此他们也就扩展了其他额外的权利(如可以到驾驶室)
When the ship's computer (running phpGACL of course) checks access, the only question it can ask itself is "Does person X have access to room Y?" In phpGACL terms, this is rephrased as "Does ARO 'X' have access to ACO 'Y'?"
当飞船上的计算机(当然运行是的phpGACL了)检查权限时,它只需要问自己这样一个问题:"X人有权进入Y房间吗?"用phpGACL的说法就是"ARO对象X有权访问ACO对象Y吗?"
phpGACL determines whether a specific person has access to a specific room by working from the top of the ARO tree towards the specified person, noting explicit access controls for that place along the way. When it reaches that person, it uses the last explicit access control it encountered as the result to return. In this way, you can define access controls for groups of people, but over-ride them further down the tree if you need to.
phpGACL通过从ARO树的顶部向下遍历的方式,直到找到那个人,明确其访问控制权限来确定该人是否有权访问指定房间。当它找到那个人时,它将它最终遇到的访问控制权限作为结果返回。通过这种方式,你能够为人们所属的组定义访问控制权限,但也可以在你需要时在树的下一层次覆写它们。
Set the default result, "DENY".
设置缺省结果,"拒绝"
Work out a path to Luke:
遍历ARO树以找到Luke
Start at the top of the tree and move towards Luke: The "Millennium Falcon Passengers" node doesn't say anything about any room, so do nothing here.
从ARO树顶开始遍历到Luke:"千年隼号乘客"节点没有定义任何权限,所以这儿不做任何事情。
Move on to "Passengers", which explicitly says that "Passengers" have Lounge access, so change the internal result to "ALLOW".
移动到"乘客"节点,这儿清楚地表示"乘客"有进入休息室的权限,所以改变内部结果为"允许"。
Move to the "Jedi" node, which doesn't mention the Lounge at all.
移动到"绝地战士"节点,这儿根本没有提到任何关于休息室的话。
Finally move to Luke's node, and again there's nothing there about the Lounge.
最后移动到Luke,这儿也没提至休息室
There's nowhere left to go, so the result returned is the current value of the internal result: "ALLOW"
现在已经到达终点了,所以返回结果就是当前的内部结果值:"允许"
Set the default result, "DENY".
设置缺省结果,"拒绝"
Work out a path to Chewie:
遍历ARO树以找出Chewie:
Start at the top of the tree and move towards Chewie. The "Millennium Falcon Passengers" node doesn't say anything about anywhere, so do nothing here.
从ARO树顶开始遍历到Chewie,"千年隼号乘客"节点没有定义任何权限,所以这儿不做任何事情。
Move on to "Crew", which explicitly says that "Crew" have Engine access, so change the internal result to "ALLOW".
移至"船员"节点,该节点明确表明"船员"组拥有访问发动机室的权限,因此改变内部结果为"允许"。
Move to Chewie's node, and there's an explicit rule saying that he doesn't have access to the Engines, so change the internal result to "DENY".
移至Chewie节点,该节点规则表明没有访问发动机室的权限,因此改变内部结果为"拒绝"。
There's nowhere left to go, so the result returned is the current value of the internal result: "DENY"
现在已经到达终点了,所以返回结果就是当前的内部结果值:"拒绝"
As you can see from the examples, if a Group doesn't explicitly specify a permission for a room, then that Group inherits the access restrictions of its parent for that room. If the root node ("Millennium Falcon Passengers") doesn't specify a permission, it inherits it from the default setting ("DENY ALL" in the above examples).
就象你从例子上看到的那样,如果一个组没被明确指定访问某个房间的权限的话,那么该组就会继承其父节点对该房间的权限。如果根节点("千年隼号乘客")也没有被指定权限的知,则它继承它的缺省设置(在上面的例子里是"全部拒绝")
This implies a couple of interesting points about the ARO tree:
从上面的例子我们不难看出ARO树中有意思的几点:
The ARO tree always shows the full list of the AROs. It would not make sense to ask "Does Jabba have access to the Cockpit?" because Jabba has not been defined in this system. However, phpGACL does not check to see if AROs or ACOs exist before performing the check, so if this question was actually asked then the result would be the default "DENY".
ARO树总是列出完整的ARO对象列表。如果问题是"Jabba是否有权进入驾驶室?"那就显得很不合理了,因为Jabba并未在这个系统中提及。然而,phpGACL在进行权限检查之前并不检查ARO对象或ACO对象是否存在,因此如果真被问及上述问题,则返回的结果将是缺省值"拒绝"。
The ARO tree may not display some defined ACOs, and relies on the default setting to define access policy. For example, say Han defined a "Bathroom" ACO. Any question like "Does Luke have access to the Bathroom?" would have the answer "DENY", because the default is "DENY" and nowhere in the ARO tree does it ever explicitly mention the Bathroom. Keep in mind when examining the ARO tree that some ACOs may not be visible.
在ARO树中也许并不显示某些已被定义的ACO对象,而是凭借缺省值来进行权限策略的设定。比如说Han定义了一个"浴室"ACO对象,那么任何诸如"Luke有权进浴室吗?"这样的问题将会得到"拒绝"这样的回答,因为在ARO树中没有任何地方明确地说明了浴室的权限而缺省的值又是"拒绝"。请记住检查ARO树时有些ACO对象也许是看不见的。