Sorry about that.. The updated code is here. An array of data needs to
be passed to the Save function and I was missing that array in there.
The updated code is here and I have updated the article as well.
<?php
class InitAclController extends AppController
{
var $name = 'InitAcl';
var $component = array('Acl');
function setupAcl()
{
$aro = new aro();
$aro->create();
$aro->save(array(
'model'=>'User',
'foreign_key'=>null,
'parent_id'=>null,
'alias'=>'Admin'));
$aro->create();
$aro->save(array(
'model'=>'User',
'foreign_key'=>null,
'parent_id'=>null,
'alias'=>'User'));
$aro->create();
$aro->save(array(
'model'=>'User',
'foreign_key'=>null,
'parent_id'=>null,
'alias'=>'Guest'));
$parent = $aro->findByAlias('Admin');
$parentId = $parent['Aro']['id'];
$aro->create();
$aro->save(array(
'model'=>'User',
'foreign_key'=>1,
'parent_id'=>$parentId,
'alias'=>'User::1'));
$aco = new Aco();
$aco->create();
$aco->save(array(
'model'=>'User',
'foreign_key'=>null,
'parent_id'=>null,
'alias'=>'User'));
$aco->create();
$aco->save(array(
'model'=>'Post',
'foreign_key'=>null,
'parent_id'=>null,
'alias'=>'Post'));
}
// Give admin full control over acos 'User' & 'Post'
$this->Acl->allow('Admin', 'User', '*');
$this->Acl->allow('Admin', 'Post', '*');
// Give the user group only create & read access for 'Post'
$this->Acl->allow('User', 'Post', array('create', 'read'));
// Give the Guests only create access for 'User'
$this->Acl->allow('Guest', 'User', 'create');
}
?>
On Jul 16, 1:26 pm, CakeSpork <[EMAIL PROTECTED]> wrote:
> Thanks for the reaction. I understand it is to gain concepts, I'm
> trying to gain them and your article is helping me a lot.
>
> I made a new init_acl_controller.php in /controllers/ and it gave me:
> "Parse error: syntax error, unexpected T_DOUBLE_ARROW in D:\Program
> Files\xampp\project_files2\filmsite\controllers
> \init_acl_controller.php on line 13" when trying to access /initAcl/
>
> I think I'm doing it all wrong, I just can't seem to figure out what
> I'm _supposed_ to be doing with the controller.
> </end n00brant>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---