Can't get IBM tut#2 to restrict product addition to logged-in users.
This is the products_controller:

function add() {if (!empty($this->data)) {

  $this->Product->create();
  if ($this->Product->save($this->data)) {
  $dealer = $this->Product->Dealer->read(null,
                                   $this->data['Product']['dealer_id']);
  $parent = $this->Acl->Aco->findByAlias($dealer
                                    ['Dealer']['title']);
  $this->Acl->Aco->create(array(
       'alias' => $this->Product->id.'-'.$this->data
                                        ['Product']['title'],
       'model' => 'Product',
       'foreign_key' => $this->Product->id,
       'parent_id' => $parent['Aco']['id'])
);

This is the user login view:

<?php


if (isset($error)) {
        echo('Invalid Login.');
}
?>

<p>Please log in.</p>
<?php echo $form->create('User',
        array('action' => 'login')); ?>

<?php
        echo $form->input('username');
        echo $form->input('password');
?>

<?php echo $form->end('Login');?>
<?php echo $html->link('Register',
        array('action' => 'register'));?>

  The use login view works, but the products_controller doesn't
restrict non-logged in users from adding products.
  Any words will be appreciated.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to