Hi
I've been implementing an admin prefix route in my application because
I want only the admin user to be able to administer users and groups.
The admin prefix is enabled in core.php and I've created admin views
(admin_add.ctp, admin_edit.ctp etc) and the equivalent admin actions
in my controllers. All fine.
Where I've come unstuck is what happens if a user isn't logged in and
they try to access myapp/admin/users/add
What I want to happen is that they get redirected to the myapp/users/
login action/view; but what happens is (you've guessed it) they get
redirected to myapp/admin/users/login which doesn't exist.
I've tried all sorts of things to work around this; but nothing is
working for me. I've some before filters defined and these are:
1. In AppController
function beforeFilter() {
//Configure AuthComponent
// $this->Auth->authorize = 'actions';
// $this->Auth->loginAction = array('controller' => 'users',
'action' => 'login');
// $this->Auth->logoutRedirect = array('controller' =>
'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' =>
'dashboards', 'action' => 'showdashboard');
}
2. In my UserLevelsController (aka Groups)
function before_filter()
{
parent::before_filter();
// This was attempt to stop Auth doing it's own thing for this
controller
$this->Auth->autoRedirect = false;
// This was supposed to redirect to users/login without the
admin - admin => false
if (!$this->Auth->user())
{
$this->redirect(array('controller' => 'users', 'action' =>
'login', 'home', 'admin' => false));
}
}
The fact that none of this is working how I'd like makes me think I've
missed something essential somewhere. Can someone please point me in
the right direction?
Thanks
David
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---