Google groups settings SDK (python) doesn't seem to make a difference between "Anyone can ask" and "Anyone in the organisation can ask" to join permissions.
The whoCanJoin
permission parameter only allows the following values :
ANYONE_CAN_JOIN ALL_IN_DOMAIN_CAN_JOIN INVITED_CAN_JOIN CAN_REQUEST_TO_JOIN
When I set the permission to CAN_REQUEST_TO_JOIN
, only the setting "Anyone in the organisation can ask" gets checked.
Even when I manualy check the "Anyone can ask" permission. The settings JSON stays the same :
{u'allowExternalMembers': u'true',
u'allowGoogleCommunication': u'false',
u'allowWebPosting': u'true',
u'archiveOnly': u'false',
u'customFooterText': u'',
u'customReplyTo': u'',
u'defaultMessageDenyNotificationText': u'',
u'description': u"---------",
u'email': u'---------@orga.com',
u'includeCustomFooter': u'false',
u'includeInGlobalAddressList': u'true',
u'isArchived': u'false',
u'kind': u'groupsSettings#groups',
u'maxMessageBytes': 26214400,
u'membersCanPostAsTheGroup': u'false',
u'messageDisplayFont': u'DEFAULT_FONT',
u'messageModerationLevel': u'MODERATE_NONE',
u'name': u'----------',
u'replyTo': u'REPLY_TO_IGNORE',
u'sendMessageDenyNotification': u'false',
u'showInGroupDirectory': u'false',
u'spamModerationLevel': u'MODERATE',
u'whoCanAdd': u'ALL_MANAGERS_CAN_ADD',
u'whoCanContactOwner': u'ANYONE_CAN_CONTACT',
u'whoCanInvite': u'ALL_MANAGERS_CAN_INVITE',
u'whoCanJoin': u'CAN_REQUEST_TO_JOIN',
u'whoCanLeaveGroup': u'ALL_MEMBERS_CAN_LEAVE',
u'whoCanPostMessage': u'ALL_IN_DOMAIN_CAN_POST',
u'whoCanViewGroup': u'ALL_MEMBERS_CAN_VIEW',
u'whoCanViewMembership': u'ALL_MANAGERS_CAN_VIEW'}
Would anyone know how to programmaticaly set this setting to both "Anyone can ask" and "Anyone in the organisation can ask" ?
Found the answer, it must be done in two commands : First allow external members, then set whoCanJoin settings and other rights.
Setting both in one settings body doesn't work.
def set_settings(self, group_mail, settings, batch=None):
req = self.service.groups().update(
groupUniqueId=group_mail,
body=settings)
if batch:
batch.add(req)
else:
req.execute()
def allow_external_members(self, group_mail, batch=None):
self.set_settings(group_mail, {"allowExternalMembers": "true"}, batch)
def allow_join_request(self, group_mail, batch=None):
self.set_settings(group_mail, {"whoCanJoin": "CAN_REQUEST_TO_JOIN"}, batch)