2010年12月22日星期三

[fw-mvc] Zend Navigation Page Resource, ACL and MCV

In order to *show to a role ONLY ALLOWED PAGES* I need to build ACL first
So first I search for user role and role parents and add all roles found to
ACL

$roles = $aclModel->getUserRoles();

Then I search the model for all roles active Rules

$rules = $aclModel->getRolesRules($roles);

And add every rule to the ACL.
How can I tell the Page that a Controller ineriths from is Module?
Assuming I've

$resource = 'admin/users';

$rules = array(

[0] => array(5) {
["id"] => string(2) "0"
["resource_id"] => string(4) "NULL"
["role_id"] => string(5) "guest"
["privilege"] => string(4) "NULL"
["allowed"] => string(1) "0"
},

[1] => array(5) {
["id"] => string(2) "1"
["resource_id"] => string(4) "admin/users"
["role_id"] => string(5) "editor"
["privilege"] => string(4) "NULL"
["allowed"] => string(1) "1"
}

);

The first rule deny access to all resources,
The second rule allow for admin/users
But in my pages I've:

array(
'label' => 'Admin',
'module' => 'admin',
'resource' => 'admin',
'pages' => array(
array(
'label' => 'Users',
'module' => 'admin',
'controller' => 'users',
'resource' => 'admin/users'
)
)
);

So Admin Pages never shows to Editors

没有评论: