我正在关注的指南在这里 -> http://framework.zend.com/manual/1.12/en/zend.gdata.gapps.html#zend.gdata.gapps.groups.creating。我正在尝试创建一个组并为其分配一个“访问级别”,但没有关于可接受值的文档。
这是我写的脚本:
<?php
// This should point to the exact path of the file being imported
require_once '/Users/myuser/Source/Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Gapps');
if (count($argv) == 1) {
echo "Usage: ".$argv[0]." \"group id\" \"group name\" \"description\" \"email permission\"\n";
die;
}
// Arguments passed in on the command line
$groupId = $argv[1];
$groupName = $argv[2];
$groupDesc = null;
if (count($argv) > 3) {
$groupDesc = $argv[3];
}
$groupPermission = null;
if (count($argv) > 4) {
$groupPermission = $argv[4];
}
// Set this to your gapps email/pass
$email = "test@domain.com";
$password = "foobar";
// Gapps domain
$domain = "domain.com";
$client = Zend_Gdata_ClientLogin::getHttpClient($email, $password, Zend_Gdata_Gapps::AUTH_SERVICE_NAME);
$gdata = new Zend_Gdata_Gapps($client, $domain);
$entry = $gdata->createGroup($groupId, $groupName, $groupDesc, $groupPermission);
?>
Gapps.php文件中“createGroup”的描述如下:
/**
* Create a new group.
* @param string $groupId A unique identifier for the group
* @param string $groupName The name of the group
* @param string $description A description of the group
* @param string $emailPermission The subscription permission of the group
* @return Zend_Gdata_Gapps_GroupEntry The group entry as created on the server.
*
如果您在“角色和权限”下查看 Google Apps,则定义了 4 个访问级别:团队、仅公告、受限、自定义。我无法在 emailPermission 字段中发送成功将组设置为“自定义”以外的任何值的值。到目前为止,我可以发送“所有者”或“成员”,它选择“自定义”的访问级别,并在“向群组发送电子邮件”旁边选中“所有者”或“成员”。
有人熟悉这样做吗?仅供参考,您必须拥有超级管理员权限并启用配置 api 才能针对您的 gapps 域执行此脚本。