1

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.

Groups whoCanJoin

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" ?

Mibou
  • 936
  • 2
  • 13
  • 25
  • Can you update your question with a minimal and reproducible example that reproduces this behaviour please? This will assist people that may be able to answer. – Peter May 03 '17 at 12:45

2 Answers2

2

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)
Mibou
  • 936
  • 2
  • 13
  • 25
0

Would anyone know how to programmaticaly set this setting to both "Anyone can ask" and "Anyone in the organisation can ask" ?

You're asking how to set the whoCanJoin property so that "Anyone can ask" and "Anyone in the organisation can ask"?

The answer is to set the whoCanJoin property to CAN_REQUEST_TO_JOIN. You don't need to (and cannot) set it to multiple values because this single value ensures that anyone, including those in your organisation, can ask to join.

Here is a link to the documentation for the underlying Group Settings API.

Peter
  • 5,501
  • 2
  • 26
  • 42
  • As I said, setting the `whoCanJoin` setting to `CAN_REQUEST_TO_JOIN` only checks "Anyone in the organisation can ask". It does not check "Anyone can ask" as I wished. – Mibou May 03 '17 at 08:18