我使用了beforeFilter函数来配置我的超时。但是,它似乎无法正常工作。我知道标准是将会话配置放在core.php中。但是,因为我的要求声明会话超时的值可由我们正在开发的系统的管理员配置。
下面是一个脚本
public function beforeFilter(){
if ( $this->isStudent() ){
$this->set('checkStatus',$this->checkComplete());
}
parent::beforeFilter();
//debug($this->Auth->user());
//cakephp auth allow - allow all
$this->Auth->allow('login','registerEmployee','registerCompany','forbidden','authorize','completeRegistration','registrationTnc','passwordReset','getUserData');
// Set the Auth to global views
if($this->Auth->user()){
$this->set('activeUser',$this->Auth->user());
}
$settings = $this->Setting->find('first',array('fields'=>array('setting_max_session_timeout')));
$sessionTimeout = $settings['Setting']['setting_max_session_timeout'];
Configure::write('Session', array(
'defaults' => 'php',
'timeout' => $sessionTimeout, //in minutes
'cookieTimeout' => $sessionTimeout, //in minutes
));
}