Witam

Czy może mi ktoś wytłumaczyć co jest nie tak, albo dlaczego tak to działa?
Chodzi mi konkretnie o metode _forward z klasy Action. Chciałem zrobić łańcuch akcji, wiec dałem na końcu akcji $this->_forward( 'innaAkcja' ). Wszytsko działało ok, do póki nie dodałem uwierzytelniania i autoryzacji. Teraz proces dipatchingu się zapętla i cały czas wykonuje się pierwsza akcja w pętli.Wogóle nie wchodzi do drugiej akcji (innAkcja).
Autoryzacja jest zrobiona jako plugin do controllera
Kod klasy pluginu:
  1. <?php
  2. class Rhino_Controller_Plugin_Auth extends Zend_Controller_Plugin_Abstract
  3. {
  4. private $_auth;
  5. private $_acl;
  6.  
  7. private $_noauth = array( 'module' => 'default',
  8. 'controller' => 'login',
  9. 'action' => 'index');
  10.  
  11. private $_noacl = array('module' => 'default',
  12. 'controller' => 'error',
  13. 'action' => 'privileges');
  14.  
  15. public function __construct($auth, $acl)
  16. {
  17. $this->_auth = $auth;
  18. $this->_acl = $acl;
  19. }
  20.  
  21. public function preDispatch(Zend_Controller_Request_Abstract $request)
  22. {
  23.  
  24. if ($this->_auth->hasIdentity()) {
  25. $role = $this->_auth->getIdentity()->getRole();
  26. } else {
  27. $role = 'guest';
  28. }
  29.  
  30. $controller = $request->controller;
  31. $action = $request->action;
  32. $module = $request->module;
  33.  
  34. $resource = $controller;
  35. if ( $module != 'default' ) {
  36. $resource = $module . '_' . $controller;
  37. }
  38.  
  39. if (!$this->_acl->has($resource)) {
  40. $resource = null;
  41. }
  42.  
  43. if (!$this->_acl->isAllowed($role, $resource, $action)) {
  44. if (!$this->_auth->hasIdentity()) { //nie zalogowany
  45. $module = $this->_noauth['module'];
  46. $controller = $this->_noauth['controller'];
  47. $action = $this->_noauth['action'];
  48. }
  49. else { //zalogowany ale nie ma uprawnien do zasobow
  50. $module = $this->_noacl['module'];
  51. $controller = $this->_noacl['controller'];
  52. $action = $this->_noacl['action'];
  53. }
  54. }
  55.  
  56. $request->setModuleName($module);
  57. $request->setControllerName($controller);
  58. $request->setActionName($action);
  59. }
  60. }
  61. ?>


którego póżniej rejestruje w front controllerze
  1. <?php
  2. $controller->registerPlugin( new Rhino_Controller_Plugin_Auth( $auth, $acl ) );
  3. ?>


No i jakieś akcje:
  1. <?php
  2. public function dalejAction ()
  3. {
  4. echo 'forwarding...';
  5. $this->_forward( 'temp' );
  6. }
  7.  
  8. public function tempAction() 
  9. {
  10. echo '<h1>To jest jakas inna akcja</h1>';
  11. }
  12. ?>

Albo może ktoś ma inny pomysł na wykonanie łańcucha akcji ?

----------edit

Po zmianie w klasie pluginu:
  1. <?php
  2. $controller = $request->controller;
  3. $action = $request->action;
  4. $module = $request->module;
  5. ?>

na:
  1. <?php
  2. $controller = $request->getControllerName();
  3. $action = $request->getActionName();
  4. $module = $request->getModuleName();
  5. ?>


Zadziałało smile.gif
Trochę to dziwne, ale ciesze się że ruszyło smile.gif