I've been at this for a couple of hours now and I seem to be stuck.
I'm trying to enable a pretty simple admin section for an app and
would like to get familiar with the Auth component rather than rolling
my own. I'm varying a bit from the convention, here, so I'll try to
present what I have as simply as I can.
I have an Administrator model with email and password fields. In my
AppController, I've defined:
public $components = array ( 'Auth' );
public function beforeFilter() {
$this->Auth->userModel = 'Administrator';
$this->Auth->fields = array (
'username' => 'email',
'password' => 'password'
);
$this->Auth->userScope = array('User.active' => '1');
$this->Auth->allow ( '*' );
$this->Auth->deny ( 'admin_index' );
$this->Auth->loginAction = array (
'controller' => 'administrators',
'action' => 'login'
);
$this->Auth->logoutRedirect = '/';
$this->set ( 'Auth', $this->Auth->user() );
}
I've also configured admin routing:
Configure::write('Routing.admin', 'admin');
I've got an AdministratorsController with a login() method (and an
associated view):
public function login() {
echo '<p>HERE</p>';
}
I've tried to wire my /admin route to /administrators/login:
Router::connect (
'/admin',
array ( 'controller' => 'administrators', 'action' => 'login',
'admin' => true )
);
But when I try to access http://mydomain/admin, all I get is a blank
page; not even a default layout. I don't really understand the 'admin'
parameter, so maybe I'm using that wrong? I only used it because
that's what all of the examples seem to do. I've tried both true and
false values, though, with no change in result.
I get the same result when trying to access the one method on the one
controller that I've denied: http://mydomain/admin/exhibitor_entries/index.
Any input that might put me on the right track would be appreciated.
I've looked at the docs and the source code, but something isn't
clicking for me.
Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---