Reputation: 88197
i am not sure if calling setRedirect from the resource object is the best way. but i wonder why this does not seem to do anything. i have this in a predispatch controller plugin
function preDispatch(Zend_Controller_Request_Abstract $req) {
...
if (!$acl->isAllowed($role, $resource, $privilege)) {
...
$res = $this->_response;
$res->setRedirect('/error/?error-handler=unauthorized', 403);
}
}
if u prefer the whole code, get it @pastebin
Upvotes: 0
Views: 1128
Reputation: 4822
setRedirect()
does not stop the dispatchloop from executing. To do the redirect you have to send the headers and exit the process.
$res->setRedirect('/error/?error-handler=unauthorized', 403);
$res->sendHeaders();
exit();
A better way would be to use the Redirector Zend_Controller_Action_HelperBroker::getStaticHelper('Redirector')->gotoUrl()
Upvotes: 4