You are not logged in.
Pages: 1
Hi all,
In my application i have a Front Controller Plugin which is build to check wether the visitor has access to the requested page with use of Zend_Acl.
Now when the user is not allowed on a page i would like to throw an Exception (the best thing to do i figured).
Now the problem here is that my error page (Error Action in Error Controller) isnt being rendered properly.
It feels a little as if the layout starts to render...then the exception is thrown, then it starts to Render the entire error page (including the layout again).
Extra Info.
-Exceptions thrown in Controllers are working as intended.
-I have tried using PreDispatch() instead of dispatchLoopStartup, it had no effect
Here is the code that checks if the user is allowed somewhere and if not throw the exception
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
$this->role = $this->getRole($request);
$this->resource = strtolower($request->getControllerName() . '-'
. $request->getActionName());
if(!$this->acl->isAllowed($this->role, $this->resource))
{
throw new Exception(My_Acl_Acl::NOT_ALLOWED, 404);
}
}Offline
Hi iiTyr,
is dispatchLoopStartup being called a second time? Waht does you errorController look like?
Best,
-
Jon
Offline
The Error Controller is just a default out of the box ErrorController
As for the calling of dispatchLoopStartup, this only seems to happen once
This only seems to happen when the exception is thrown...
I did some more trying, and it seems like the ErrorController Renders the layout normaly, untill just before it is going to render the phtml file for the error action...
Then it renders the entire requested page (so from Doctype till </html> (which wasnt supposed to be seen by the visitor) and then continues on with the error.phtml and finished the layout normaly.
Offline
And Nevermind...
I added the following code to the top of my errorAction inside of my ErrorController, which cleared out any body content rendered prior to the error occuring...
$this->getResponse()->clearBody();Offline
Pages: 1