zend framework - Structuring Zend_Acl and CRUD with Parent/Child Relationships -
i wondering how should structure acl crud parent/child relations.
eg. projects have todolists. todolists have todos
there various controller actions project
- /projects/add
- /projects/edit/{projid}
- /projects/delete/{projid}
- /todo-lists/add/{projid}
- /todo-lists/edit/{todolistid}
- ...
as can see going down hierarchy, actions have ids refer not (eg. todo-lists controller -> todo-list resource) parent
so with have setup (generally), looks this
- acl controller plugin (predispatch)
- set role loggedin user or 'unauthenticated'
- set resource controller name
- set privilege action name
- if request param 'id' set, actual entity (i using doctrine orm) implements
zend_acl_resource_interface
. here complication arises. resource controller name, eg./todo-lists/add
must know parent entity instead (project). setup, have chage privilege to 'addtodolist'. way, project acl assertion class have todolists stuff. there disconnect between controller actions & acl logic. ok?
maybe should have addtodolistaction in projectscontroller instead of todolistscontroller? simplify acl code, won't need check , modify resource/privileges? can take these directly request params (controller & action names).
how setup acl's this?
use zend_acl_assertion , create assertion projectid , todoid. @ time of giving permission do
$myacl->allow($role,'projects','edits',new my_project_assertion());
and cannot use action "addtodolistaction" because of captial letters (or define own dispatcher) addtodolistaction wd work;
Comments
Post a Comment