cakephp: проблема с Acl: невозможно заполнить таблицу aros_acos функцией initdb в контроллере пользователя - PullRequest
1 голос
/ 13 сентября 2011

Когда я пытаюсь запустить 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;
}

любая помощь очень ценится. Спасибо.

...