Listing 34.4. Metoda preDispatch() zezwalająca na dostęp do akcji tylko zalogowanym użytkownikom
public function preDispatch()
{
    $auth = Zend_Auth::getInstance();
    if (!$auth->hasIdentity()) {
        return $this->_helper->redirector(
            'index',
            'auth',
            'default'
        );
    }
    $this->view->identity = $auth->getIdentity();
}