私は Web サイトで作業しています。履歴書の一部のユーザーには、ログインしたユーザーのみがダウンロードできる記事がいくつかあります。ログイン アクションまたは preDispatch() を変更して、ゲスト ユーザーが記事をダウンロードするためのセッションを設定したいと考えています。
誰かがそれを行う方法を教えてもらえますか、または参照リンクをいくつか教えてもらえますか?
ここに私の 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;
}