echo "\tsetadlogin username password domain\n";
echo "\tsetclientgroup groupname - change the group membership requirements for client's with AD\n";
echo "\tsetadmingroup groupname - change the group membership requirements for admin's with AD\n";
- echo "\tprovisionuser username [HOTP|TOTP] [KEY]- provision the user \"username\"\n";
+ echo "\tprovision username [HOTP|TOTP] [KEY]- provision the user \"username\"\n";
echo "\tgetusers [admin|client] [part-of-username] [yes] - get user list with admin or client group, part of a username and return only those with tokens (yes)\n";
+ echo "\tdeleteuser username - deletes the key for the specified user\n";
echo "\n";
exit(0);
}
echo "Resetting AD admin group details failed\n";
}
break;
+ case "provision":
+ $username = $argv[2];
+ break;
case "getusers":
$group = "client";
$partof = "";
if(isset($argv[3])) $partof = $argv[3];
if(isset($argv[4])) $onlytokens = $argv[4];
$ret = $myga->MSG_GET_USERS($group, $partof, $onlytokens);
- //print_r($ret);
- foreach($ret as $user) {
- echo $user["realname"]." (".$user["username"].")\n";
+ foreach($ret as $user => $real) {
+ echo "$real ($user)\n";
+ }
+ break;
+ case "deleteuser":
+ $ret = $myga->MSG_DELETE_USER($argv[2]);
+ if($ret) {
+ echo "Delete user token succeeded\n";
+ } else {
+ echo "Delete user token failed\n";
}
break;
default:
return $msg;
}
+
+function gaasDeleteUser_clientsend($params)
+{
+ $msg["username"] = $params[0];
+
+ return $msg;
+}
?>
\ No newline at end of file
return true;
}
+
+function hasToken($username)
+{
+ $db = getDB();
+
+ $sql = "select * from users where users_username='$username'";
+ $res = $db->query($sql);
+ if(!$res) return false;
+ foreach($res as $row) {
+ print_r($row);
+ }
+
+ return true;
+}
+
+
// a funciton to deal with Config Vars
function confGetVal($varname)
{
$addom = confGetVal("ad.domain");
$aduser = confGetVal("ad.user");
$adpass = confGetVal("ad.pass");
- echo "using group $adgroup for $group\n";
+ //echo "using group $adgroup for $group\n";
$users = getUsersInGroup($addom, $aduser, $adpass, $adgroup);
+ foreach($users as $user => $real) {
+ hasToken($user);
+ }
} else {
// internal db
- }
+ }
return $users;
}
+
+function gaasDeleteUser_server($msg)
+{
+ $username = $msg["username"];
+ $db = getDB();
+ $db->query($sql = "delete from users where users_username='$username'");
+
+}
?>
\ No newline at end of file
define("MSG_SET_ADMIN_GROUP", 22);
define("MSG_PROVISION_USER",23);
define("MSG_GET_USERS", 24);
+define("MSG_DELETE_USER", 25);
// the gaasd call's $MESSAGE[<MSG>]_server() for the server side
// and $MESSAGE[<msg>]_client() for the client side
$MESSAGES[MSG_SET_ADMIN_GROUP] = "gaasSetAdminGroup";
$MESSAGES[MSG_PROVISION_USER] = "gaasProvisionUser"; // username
$MESSAGES[MSG_GET_USERS] = "gaasGetUsers"; // [admin|client], [name pattern], [only with tokens]
+$MESSAGES[MSG_DELETE_USER] = "gaasDeleteUser"; // username
global $MESSAGES;
$i = 0;
foreach($info as $kpot => $lpot) {
if(isset($lpot["samaccountname"])) {
- $arbi[$i]["username"] = $lpot["samaccountname"][0];
- $arbi[$i]["realname"] = $lpot["name"][0];
- $i++;
+ $arbi[$lpot["samaccountname"][0]] = $lpot["name"][0];
}
}