Hi,
Having this issue too, I subclassed both the dispatcher & response object to add a simple 'skip_dispatch_loop' flag.
More info: http://www.qc4blog.com/?p=572
(by the way, I used getter & setter, for the recent debate :) )
Remy
On Thu, Jun 11, 2009 at 2:54 PM, Benjamin Radtke <radtke@digitalzone.de> wrote:
Емил Иванов / Emil Ivanov schrieb:
Hi all,Hi, this is the Way I did:
I'm writing an auth plugin that should redirect the user to the login
page if she is not logged in. After the call to
Zend_Controller_Action_Helper_Redirector::gotoUrl the controller
action gets called anyway.
Calling gotoUrlAndExit() is not an options since it will kill the unit
tests interpreter.
I dug into the code, but couldn't find a way to stop the action from
being called.
Regards
class My_Plugin_AccessControl extends Zend_Controller_Plugin_Abstract
{
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
if (!Zend_Auth::getInstance()->hasIdentity()) {
$request->setModuleName('user')->setControllerName('auth')->setActionName('login')->setDispatched(true);
}
}
}
Benjamin
没有评论:
发表评论