Added request log mechanism
git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@832 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -296,6 +296,7 @@ class AppController extends Controller {
|
||||
*/
|
||||
|
||||
function beforeFilter() {
|
||||
$this->params['user'] = $this->Permission->User->currentUser();
|
||||
$this->params['dev'] = $this->Option->enabled('dev');
|
||||
$this->params['admin'] = $this->Option->enabled('admin');
|
||||
|
||||
@@ -312,10 +313,10 @@ class AppController extends Controller {
|
||||
$this->sideMenuEnable($area_name, $this->admin_area, false);
|
||||
}
|
||||
|
||||
$this->authorize("controller.{$this->params['controller']}");
|
||||
$this->authorize("controller.{$this->params['controller']}");
|
||||
$this->authorize("action.{$this->params['controller']}.{$this->params['action']}");
|
||||
$this->authorize("action.{$this->params['controller']}.{$this->params['action']}");
|
||||
|
||||
$this->log($this->params, 'request');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,19 +8,21 @@ class User extends AppModel {
|
||||
|
||||
static $current_user_id;
|
||||
|
||||
function currentUser() {
|
||||
if (!empty($_SERVER['REMOTE_USER']))
|
||||
return $_SERVER['REMOTE_USER'];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function currentUserId() {
|
||||
if (!empty(self::$current_user_id))
|
||||
return self::$current_user_id;
|
||||
|
||||
if (!empty($_SERVER['REMOTE_USER']))
|
||||
$login = $_SERVER['REMOTE_USER'];
|
||||
else
|
||||
$login = null;
|
||||
|
||||
$user = $this->find
|
||||
('first',
|
||||
array('recursive' => -1,
|
||||
'conditions' => compact('login')));
|
||||
'conditions' => array('login' => $this->currentUser())));
|
||||
|
||||
if (!empty($user['User']['id']))
|
||||
self::$current_user_id = $user['User']['id'];
|
||||
|
||||
Reference in New Issue
Block a user