pastebin

Paste Search Dynamic
Recent pastes
authManager
  1. <?php
  2.  
  3. $auth=Yii::app()->authManager;
  4. $auth->createOperation('createPost','create a post');
  5. $auth->createOperation('readPost','read a post');
  6. $auth->createOperation('updatePost','update a post');
  7. $auth->createOperation('deletePost','delete a post');
  8. $bizRule='return Yii::app()->user->id==$params["post"]->authID;';
  9. $task=$auth->createTask('updateOwnPost','update a post by author himself',$bizRule);
  10. $task->addChild('updatePost');
  11. $role=$auth->createRole('reader');
  12. $role->addChild('readPost');
  13. $role=$auth->createRole('author');
  14. $role->addChild('reader');
  15. $role->addChild('createPost');
  16. $role->addChild('updateOwnPost');
  17. $role=$auth->createRole('editor');
  18. $role->addChild('reader');
  19. $role->addChild('updatePost');
  20. $role=$auth->createRole('admin');
  21. $role->addChild('editor');
  22. $role->addChild('author');
  23. $role->addChild('deletePost');
  24. $auth->assign('reader','readerA');
  25. $auth->assign('author','authorB');
  26. $auth->assign('editor','editorC');
  27. $auth->assign('admin','adminD');
  28. ?>
Parsed in 0.027 seconds