function gaasGetUsers_server($msg) { $haveTokens = $msg["havetokens"]; $userPatter = $msg["userpattern"]; $group = $msg["group"]; $myga = new gaasdGA(); if (confGetval("backend") == "AD") { $adgroup = ""; if ($group == "admin") { $adgroup = confGetVal("ad.admindef"); } else { $adgroup = confGetVal("ad.clientdef"); } $addom = confGetVal("ad.domain"); $aduser = confGetVal("ad.user"); $adpass = confGetVal("ad.pass"); //echo "using group $adgroup for $group\n"; $users = getUsersInGroup($addom, $aduser, $adpass, $adgroup); foreach ($users as $key => $val) { $user = $val["username"]; //echo "checking $user for token - "; if ($myga->hasToken($user)) { $users[$key]["hastoken"] = true; //echo "yes\n"; } else { $users[$key]["hastoken"] = false; //echo "no\n"; } } } else { // internal db } //print_r($users); return $users; }
<?php require_once "globalLib.php"; require_once "gaasdMessages.php"; // messy require_once dirname(__FILE__) . "/../../lib/ga4php.php"; // first we check if our db exists, if not, we're not inited $initState = false; $backEnd = ""; global $initState, $backEnd; if (file_exists($BASE_DIR . "/gaas/gaasd/gaasd.sqlite")) { // then we check if the config vars we need exist in the db $backEndType = confGetVal("backend"); echo "backend type is {$backEndType}\n"; if ($backEndType == "AD") { echo "init state should be true\n"; $backEnd = "AD"; // TODO: we should now check all vars are set, but for now this will surfice $initState = true; } if ($backEndType == "internal") { $backEnd = "IN"; $initState = true; } } // have a gloval db handle so we dont have to keep opening the db all the time // this may go away when we consider the implications for a parallel gaasd $DB_HANDLE = false; global $DB_HANDLE; // a function to create our db // TODO: error checking