Made changes to the database and added models to support options. Next is permissions

git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@797 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-28 01:42:29 +00:00
parent f5f09421c1
commit 1d4dcbd2b0
14 changed files with 1027 additions and 119 deletions

37
site/models/user.php Normal file
View File

@@ -0,0 +1,37 @@
<?php
class User extends AppModel {
var $hasMany =
array('UserOption',
'Membership',
);
static $current_user_id;
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')));
if (!empty($user['User']['id']))
self::$current_user_id = $user['User']['id'];
else
// We must force a stop here, since this is typically
// called very early on, and so will cause a recursive
// crash as we try to render the internal error and
// again stumble on this problem.
$this->INTERNAL_ERROR('UNKNOWN USER', 0, true);
return self::$current_user_id;
}
}