예제 #1
0
/*
// Get info about a user

$service = new Google_Service_Directory($client);
$data = $service->users->get("*****@*****.**");
var_export($data);
print("\n");
exit(0);
*/
$policy = new StandardGroupPolicy('westkingdom.org');
$batch = new \Google_Http_Batch($client);
$batchWrapper = new BatchWrapper($batch);
$controller = new GoogleAppsGroupsController($client, $batchWrapper);
if (!file_exists('currentstate.westkingdom.org.yaml')) {
    print "about to fetch\n";
    $existing = $controller->fetch('westkingdom.org');
    $dumper = new Dumper();
    $dumper->setIndentation(2);
    $existingAsYaml = trim($dumper->dump($existing, PHP_INT_MAX));
    file_put_contents('currentstate.westkingdom.org.yaml', $existingAsYaml);
    exit(0);
}
$groupData = file_get_contents(dirname(__FILE__) . "/currentstate.westkingdom.org.yaml");
$currentState = Yaml::parse($groupData);
$groupManager = new Westkingdom\HierarchicalGroupEmail\GroupsManager($controller, $policy, $currentState);
$groupManager->update($newState);
$dumper = new Dumper();
$dumper->setIndentation(2);
/*
$pendingOperations = $batchWrapper->getSimplifiedRequests();
$pendingAsYaml = trim($dumper->dump($pendingOperations, PHP_INT_MAX));