diff options
Diffstat (limited to '')
-rw-r--r-- | app/class/user.class.php | 16 | ||||
-rw-r--r-- | app/model/auth.mod.php | 10 |
2 files changed, 26 insertions, 0 deletions
diff --git a/app/class/user.class.php b/app/class/user.class.php index 8ef91ae..6004dc9 100644 --- a/app/class/user.class.php +++ b/app/class/user.class.php @@ -25,6 +25,22 @@ class User extends Object parent::__construct("user", $cols); $this->loadObj($guid); } + + /* + * Get all users -- ordered by name, ascending + */ + function getAllUsers_orderByName() + { + $query = "SELECT guid FROM `object` WHERE `type` = 'user' ORDER BY name"; + $result = $this->db->query($query); + + $users = array(); + + foreach ($result as $u) + $users[] = new User($u['guid']); + + return $users; + } } ?> diff --git a/app/model/auth.mod.php b/app/model/auth.mod.php index 9c356e2..9cd6b7c 100644 --- a/app/model/auth.mod.php +++ b/app/model/auth.mod.php @@ -1,6 +1,7 @@ <?php require_once "model/common.mod.php"; +require_once "class/user.class.php"; class AuthModel extends CommonModel { @@ -9,6 +10,15 @@ class AuthModel extends CommonModel */ function deflt() { + /* Make sure user accounts exist since this is preping the page to login. If there are no accounts in the DB, + * return false to signal controller to display the admin account creation */ + + $userTbl = new User(); + + if (count($userTbl->getAllUsers_orderByName()) == 0) + return false; + + return true; } } |