Это немного странно, потому что я вижу эти ошибки в моих файлах журналов, и ни одна из них не соответствует моим ресурсам. Infact Я даже не распознаю ни один из этих ресурсов, которые отображаются в файлах ошибок
2010-12-26T12:19:46+00:00 ERR (3): Error Message Resource 'res' not found
2010-12-26T12:19:46+00:00 ERR (3): Stack Trace #0 /var/www/application/library/Zend/Acl.php(691): Zend_Acl->get('res')
#1 /var/www/application/library/My/Controller/Plugin/Acl.php(29): Zend_Acl->isAllowed('guest', 'res', '2127250264.html')
2010-12-26T12:50:21+00:00 ERR (3): Error Message Resource 'fcs' not found
2010-12-26T12:50:21+00:00 ERR (3): Stack Trace #0 /var/www/application/library/Zend/Acl.php(691): Zend_Acl->get('fcs')
#1 /var/www/application/library/My/Controller/Plugin/Acl.php(29): Zend_Acl->isAllowed('guest', 'fcs', 'ident2')
2010-12-26T12:50:22+00:00 ERR (3): Error Message Resource 'open' not found
2010-12-26T12:50:22+00:00 ERR (3): Stack Trace #0 /var/www/application/library/Zend/Acl.php(691): Zend_Acl->get('open')
#1 /var/www/application/library/My/Controller/Plugin/Acl.php(29): Zend_Acl->isAllowed('guest', 'open', '1')
Resource res, fcs, open или 2127250264.html - это не ресурсы в моем приложении - поэтому я не уверен, что означают эти ошибки.
Может кто-нибудь пролить свет на то, как я могу отладить это.
EDIT
class My_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract {
private $_acl = null;
public function __construct(Zend_Acl $acl) {
$this->_acl = $acl;
}
public function preDispatch(Zend_Controller_Request_Abstract $request) {
//As in the earlier example, authed users will have the role user
$role = (Zend_Auth::getInstance()->hasIdentity())
? 'user'
: 'guest';
$controller = $request->getControllerName();
$action = $request->getActionName();
$requestUri = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();
$session = new Zend_Session_Namespace('lastRequest');
// Temporary fix not to save view-image as last requested URL
if(strpos($requestUri, 'snapshot')==false && $controller != 'register' && $controller != 'login' && $action != 'view-image' && $action != 'play-video' && $action != 'config') {
//save the requested action only if it is not login
$session->lastRequestUri = $requestUri;
}
if(!$this->_acl->isAllowed($role, $controller, $action)) {
//If the user has no access we send him elsewhere by changing the request
$request->setModuleName('default')
->setControllerName('login')
->setActionName('log');
}
}
}
И это класс, в котором я определил ресурсы
class My_Acl extends Zend_Acl {
public function __construct() {
//Add a new role called "guest"
$this->addRole(new Zend_Acl_Role('guest'));
//Add a role called user, which inherits from guest
$this->addRole(new Zend_Acl_Role('user'), 'guest');
//Add a resource called page
$this->add(new Zend_Acl_Resource('video'));
$this->add(new Zend_Acl_Resource('error'));
$this->add(new Zend_Acl_Resource('index'));
$this->add(new Zend_Acl_Resource('login'));
$this->add(new Zend_Acl_Resource('register'));
$this->add(new Zend_Acl_Resource('profile'));
$this->add(new Zend_Acl_Resource('edit-profile'));
$this->add(new Zend_Acl_Resource('css'));
$this->add(new Zend_Acl_Resource('js'));
$this->add(new Zend_Acl_Resource('images'));
$this->add(new Zend_Acl_Resource('snapshots'));
//Finally, we want to allow guests to view pages
$this->allow('guest', 'css');
$this->allow('guest', 'js');
$this->allow('guest', 'snapshots');
$this->allow('guest', 'images');
$this->allow('guest', 'error');
$this->allow('guest', 'login');
$this->allow('guest', 'index');
$this->allow('guest', 'register');
$this->allow('guest', 'profile','view-profile');
$this->allow('guest', 'profile','view-image');
$this->allow('guest', 'profile','all-videos');
$this->allow('guest', 'profile','all-fans');
$this->allow('guest', 'profile','favorite-artists');
$this->allow('guest', 'profile','favorite-videos');
$this->allow('guest', 'video','display-thumb');
$this->allow('guest', 'video', 'config');
$this->allow('guest', 'video', 'play');
$this->allow('guest', 'video', 'play-video');
$this->allow('guest', 'video', 'new-videos');
$this->allow('guest', 'video', 'category');
$this->allow('guest', 'video', 'index');
$this->allow('guest', 'video', 'search');
$this->allow('user', 'video');
$this->allow('user', 'profile');
}
}