Magento前台用户访问的权限验证有点搞,呵呵,在ZF中我们一般的写法是用ACL,但是Magento的写法有点搞,是直接写在控制器Mage_Customer_AccountController中的,详细请见preDispatch方法。
/** * Action predispatch * * Check customer authentication for some actions */ public function preDispatch() { // a brute-force protection here would be nice parent::preDispatch(); if (!$this->getRequest()->isDispatched()) { return; } $action = $this->getRequest()->getActionName(); if (!preg_match('/^(create|login|logoutSuccess|forgotpassword|forgotpasswordpost| confirm|confirmation)/i', $action)) { if (!$this->_getSession()->authenticate($this)) { $this->setFlag('', 'no-dispatch', true); } } else { $this->_getSession()->setNoReferer(true); } }