ZF2-222: Resource tied to parent

Description

Hi folks,

The following code won't work:

$acl->addResource('funcA','classA'); $acl->addResource('funcA','classB');

It didn't do it in ZF1 and also doesn't appear to do it in ZF2. We recently came across it in a project.

It would be great if this could be namespace related or named. The obvious work around is:

$acl->addResource('classA_funcA','classA'); $acl->addResource('classB_funcA','classB');

Thanks

Antony

Comments

Resources are arranged as a tree, a tree node can not have > 1 parent.

It would be helpful if you explained what you are trying to accomplish?

What I mean is that if you are creating an ACL which is using method names as the id and class names as the parent, you cannot have a resource with the same name even if it has a different parent. You would expect a parent to be able to have a child resource with the same name as another parents child.

The interface "Resource" has a method "getResourceId()". According to the architecture of Zend\Acl, this ID should be unique (identity pattern).

Duplicate of #ZF-5964, which I just marked as "won't fix". It's a fundamental design of Zend\Acl.