Hi,

I spent days understanding this acl stuff. I made progress but
still....

I have groups:
id:1, name:administrators
id:2, name:managers
id:3, name:users

I have users:
id:1, name:admin, group_id:1
id:2, name:mana, group_id:2
id:3, name:user, group_id:3

I have aros:
id:1, parent_id:null, model:Group, foreign_key:1,
alias:administrators, lft:1, rght:4
id:2, parent_id:null, model:Group, foreign_key:2, alias:managers, lft:
5, rght:8
id:3, parent_id:null, model:Group, foreign_key:3, alias:users, lft:9,
rght:12
id:4, parent_id:1, model:User, foreign_key:1, alias:admin, lft:2, rght:
3
id:5, parent_id:2, model:User, foreign_key:2, alias:mana, lft:6, rght:
7
id:6, parent_id:3, model:User, foreign_key:3, alias:user, lft:10, rght:
11

I have acos:
id:1, parent_id:null, alias:controllers, lft:1, rght:6
id:2, parent_id:1, alias:bla, lft:2, rght:3
id:3, parent_id:1, alias:she, lft:4, rght:5

I have aros_acos:
id:1, aro_id:2, aco_id:2, _read,_create,_update,_delete: 1
id:2, aro_id:2, aco_id:3, _read,_create,_update,_delete: 1
id:3, aro_id:3, aco_id:3, _read,_create,_update,_delete: 1

These are bla and she controller:
class [Bla/She]Controller extends AppController
{
  var $uses = array();
  function testing()
  {
    echo "Acl makes me crazy.";
    $this->autoRender = false;
  }
}

This is User model:
class User extends AppModel
{
  var $name = 'User';
  var $belongsTo = array('Group');
  var $actsAs = array('Acl' => array('requester'));

  function parentNode()
  {
    if (!$this->id && empty($this->data))
    {
      return null;
    }
    $data = $this->data;
    if (empty($this->data))
    {
      $data = $this->read();
    }
    if (!$data['User']['group_id'])
    {
      return null;
    }
    else
    {
      return array('Group' => array('id' => $data['User']
['group_id']));
    }
  }
}

This is Group model:
class Group extends AppModel
{
  var $name = 'Group';
  var $actsAs = array('Acl' => array('requester'));

  function parentNode()
  {
    return null;
  }
}

This is my app_controller file:
class AppController extends Controller
{
  var $components = array('Acl', 'Auth');

  function beforeFilter()
  {
    $this->Auth->authorize = 'actions';
    $this->Auth->loginAction = array('controller' => 'users', 'action'
=> 'login');
    $this->Auth->logoutRedirect = array('controller' => 'users',
'action' => 'login');
    $this->Auth->loginRedirect = array('controller' => 'users',
'action' => 'login');
    $this->Auth->actionPath = 'controllers/';
  }
}

If I log in with user 'mana' (group = 'managers') then go to this
page: /bla/testing, I get this error:
DbAcl::check() - Failed ARO/ACO node lookup in permissions check.
Node references:
....
Aco: controllers/Bla/testing

But if I put another aco node with alias 'testing' and parent node
points to 'bla', I can access it.
id:4, parent_id:2, alias:testing, lft:3, rght:4

I am very confused. How should you name the aco (controller stuff)?
How do I use _read, _create, etc field effectively? Why do I get
failed node lookup rather than denied access?

Thank you.

--~--~---------~--~----~------------~-------~--~----~
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