Use ACL Behavior, it will save you a lot of time. And read this tutorial: http://aranworld.com/article/161/cakephp-acl-tutorial-what-is-it
Btw, good name for the post! Cheers, mbavio On Jun 13, 12:41 pm, leo <[EMAIL PROTECTED]> wrote: > Well, yes, I know about those, but as I'm following the example in the > manual I thought the save must be implicit. > > This still isn't working for me. > $aro->save($aro->create(0, null, 'Admin')); > $aro->save($aro->create(0, null, 'Users')); > Fails to save anything. > > What I am now using is: > $aro->save($aro->create(array(0, null, 'Admin'))); > $aro->save($aro->create(array(0, null, 'Users'))); > > This is the only way I can get anything into the database. > Unfortunately it creates records that only have the id, lft & rght > fields set. Without any reference to what should go where I'm a little > in the dark. I've only spent two days dragging the (inter)net for > information on this. Maybe I need to drag some more. Has anybody > actually used ACL? > > On 13 Juny, 16:38, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > > > > It's on the Api > > > Also it's on the dochttp://book.cakephp.org/view/75/saving-your-data > > > <quote> > > create(array $data = array()) > > > This method initializes the model class for saving new information. If > > you're ever calling save() inside of a loop (in order to create many > > records at once), make sure to call create() just before save(). > > </quote> > > > > On Fri, Jun 13, 2008 at 11:31 AM, leo <[EMAIL PROTECTED]> wrote: > > > >> I was guessing something like that. I don't see it in the manual. > > >> Should it be after each create or at the end of the whole lot? > > > >> On 13 Juny, 16:28, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > > >>> You are missing the call to save() after create() > > > >>> On Fri, Jun 13, 2008 at 11:27 AM, leo <[EMAIL PROTECTED]> wrote: > > > >>> > Following the example in the manual, I cerated the tables succesfully. > > > >>> > I am now trying to populate the tables with this code: (it's a > > >>> > paraphrase of the manual example) > > > >>> > function index() { > > >>> > $aro = new Aro(); > > > >>> > // First, set up a few AROs. > > >>> > // These objects will have no parent initially. > > > >>> > $aro->create( 1, null, '[EMAIL PROTECTED]' ); > > >>> > $aro->create( 2, null, '[EMAIL PROTECTED]'); > > >>> > $aro->create( 3, null, '[EMAIL PROTECTED]'); > > > >>> > // Now, we can make groups to organize these users: > > >>> > // Notice that the IDs for these objects are 0, because > > >>> > // they will never tie to users in our system > > > >>> > $aro->create(0, null, 'Admin'); > > >>> > $aro->create(0, null, 'Users'); > > > >>> > //Now, hook AROs to their respective groups: > > > >>> > $aro->setParent('Admin', '[EMAIL PROTECTED]'); > > >>> > $aro->setParent('Users', '[EMAIL PROTECTED]'); > > >>> > $aro->setParent('Users', '[EMAIL PROTECTED]'); > > > >>> > $aco = new Aco(); > > > >>> > //Create some access control objects: > > >>> > $aco->create(1, null, 'Electric Guitar'); > > > >>> > $aco->create(2, null, 'United States Army'); > > >>> > $aco->create(3, null, 'Fans'); > > > >>> > $this->User->recursive = 0; > > >>> > $this->set('usuaris', $this->paginate()); > > >>> > } > > > >>> > For ease of access and because I ultimately want to control ACL from > > >>> > there, I put this in the users controller in the index action. > > > >>> > It runs every line without complaint, but puts nothing in the db. What > > >>> > am I doing wrong / not doing at all? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---
