Hi,
I've followed the tutorial at
http://bakery.cakephp.org/articles/view/how-to-use-acl-in-1-2-x
and ran in to some problems. Signing up a new user is working fine,
both ACO and ARO are created, but when trying to add a new post I get:
Warning (512): AclNode::node() - Couldn't find Aco node identified by
Array
(
[Aco0.model] = Post
[Aco0.foreign_key] = 14
)
[CORE/cake/libs/model/db_acl.php, line 172]
Warning (512): DB_ACL::allow() - Invalid node [CORE/cake/libs/
controller/components/acl.php, line 362].
The post is still added to the database though. The Post model lookes
like this
?php
class Post extends AppModel {
var $name = 'Post';
var $actAs = array('Acl' = 'controlled');
var $belongsTo = array('User' =
array('className' = 'User'
)
);
function parentNode()
{
return $this-name;
}
?
and the add-action in PostsController
function add()
{
if (!empty($this-data))
{
$this-Post-data = $this-data;
$id = $this-Session-read('Auth.User.id');
$this-data['Post']['user_id'] = $id;
$this-Post-create();
if($this-Post-save($this-data))
{
debug($this-Post);
// ACL
$aroNode = array('model' = 'User', 'foreign_key' =
$id);
$acoNode = array('model' = 'Post', 'foreign_key' =
$this-Post-getLastInsertID());
$this-Acl-allow($aroNode,$acoNode,'*');
$this-flash('Success','/users/profile/'.$id);
}
}
}
All help I can get is appreciated!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---