Demos the setting of the access properties by the Groups Settings API.
(argv)
| 102 | |
| 103 | |
| 104 | def main(argv): |
| 105 | """Demos the setting of the access properties by the Groups Settings API.""" |
| 106 | usage = "usage: %prog [options]" |
| 107 | parser = OptionParser(usage=usage) |
| 108 | parser.add_option("--groupId", help="Group email address") |
| 109 | parser.add_option( |
| 110 | "--whoCanInvite", |
| 111 | help="Possible values: ALL_MANAGERS_CAN_INVITE, " "ALL_MEMBERS_CAN_INVITE", |
| 112 | ) |
| 113 | parser.add_option( |
| 114 | "--whoCanJoin", |
| 115 | help="Possible values: ALL_IN_DOMAIN_CAN_JOIN, " |
| 116 | "ANYONE_CAN_JOIN, CAN_REQUEST_TO_JOIN, " |
| 117 | "CAN_REQUEST_TO_JOIN", |
| 118 | ) |
| 119 | parser.add_option( |
| 120 | "--whoCanPostMessage", |
| 121 | help="Possible values: ALL_IN_DOMAIN_CAN_POST, " |
| 122 | "ALL_MANAGERS_CAN_POST, ALL_MEMBERS_CAN_POST, " |
| 123 | "ANYONE_CAN_POST, NONE_CAN_POST", |
| 124 | ) |
| 125 | parser.add_option( |
| 126 | "--whoCanViewGroup", |
| 127 | help="Possible values: ALL_IN_DOMAIN_CAN_VIEW, " |
| 128 | "ALL_MANAGERS_CAN_VIEW, ALL_MEMBERS_CAN_VIEW, " |
| 129 | "ANYONE_CAN_VIEW", |
| 130 | ) |
| 131 | parser.add_option( |
| 132 | "--whoCanViewMembership", |
| 133 | help="Possible values: ALL_IN_DOMAIN_CAN_VIEW, " |
| 134 | "ALL_MANAGERS_CAN_VIEW, ALL_MEMBERS_CAN_VIEW, " |
| 135 | "ANYONE_CAN_VIEW", |
| 136 | ) |
| 137 | (options, args) = parser.parse_args() |
| 138 | |
| 139 | if options.groupId is None: |
| 140 | print("Give the groupId for the group") |
| 141 | parser.print_help() |
| 142 | return |
| 143 | |
| 144 | settings = {} |
| 145 | |
| 146 | if ( |
| 147 | options.whoCanInvite |
| 148 | or options.whoCanJoin |
| 149 | or options.whoCanPostMessage |
| 150 | or options.whoCanPostMessage |
| 151 | or options.whoCanViewMembership |
| 152 | ) is None: |
| 153 | print("No access parameters given in input to update access permissions") |
| 154 | parser.print_help() |
| 155 | else: |
| 156 | settings = { |
| 157 | "whoCanInvite": options.whoCanInvite, |
| 158 | "whoCanJoin": options.whoCanJoin, |
| 159 | "whoCanPostMessage": options.whoCanPostMessage, |
| 160 | "whoCanViewGroup": options.whoCanViewGroup, |
| 161 | "whoCanViewMembership": options.whoCanViewMembership, |
no test coverage detected
searching dependent graphs…