当我尝试运行app / users / initdb时,我收到警告512并且我无法填充aros_acos表。有谁知道我做错了:
Warning (512): DbAcl::allow() - Invalid node [CORE\cake\libs\controller\components\acl.php, line 361]Code | Context
if ($perms == false) {
trigger_error(__('DbAcl::allow() - Invalid node', true), E_USER_WARNING);$aro = Group
Group::$name = "Group"
Group::$validate = array
Group::$hasMany = array
Group::$actsAs = array
Group::$useDbConfig = "default"
Group::$useTable = "groups"
Group::$displayField = "name"
Group::$id = 7
Group::$data = array
Group::$table = "groups"
Group::$primaryKey = "id"
Group::$_schema = array
Group::$validationErrors = array
Group::$tablePrefix = ""
Group::$alias = "Group"
Group::$tableToModel = array
Group::$logTransactions = false
Group::$cacheQueries = false
Group::$belongsTo = array
Group::$hasOne = array
Group::$hasAndBelongsToMany = array
Group::$Behaviors = BehaviorCollection object
Group::$whitelist = array
Group::$cacheSources = true
Group::$findQueryType = NULL
Group::$recursive = 1
Group::$order = NULL
Group::$virtualFields = array
Group::$__associationKeys = array
Group::$__associations = array
Group::$__backAssociation = array
Group::$__insertID = NULL
Group::$__numRows = NULL
Group::$__affectedRows = NULL
Group::$_findMethods = array
Group::$User = User object
Group::$Aro = Aro object
$aco = "controllers"
$actions = "*"
$value = 1
$perms = false
$permKeys = array(
"_create",
"_read",
"_update",
"_delete"
)
$save = array()DbAcl::allow() - CORE\cake\libs\controller\components\acl.php, line 361
AclComponent::allow() - CORE\cake\libs\controller\components\acl.php, line 106
UsersController::initdb() - APP\controllers\users_controller.php, line 82
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
[main] - APP\webroot\index.php, line 83
以下是我的users_controller.php
class UsersController extends appController{
var $name = 'Users';
function beforeFilter(){
parent::beforeFilter();
$this->Auth->allow(array('*'));
}
function index() {
$this->User->recursive = 0;
$this->set('users', $this->paginate());
}
function login(){
}
function logout(){
}
.........
function initdb(){
//gets reference of Group model and modify its id to be able to specify the ARO we wanted, this is due to how AclBehavior works. AclBehavior does not set the alias field in the aros table so we must use an object reference or an array to reference the ARO we want.
$group=& $this->User->Group;
//Allow admins to everything
$group->id=7;
$this->Acl->allow($group,'controllers');
//allow managers to posts and widgets
$group->id=8;
$this->Acl->deny($group,'controllers');
$this->Acl->allow($group,'controllers/Posts');
$this->Acl->allow($group, 'controllers/Widgets');
//allow users to only add and edit on posts and widgets
$group->id=9;
$this->Acl->deny($group,'controllers');
$this->Acl->allow($group,'controllers/Posts/add');
$this->Acl->allow($group,'controllers/Posts/edit');
$this->Acl->allow($group,'controllers/Widgets/add');
$this->Acl->allow($group,'controllers/Widgets/edit');
//we add an exit to avoid an ugly "missing views" error message
echo "all done";
exit;
}
非常感谢任何帮助。感谢。