session set for some Actions in Zend framework
- by user202127
I'm working on a website , in CV part users have some articles that only logged in users can download them.I want to make changes to the log in Action or preDispatch() to set session for guess users to download the articles,
can some one tell me how it can be or give me some reference links.
here is my preDispatch():
public function preDispatch()
{
$userInfo=$this->_auth->getStorage()->read();
$identity= $this->_auth->getIdentity();
if(!$this->_auth->hasIdentity())
{
return $this->_helper->redirector('login','login');
}
if(!isset($userInfo["member_id"]) || strlen($userInfo["member_id"])==0)
{
return $this->_helper->redirector('forbidden','login');
}
$this->_accessType=2;
}