I'm a dolt. It was just a couple days ago I reminded someone else to ensure that any beforeFilter() contained this important line:
parent::beforeFilter(); It's amazing how quickly the solution jumps out at you as soon as you post a plea for help to the list. Sorry for the noise! On Wed, Sep 16, 2009 at 8:19 PM, brian <[email protected]> wrote: > (using 1.2.5) > > I'm getting strange behaviour from Auth. I know--it's a pretty > confusing component, to be sure, so I may be missing something. But > this sure seems broken right now. > > My $userModel is Member. In AppController: > > function beforeFilter() > { > $this->Auth->userModel = 'Member'; > $this->Auth->authorize = 'controller'; > $this->Auth->fields = array('username' => 'email', 'password' => > 'password'); > $this->Auth->loginError = 'No matching user found.'; > $this->Auth->autoRedirect = true; > $this->Auth->loginAction = array( > 'controller' => 'members', > 'action' => 'login' > ); > } > > function isAuthorized() > { > return true; // for now > } > > routes.php: > > Router::connect('/login', array('controller' => 'members', 'action' => > 'login')); > > In my PresentationsController I have a download() method, which use > MediView. There are no methods in this controller that do not require > authentication. > > $uses = array('Presentation', 'PresentationFile'); > > public function beforeFilter() > { > $this->Auth->deny('*'); > } > > Now, when I *log in successfully* and then browse to > /presentations/download/SOME_ID, I get redirected to /users/login. > There are 2 problems here. First, I'm logged in, so Auth shouldn't be > redirecting me. Secondly, I have no reference- anywhere to users, User > model, or UsersController. For some reason, Auth is ignoring it's > $userModel set in AppController, and using its default. > > The download does work if I change PresentationsController to: > > public function beforeFilter() > { > $this->Auth->allow('download'); > } > > But that's definitely not what I want. Can anyone think of what I'm > not seeing here? > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
