我正在构建一个基于配置文件的应用程序。我正在尝试使用此处找到的简单 acl 控制应用程序教程:http: //book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application。 html,创建我的组和权限。我在以不同用户身份登录时遇到了一些问题,以获得运行权限。我有一个管理员、经理和用户组。我已经设置了 ACO 和 ARO,并为每个组添加了权限。这是我的
class AppController extends Controller {
public $components = array(
'Acl',
'Auth'=>array(
'loginRedirect'=>array('controller'=>'users', 'action'=>'index'),
'logoutRedirect'=>array('controller'=>'users', 'action'=>'index'),
'authError'=>'You cannot access that page',
'authorize'=>array('actionPath' => 'controllers')
),
'Session'
);
public function isAuthorized($user) {
return true;
}
public function beforeFilter() {
$this->Auth->authorize = array(
'Actions' => array(
'userModel' => 'User',
'actionPath' => 'users'
)
);
$this->Auth->allow('display');
$this->set('logged_in', $this->Auth->loggedIn());
$this->set('current_user', $this->Auth->user());
}
}
用户控制器.php
class UsersController extends AppController {
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('view');
}
public function login() {
if ($this->request->is('Post')) {
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirect());
} else {
$this->Session->setFlash('Your username/password combination was incorrect');
}
}
}
public function logout() {
$this->redirect($this->Auth->logout());
}
我现在得到的错误是:
Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in permissions check. Node references:
Aro: Array
Permission::check() - CORE/Cake/Model/Permission.php, line 94
DbAcl::check() - CORE/Cake/Controller/Component/Acl/DbAcl.php, line 73
AclComponent::check() - CORE/Cake/Controller/Component/AclComponent.php, line 109
ActionsAuthorize::authorize() - CORE/Cake/Controller/Component/Auth/ActionsAuthorize.php, line 40
AuthComponent::isAuthorized() - CORE/Cake/Controller/Component/AuthComponent.php, line 412
AuthComponent::startup() - CORE/Cake/Controller/Component/AuthComponent.php, line 336
ObjectCollection::trigger() - CORE/Cake/Utility/ObjectCollection.php, line 132
call_user_func - [internal], line ??
CakeEventManager::dispatch() - CORE/Cake/Event/CakeEventManager.php, line 248
Controller::startupProcess() - CORE/Cake/Controller/Controller.php, line 671
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 184
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 162
[main] - APP/webroot/index.php, line 109
由于某种原因,它无法访问权限。而且我似乎无法找到解决此问题的解决方案。任何帮助都会很棒!提前致谢!