calzone,
Yes as I note in the doc, I didn't test that script it was just a
sample. Here is the same script actually implemented into an app of
mine. This is put in the app_controller.php or your App. You will have
to set the session information to whatever you use for your user
authentication.
Ryan
var $components = array('Acl');
var $beforeFilter = array('checkAdmin');
function checkAdmin()
{
$aco = $this->name . ":" . $this->action;
if($this->Session->read('User.logged') === true)
{
if($this->_checkAccess($this->Session->read('User.username'), $aco))
{
return;
}
else
{
$this->redirect('/admin/users/login/');
}
}else{
if($this->_checkAccess('User', $aco))
{
return;
}
else
{
$this->redirect('/admin/users/login/');
}
}
}
function _checkAccess($aro, $aco)
{
// Check access using the component:
$access = $this->Acl->check($aro, $aco, $action = "*");
//access denied
if ($access === false)
{
return false;
}
//access allowed
else
{
return true;
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---