MCPcopy Index your code
hub / github.com/googleapis/google-api-python-client / main

Function main

samples/groupssettings/groupsettings.py:104–186  ·  view source on GitHub ↗

Demos the setting of the access properties by the Groups Settings API.

(argv)

Source from the content-addressed store, hash-verified

102
103
104def 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,

Callers 1

groupsettings.pyFile · 0.70

Calls 4

buildFunction · 0.90
access_settingsFunction · 0.85
authorizeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…