Hi there,

I'm also kinda new to Cake, and after building a couple apps I've run
into the same problem you have.  I'll try to explain what I did to
solve it.

I'm using the same kind of cookie you have, i.e, username and hashed
password.

In AppController, I use a component I made called Auth.  I'll explain
why later.  Passing it to that component looks like this:

function beforeFilter () {
        $this->Auth->checkPerms($this); // pass the controller object
}

Normally you can get a reference to the controller inside a Component
via $this->controller, but in this case, the startup() method doesn't
get called, so you have to hack to use it:

(inside Auth component)
        function checkPerms(&$controller) {
           ....

Also, as far as I know, your models aren't instantiated in this context
either...

$this->User = new User();

... and from there you can use your Model, your Controller if
necessary, and your cookie data (I used $_COOKIE and
Sanitize::paranoid) to authenticate the user.  I only do the check if
Session data isn't found already.

The reason I routed this to a component is really because I have a
complicated permissions setup.  I set permissions inside my controllers
for each one of its actions, corresponding to an Acl control object.  I
also assign each User to an Acl group when they are created.  Auth
helps out with all that stuff, and checkPerms()s' main job is to go
through this permissions array, and if the user doesn't have those
permissions, redirect to an error login page.

That's how I managed to do it, and it's probably an uncessesarily
complicated hack... For your situation, you might want to try simply
using your User model in beforeFilter() instead of trying
requestAction()     :)


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

Reply via email to