Fwd: Groups Settings - not working for both domains

64 views
Skip to first unread message

David Hardwick

unread,
Mar 28, 2012, 9:28:11 PM3/28/12
to google-app...@googlegroups.com
Hello,

We have Group Setting enabled for a Group Settings project that is servicing multiple domains.  Out of our four test domains, three are working but for one domain it is not (of course, wouldn't you know it, the domain it is not working for is our test domain we use for automated testing!)

However, we have additional concerns since this could happen for other domains, and so far we only have a 75% success rate.

Below is an example a unit test for bc.com and testc8l.com (NOTE, not the real domains, the real domains were elided to protect the innocent!).  The request and response is included as comments within the unit tests.  

As described earlier, these two domains, having tokens of exactly the same scope, respond entirely differently for no apparent reason.  bc.com allows group settings access and testc8l.com throws a 401.

HELP!

public class GroupSettingsTest {
private String goodAdminEmail = "s....@bc.com";
private String goodToken = Constants.GOOD_TOKEN;
private String goodRefreshToken = Constants.GOOD_REFRESH_TOKEN;
private String goodDomain = "bc.com";
private String goodGroupId = "f...@bc.com";
private String badAdminEmail = "d....@testc8l.com";
private String badToken = Constants.BAD_TOKEN;
private String badRefreshToken = Constants.BAD_REFRESH_TOKEN;
private String badDomain = "testc8l.com";
private String badGroupId = "adm...@testc8l.com";
private LocalServiceTestHelper helper;
private OAuth2Service oAuth2Service;
private GroupsService groupsService;
@Before
public void setUp() throws Exception{
helper = new LocalServiceTestHelper(new LocalURLFetchServiceTestConfig());
helper.setUp();
Injector inj = Guice.createInjector(new GuiceGoogleServicesModule(), new GuiceModule(),new MockFPGuiceSessionModule());
oAuth2Service = inj.getInstance(OAuth2Service.class);
groupsService = inj.getInstance(GroupsService.class);
// refresh both tokens.  both tokens have the same scope and provisioning api is enabled for both
goodToken = oAuth2Service.refreshAccessToken("localhost", goodToken, goodRefreshToken);
badToken = oAuth2Service.refreshAccessToken("localhost", badToken, badRefreshToken);
// capture http request and respsonse
Logger logger = Logger.getLogger("com.google.api.client");
logger.setLevel(Level.FINER);
logger.addHandler(new Handler() {

@Override
public void close() throws SecurityException {
}

@Override
public void flush() {
}

@Override
public void publish(LogRecord record) {
if (record.getLevel().intValue() < Level.INFO.intValue()) {
System.out.println(record.getMessage());
}
}
});
}
@Test
public void testGoodDomainCanRetrieveSettings() throws Exception{
GroupsSettingsEntry entry = groupsService.getGroupSettingsEntry(GroupsSettingsUrl.forGetGroupSettingsEntry(goodGroupId), goodToken, goodAdminEmail);
Assert.assertNotNull(entry);
Assert.assertEquals(goodGroupId,entry.getEmail());
/*
-------------- REQUEST  --------------
Accept-Encoding: gzip
Authorization: <Not Logged>
GData-Version: v1
User-Agent: fp Google-HTTP-Java-Client/1.6.0-beta (gzip)
-------------- RESPONSE --------------
200
Expires: Wed, 28 Mar 2012 14:31:58 GMT
Date: Wed, 28 Mar 2012 14:31:58 GMT
Cache-Control: private, max-age=0, must-revalidate, no-transform
ETag: "j4AmYRiK3XvwemHZQtB25t0i4Ak/YGWPqVp-Way1XMXRRKm5jpaiHk4"
Content-Type: application/json; charset=UTF-8
Content-Encoding: gzip
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Content-Length: 454
Server: GSE
Response size: 454 bytes
{
"kind": "groupsSettings#groups",
"email": "f...@bc.com",
"name": "fp",
"description": "fp support and development team",
"whoCanJoin": "CAN_REQUEST_TO_JOIN",
"whoCanViewMembership": "ALL_MEMBERS_CAN_VIEW",
"whoCanViewGroup": "ALL_MEMBERS_CAN_VIEW",
"whoCanInvite": "ALL_MANAGERS_CAN_INVITE",
"allowExternalMembers": "false",
"whoCanPostMessage": "ANYONE_CAN_POST",
"allowWebPosting": "true",
"maxMessageBytes": 5242880,
"isArchived": "true",
"archiveOnly": "false",
"messageModerationLevel": "MODERATE_NONE",
"replyTo": "REPLY_TO_IGNORE",
"customReplyTo": "",
"sendMessageDenyNotification": "false",
"defaultMessageDenyNotificationText": "",
"showInGroupDirectory": "false",
"allowGoogleCommunication": "false",
"membersCanPostAsTheGroup": "false",
"messageDisplayFont": "DEFAULT_FONT"
}
*/
}
@Test
public void testBadDomainCanNotRetrieveSettings() throws Exception{
GroupsSettingsEntry entry = null;
boolean exceptionThrown = false;
try{
entry = groupsService.getGroupSettingsEntry(GroupsSettingsUrl.forGetGroupSettingsEntry(badGroupId), badToken, badAdminEmail);
}catch(Exception e){
exceptionThrown = true;
}
Assert.assertTrue(exceptionThrown);
Assert.assertNull(entry);
/*
-------------- REQUEST  --------------
Accept-Encoding: gzip
Authorization: <Not Logged>
GData-Version: v1
User-Agent: fp Google-HTTP-Java-Client/1.6.0-beta (gzip)

-------------- RESPONSE --------------
401
Content-Type: application/json; charset=UTF-8
Content-Encoding: gzip
Date: Wed, 28 Mar 2012 14:36:08 GMT
Expires: Wed, 28 Mar 2012 14:36:08 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Content-Length: 184
Server: GSE
{
"error": {
 "errors": [
  {
   "domain": "global",
   "reason": "authError",
   "message": "Domain cannot use Api, Groups service is not installed.",
   "locationType": "header",
   "location": "Authorization"
  }
 ],
 "code": 401,
 "message": "Domain cannot use Api, Groups service is not installed."
}
}
*/
}
@After
public void tearDown(){
oAuth2Service = null;
groupsService = null;
helper.tearDown();
}
}





David Hardwick

unread,
Mar 30, 2012, 9:45:38 AM3/30/12
to Google Apps Domain Information and Management APIs, steve....@bettercloud.com
Hello,

I really need help on this Group Settings issue. We've provided a
unit test and responses, but if there is anything else we can provide
then please let us know and we'll do it straight away.

Regards,
David

On Mar 28, 9:28 pm, David Hardwick <david.hardw...@bettercloud.com>
wrote:
>  GET https://www.googleapis.com/groups/v1/groups...@bc.com?alt=json

Stafford Marquardt

unread,
Mar 30, 2012, 12:41:59 PM3/30/12
to google-app...@googlegroups.com
Hi David,

Thanks for reaching out about this.  This looks like something that we'd like to investigate in detail with you - can you please file a ticket with our Enterprise Support team?  My colleagues and I will be happy to work with you on this.  We're currently aware of a relatively rare issue with this API that sounds similar to what you're experiencing, and we'll be able to help you through this in the 1:1 channel.

Cheers,
Stafford
Reply all
Reply to author
Forward
0 new messages