3 require_once("../lib/gaasdClient.php");
5 $myga = new GAASClient();
12 echo "Usage: ".$argv[0]." command [options]\n";
13 echo "\nCommands:\n\tinit AD user password domain clientgroup admingroup - init for active directory installation\n";
14 echo "\tinit IN user password - init for internal database\n";
15 echo "\tstatus - return the status of the server\n";
16 echo "\tsetadlogin username password domain\n";
17 echo "\tsetclientgroup groupname - change the group membership requirements for client's with AD\n";
18 echo "\tsetadmingroup groupname - change the group membership requirements for admin's with AD\n";
19 echo "\tprovision username [HOTP|TOTP] [KEY]- provision the user \"username\"\n";
20 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";
21 echo "\tdeleteuser username - deletes the key for the specified user\n";
32 $ret = $myga->MSG_STATUS();
33 echo "Status: $ret\n";
36 if($argv[2] == "AD") {
37 if($argc < 7) usage();
39 $ret = $myga->MSG_INIT_SERVER("AD", $argv[3], $argv[4], $argv[5], $argv[6], $argv[7]);
41 echo "initialising server succeeded\n";
43 echo "initialising server failed\n";
47 $ret = $myga->MSG_SET_AD_LOGIN($argv[2], $argv[3], $argv[4]);
49 echo "Resetting AD login details succeeded\n";
51 echo "Resetting AD login details failed\n";
54 case "setclientgroup":
55 $ret = $myga->MSG_SET_CLIENT_GROUP($argv[2]);
57 echo "Resetting AD client group details succeeded\n";
59 echo "Resetting AD client group details failed\n";
63 $ret = $myga->MSG_SET_ADMIN_GROUP($argv[2]);
65 echo "Resetting AD admin group details succeeded\n";
67 echo "Resetting AD admin group details failed\n";
77 if(isset($argv[2])) $group = $argv[2];
78 if(isset($argv[3])) $partof = $argv[3];
79 if(isset($argv[4])) $onlytokens = $argv[4];
80 $ret = $myga->MSG_GET_USERS($group, $partof, $onlytokens);
81 foreach($ret as $user => $real) {
82 echo "$real ($user)\n";
86 $ret = $myga->MSG_DELETE_USER($argv[2]);
88 echo "Delete user token succeeded\n";
90 echo "Delete user token failed\n";
94 echo "No such command, ".$argv[1]."\n";