Hi,

I have a plugin checking in the preDispatch() method if the user (role) may
have access to the requested resource.
If not, I will display an error message 'Access Denied'.
I detect if the request was Ajax, in this case, I'll have to send the
message through Json:


if($this->_request->isXmlHttpRequest()) {
        echo Zend_Json::encode( array('success' => false, 'msg' => 'Access
denied.') );
        die();
}

If I don't use die(), the request will continue its way and go to some
method, probably displaying also Json. But the access should be denied and
nothing should be printed afterwards.

Is die() a good way of doing this or is there a more proper way ?

Thank you !!
-- 
View this message in context: 
http://www.nabble.com/Proper-way-to-stop-a-request-from-preDispatch---tp25108403p25108403.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to