3 // testing how i add stuff
4 // with git across multiple machines on the same branch
6 require_once("../lib/gaasdClient.php");
8 $myga = new GAASClient();
15 echo "Usage: ".$argv[0]." command [options]\n";
16 echo "\nCommands:\n\tinit AD user password domain clientgroup admingroup - init for active directory installation\n";
17 echo "\tinit IN user password - init for internal database\n";
18 echo "\tstatus - return the status of the server\n";
19 echo "\tsetadlogin username password domain\n";
20 echo "\tsetclientgroup groupname - change the group membership requirements for client's with AD\n";
21 echo "\tsetadmingroup groupname - change the group membership requirements for admin's with AD\n";
22 echo "\tprovisiontoken username [HOTP|TOTP] [KEY] - provision the user \"username\"\n";
23 echo "\tassign username tokenid - assign a hardware token to a user\n";
24 echo "\taddtoken token_name token_key token_type - adds a hardware token to the DB\n";
25 echo "\tgethwtokens - gets a list of hardware tokens by token_name\n";
26 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";
27 echo "\tdeleteuser username - deletes the key for the specified user\n";
38 $ret = $myga->MSG_STATUS();
39 echo "Status: $ret\n";
42 if($argv[2] == "AD") {
43 if($argc < 7) usage();
45 $ret = $myga->MSG_INIT_SERVER("AD", $argv[3], $argv[4], $argv[5], $argv[6], $argv[7]);
47 echo "initialising server succeeded\n";
49 echo "initialising server failed\n";
53 $ret = $myga->MSG_SET_AD_LOGIN($argv[2], $argv[3], $argv[4]);
55 echo "Resetting AD login details succeeded\n";
57 echo "Resetting AD login details failed\n";
60 case "setclientgroup":
61 $ret = $myga->MSG_SET_CLIENT_GROUP($argv[2]);
63 echo "Resetting AD client group details succeeded\n";
65 echo "Resetting AD client group details failed\n";
69 $ret = $myga->MSG_SET_ADMIN_GROUP($argv[2]);
71 echo "Resetting AD admin group details succeeded\n";
73 echo "Resetting AD admin group details failed\n";
79 $ret = $myga->MSG_ASSIGN_TOKEN($username, $tokenid);
82 $ret = $myga->MSG_GET_HARDWARE();
83 foreach($ret as $tok) {
84 echo "Token, ".$tok["name"]." is of type ".$tok["type"]."\n";
90 $tokentype = $argv[4];
91 $ret = $myga->MSG_ADD_HARDWARE($tokenid, $tokenkey, $tokentype);
93 case "provisiontoken":
97 if(isset($argv[3])) $ttype = $argv[3];
98 if(isset($argv[4])) $tkey = $argv[4];
99 $ret = $myga->MSG_PROVISION_USER($username, $ttype, $tkey);
105 if(isset($argv[2])) $group = $argv[2];
106 if(isset($argv[3])) $partof = $argv[3];
107 if(isset($argv[4])) $onlytokens = $argv[4];
108 $ret = $myga->MSG_GET_USERS($group, $partof, $onlytokens);
109 foreach($ret as $key => $val) {
110 $real = $val["realname"];
111 $user = $val["username"];
113 if($val["hastoken"]) {
116 echo "$hastok$real ($user)\n";
120 $ret = $myga->MSG_DELETE_USER($argv[2]);
122 echo "Delete user token succeeded\n";
124 echo "Delete user token failed\n";
128 echo "No such command, ".$argv[1]."\n";