Hi, The problem is in the way you create your ACO. You can read this article http://bakery.cakephp.org/articles/view/how-to-use-acl-in-1-2-x for more information on how to create Acos or Aros. I would recommend that you use the Acl Behavior in your Task Model.
Ketan StanMoong wrote: > Hello, > > I'm trying create a module where users can create tasks. So, for the > add() function in the TasksController, there is this portion of the > code that gives access to the user. > > if ($this->Task->save($this->data)) { > $task_id = $this->Task->id; > $task_alias = $task_id.'-'.$this->data['Task']['title']; > > $aco = new Aco(); > $aco->create($task_id, $user_id, $task_alias); > $this->Acl->allow('Users', $task_alias, 'read'); > $this->Acl->allow($this->Session->read('user'), $task_alias, '*'); > $this->Session->setFlash('The Task has been saved'.' '.$this->Session- > >read('user').' '.$task_alias); > $this->redirect('/tasks/index'); > } > > I can't understand why the error is thrown when I try to add a task, > which result in the ACO not created, and subsequently no ACL record is > created. > > [Thu Jul 26 00:28:54 2007] [error] [client 127.0.0.1] PHP Warning: > Null parent in Aco::create() in E:\\Web\\WebServer\\Apache2_2_4\\htdocs > \\cake\\libs\\controller\\components\\dbacl\\models\\aclnode.php on > line 82, referer: http://localhost/tasks/add > > > I've added additional debug message to print out the values: > > [Thu Jul 26 00:28:54 2007] [error] [client 127.0.0.1] PHP Warning: > parentId = [7], count(parent)=[1], parent=[] in E:\\Web\\WebServer\ > \Apache2_2_4\\htdocs\\cake\\libs\\controller\\components\\dbacl\\models > \\aclnode.php on line 83, referer: http://localhost/tasks/add > > Any idea??? > > Been stuck for couple of days :( --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---