Question

The guide I'm following is here -> http://framework.zend.com/manual/1.12/en/zend.gdata.gapps.html#zend.gdata.gapps.groups.creating. I am trying to create a group and assign it an "Access Level" but there is no documentation on what the acceptable values are.

Here is the script I wrote:

<?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);
?>

The description for "createGroup" in the Gapps.php file is as follows:

/**
 * 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.
 *

If you look in Google Apps under "roles & permissions" there are 4 Access Levels defined: Team, Announcement-only, Restricted, Custom. I have not been able to send a value in the emailPermission field that successfully sets a group to anything besides "Custom". So far, I can send "Owner" or "Member" and it chooses an Access Level of "Custom" with either "Owner" or "Member" checked off next to "Send email to the group.

Is anyone familiar with doing this? Just as an fyi, you have to have super admin privs and have the provisioning api enabled in order to execute this script against your gapps domain.

Was it helpful?

Solution

Acceptable values are owner, member, domain and anyone. Note that since this API call was released with Provisioning API 2.0, Google Groups have gotten much finer grained permissions some of which are accessible via the Groups Settings API. If you wish to customize your group permissions beyond the basic owner, member, domain and anyone defaults, use the Groups Settings API.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top