I'm running into a problem where my controllers don't seem to be
inheriting from my AppController on my production server. I've put all
of my authentication related code in my AppController and the child
controllers just aren't recognizing it. The strange thing is that it
works perfectly on my development box. When I run the app on the
production box, I get absolutely no authentication functionality at
all:
1) When I access /users/login, I see the login form as expected but,
when I submit the data nothing happens. No errors, redirects, etc.
2) When I access any other page, I am not redirected back to the login
page...access to everything is allowed.
3) When I click on my logout link (which calls the logout function of
the users controller), I get this error: "Undefined property:
UsersController::$Auth [APP/controllers/users_controller.php, line
16]"
All of this seems to indicate that none of my child controllers are
inheriting anything from my app controller. Again, this all works fine
locally however, so I'm not sure where I should be looking to
troubleshoot. I'm not sure if it makes a difference at all, but in
both environments (dev and production) the CakePHP libraries are
located external to the actual app:
Library: /usr/lib/cake
Web App: /var/www/myApp
Here's the relevant code:
app/app_controller.php
<?php
class AppController extends Controller {
var $helpers = array('Session', 'Html', 'Form', 'Text',
'Javascript');
var $components = array('Auth', 'Session');
function beforeFilter() {
$this->Auth->loginAction = array('controller'=>'users',
'action'=>'login');
$this->Auth->loginRedirect = array('controller'=>'transmissions');
$this->Auth->loginError = "Invalid username and/or password";
$this->Auth->authorize = 'controller';
$this->Auth->flashElement = 'flashMessage';
}
function isAuthorized() {
return true;
}
}
?>
app/controllers/user_controller.php:
<?php
class UsersController extends AppController {
var $name = 'Users';
var $layout = 'login';
function beforeFilter() {
parent::beforeFilter();
}
function login(){
}
function logout() {
$this->redirect($this->Auth->logout());
}
}
?>
Thanks for any help!
-Brian
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment