Hi there,

I've scoured the manual, api, groups, whole internet etc. to try and
find a reason why I'm hitting this problem all to no avail, so
hopefully somebody can at least give me a hint what it might be!

It's pretty simple - I've got a controller that, at the moment (for
debugging purposes), does a beforeFilter check like this:

function beforeFilter()
{
$user = $this->Session->read('User');
$aroNode = $this->User->getAroNode($user);
$acoNode = array('model' => 'WebsiteSection', 'foreign_key' => $this-
>section);
if (! $this->Acl->check($aroNode,$acoNode,"*")) echo "NO";
...
}

Of course I've defined my components at the top:

var $components = array('Acl');

Unfortunately this is what I get in the browser:

Fatal error: Call to a member function check() on a non-object in C:
\Apps\Apache Group\Apache2\htdocs\cake\cake\libs\controller\components
\acl.php on line 88 (or thereabouts - I've put some of my own debug
statements in there)

Things I've tried:
- printing out $this->components to make sure Acl is loaded. It is.
- putting this stuff in my own app_controller. Makes no difference.

It DOES work if I put the code in an action, say 'index' or 'view'. It
just doesn't seem to be happy in beforeFilter, which is ideally where
I'd like it to be.

As far I can tell, I don't think the 'startup' method in acl.php is
being executed. This means _instance isn't being set, and so the line
in question in acl.php fails:

return $this->_instance->check($aro, $aco, $action);

Even if I explicity call startup from my own code, that just results
in some error about an unknown Model class which I can't even begin to
understand!

A lot of the ACL examples put stuff in beforeFilter, so I'm pretty
sure it must be possible - but no-one seems to have come across my
problem before. I'd be grateful for any ideas as it's driving me mad
(especially as I thought I was making headway understanding ACL!).

Thanks in advance,
Paul.


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

Reply via email to