Structuring Zend_Acl and CRUD with Parent / Child Relations

I am wondering how I should structure my CRUD ACL with parent / child relationships.

Eg. Projects have TodoLists. TodoLists have Todos

There are various controller actions for the project.

  • / projects / add
  • / projects / edit / {projíd}
  • / projects / delete / {projíd}
  • / ToDo-lists / add / {projíd}
  • / ToDo-lists / edit / {todoListId}
  • ...

As you can see, what happens down the hierarchy, some actions have identifiers that are not related to themselves (for example, todo-lists controller → todo-list resource), but to their parent

So, with setup (usually), it looks like

  • ACL controller plugin (preDispatch)
    • Set role for user loggedin or 'unauthenticated'
    • Set resource to controller name
    • param 'id', ( ORM Doctrine), Zend_Acl_Resource_Interface. . , , . /todo-lists/add , (Project). - "addTodoList". , acl- TodoLists. Controller Actions ACL Logic. ?

, addTodoListAction ProjectsController TodoListsController? ACL, /? ( ).

ACL ?

+3
1

Zend_Acl_Assertion, projectid todoId.

$myAcl->allow($role,'projects','edits',new My_Project_Assertion());

"addTodoListAction" - ( ) addtodolistAction wd work;

+2

Source: https://habr.com/ru/post/1787641/


All Articles