gam7 7.9.0__py3-none-any.whl → 7.9.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of gam7 might be problematic. Click here for more details.

gam/__init__.py CHANGED
@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
25
25
  """
26
26
 
27
27
  __author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
28
- __version__ = '7.09.00'
28
+ __version__ = '7.09.02'
29
29
  __license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
30
30
 
31
31
  #pylint: disable=wrong-import-position
@@ -25947,7 +25947,7 @@ def exitIfChatNotConfigured(chat, kvList, errMsg, i, count):
25947
25947
  if (('No bot associated with this project.' in errMsg) or
25948
25948
  ('Invalid project number.' in errMsg) or
25949
25949
  ('Google Chat app not found.' in errMsg)):
25950
- systemErrorExit(API_ACCESS_DENIED_RC, Msg.TO_SET_UP_GOOGLE_CHAT.format(setupChatURL(chat)))
25950
+ systemErrorExit(API_ACCESS_DENIED_RC, Msg.TO_SET_UP_GOOGLE_CHAT.format(setupChatURL(chat), GM.Globals[GM.OAUTH2SERVICE_JSON_DATA]['project_id']))
25951
25951
  entityActionFailedWarning(kvList, errMsg, i, count)
25952
25952
 
25953
25953
  def _getChatAdminAccess(adminAPI, userAPI):
@@ -28118,7 +28118,10 @@ def simplifyChromeSchema(schema):
28118
28118
  'settings': {}
28119
28119
  }
28120
28120
  fieldDescriptions = schema['fieldDescriptions']
28121
+ savedSettingName = ''
28122
+ savedTypeName = ''
28121
28123
  for mtype in schema['definition']['messageType']:
28124
+ numSettings = len(mtype['field'])
28122
28125
  for setting in mtype['field']:
28123
28126
  setting_name = setting['name']
28124
28127
  setting_dict = {'name': setting_name,
@@ -28126,6 +28129,9 @@ def simplifyChromeSchema(schema):
28126
28129
  'descriptions': [],
28127
28130
  'type': setting['type'],
28128
28131
  }
28132
+ if mtype['name'] == savedTypeName and numSettings == 1:
28133
+ setting_dict['name'] = savedSettingName
28134
+ savedTypeName = ''
28129
28135
  if setting_dict['type'] == 'TYPE_STRING' and setting.get('label') == 'LABEL_REPEATED':
28130
28136
  setting_dict['type'] = 'TYPE_LIST'
28131
28137
  if setting_dict['type'] == 'TYPE_ENUM':
@@ -28147,6 +28153,8 @@ def simplifyChromeSchema(schema):
28147
28153
  break
28148
28154
  break
28149
28155
  elif setting_dict['type'] == 'TYPE_MESSAGE':
28156
+ savedSettingName = setting_name
28157
+ savedTypeName = setting['typeName']
28150
28158
  continue
28151
28159
  else:
28152
28160
  setting_dict['enums'] = None
@@ -28252,14 +28260,11 @@ def doDeleteChromePolicy():
28252
28260
  entityActionFailedWarning(kvList, str(e))
28253
28261
 
28254
28262
  CHROME_SCHEMA_SPECIAL_CASES = {
28263
+ # duration
28255
28264
  'chrome.users.AutoUpdateCheckPeriodNewV2':
28256
28265
  {'autoupdatecheckperiodminutesnew':
28257
28266
  {'casedField': 'autoUpdateCheckPeriodMinutesNew',
28258
28267
  'type': 'duration', 'minVal': 1, 'maxVal': 720}},
28259
- 'chrome.users.Avatar':
28260
- {'useravatarimage':
28261
- {'casedField': 'userAvatarImage',
28262
- 'type': 'downloadUri'}},
28263
28268
  'chrome.users.BrowserSwitcherDelayDurationV2':
28264
28269
  {'browserswitcherdelayduration':
28265
28270
  {'casedField': 'browserSwitcherDelayDuration',
@@ -28301,10 +28306,6 @@ CHROME_SCHEMA_SPECIAL_CASES = {
28301
28306
  {'maxinvalidationfetchdelay':
28302
28307
  {'casedField': 'maxInvalidationFetchDelay',
28303
28308
  'type': 'duration', 'minVal': 1, 'maxVal': 30, 'default': 10}},
28304
- 'chrome.users.PrintingMaxSheetsAllowed':
28305
- {'printingmaxsheetsallowednullable':
28306
- {'casedField': 'printingMaxSheetsAllowedNullable',
28307
- 'type': 'value', 'minVal': 1, 'maxVal': None}},
28308
28309
  'chrome.users.PrintJobHistoryExpirationPeriodNewV2':
28309
28310
  {'printjobhistoryexpirationperioddaysnew':
28310
28311
  {'casedField': 'printJobHistoryExpirationPeriodDaysNew',
@@ -28328,10 +28329,6 @@ CHROME_SCHEMA_SPECIAL_CASES = {
28328
28329
  'updatessuppressedstarttime':
28329
28330
  {'casedField': 'updatesSuppressedStartTime',
28330
28331
  'type': 'timeOfDay'}},
28331
- 'chrome.users.Wallpaper':
28332
- {'wallpaperimage':
28333
- {'casedField': 'wallpaperImage',
28334
- 'type': 'downloadUri'}},
28335
28332
  'chrome.devices.EnableReportUploadFrequencyV2':
28336
28333
  {'reportdeviceuploadfrequency':
28337
28334
  {'casedField': 'reportDeviceUploadFrequency',
@@ -28340,10 +28337,6 @@ CHROME_SCHEMA_SPECIAL_CASES = {
28340
28337
  {'uptimelimitduration':
28341
28338
  {'casedField': 'uptimeLimitDuration',
28342
28339
  'type': 'duration', 'minVal': 1, 'maxVal': 365}},
28343
- 'chrome.devices.SignInWallpaperImage':
28344
- {'devicewallpaperimage':
28345
- {'casedField': 'deviceWallpaperImage',
28346
- 'type': 'downloadUri'}},
28347
28340
  'chrome.devices.kiosk.AcPowerSettingsV2':
28348
28341
  {'acidletimeout':
28349
28342
  {'casedField': 'acIdleTimeout',
@@ -28370,10 +28363,6 @@ CHROME_SCHEMA_SPECIAL_CASES = {
28370
28363
  'batteryscreenofftimeout':
28371
28364
  {'casedField': 'batteryScreenOffTimeout',
28372
28365
  'type': 'duration', 'minVal': 0, 'maxVal': 35000}},
28373
- 'chrome.devices.managedguest.Avatar':
28374
- {'useravatarimage':
28375
- {'casedField': 'userAvatarImage',
28376
- 'type': 'downloadUri'}},
28377
28366
  'chrome.devices.managedguest.BrowsingDataLifetimeV2':
28378
28367
  {'browsinghistoryttl':
28379
28368
  {'casedField': 'browsingHistoryTtl',
@@ -28415,6 +28404,56 @@ CHROME_SCHEMA_SPECIAL_CASES = {
28415
28404
  {'sessiondurationlimit':
28416
28405
  {'casedField': 'sessionDurationLimit',
28417
28406
  'type': 'duration', 'minVal': 1, 'maxVal': 1440}},
28407
+ # value
28408
+ 'chrome.users.GaiaLockScreenOfflineSigninTimeLimitDays':
28409
+ {'gaialockscreenofflinesignintimelimitdays':
28410
+ {'casedField': 'gaiaLockScreenOfflineSigninTimeLimitDays',
28411
+ 'type': 'value', 'minVal': 0, 'maxVal': 365}},
28412
+ 'chrome.users.GaiaOfflineSigninTimeLimitDays':
28413
+ {'gaiaofflinesignintimelimitdays':
28414
+ {'casedField': 'gaiaOfflineSigninTimeLimitDays',
28415
+ 'type': 'value', 'minVal': 0, 'maxVal': 365}},
28416
+ 'chrome.users.PrintingMaxSheetsAllowed':
28417
+ {'printingmaxsheetsallowednullable':
28418
+ {'casedField': 'printingMaxSheetsAllowedNullable',
28419
+ 'type': 'value', 'minVal': 1, 'maxVal': None}},
28420
+ 'chrome.users.RemoteAccessHostClipboardSizeBytes':
28421
+ {'remoteaccesshostclipboardsizebytes':
28422
+ {'casedField': 'remoteAccessHostClipboardSizeBytes',
28423
+ 'type': 'value', 'minVal': 0, 'maxVal': 2147483647}},
28424
+ 'chrome.users.SamlLockScreenOfflineSigninTimeLimitDays':
28425
+ {'samllockscreenofflinesignintimelimitdays':
28426
+ {'casedField': 'samlLockScreenOfflineSigninTimeLimitDays',
28427
+ 'type': 'value', 'minVal': 0, 'maxVal': 365}},
28428
+ 'chrome.devices.ExtensionCacheSize':
28429
+ {'extensioncachesize':
28430
+ {'casedField': 'extensionCacheSize',
28431
+ 'type': 'value', 'minVal': 1048576, 'maxVal': None, 'default': 268435456}},
28432
+ 'chrome.devices.managedguest.PrintingMaxSheetsAllowed':
28433
+ {'printingmaxsheetsallowednullable':
28434
+ {'casedField': 'printingMaxSheetsAllowedNullable',
28435
+ 'type': 'value', 'minVal': 1, 'maxVal': None}},
28436
+ 'chrome.devices.managedguest.RemoteAccessHostClipboardSizeBytes':
28437
+ {'remoteaccesshostclipboardsizebytes':
28438
+ {'casedField': 'remoteAccessHostClipboardSizeBytes',
28439
+ 'type': 'value', 'minVal': 0, 'maxVal': 2147483647}},
28440
+ # downloadUri
28441
+ 'chrome.users.Avatar':
28442
+ {'useravatarimage':
28443
+ {'casedField': 'userAvatarImage',
28444
+ 'type': 'downloadUri'}},
28445
+ 'chrome.users.Wallpaper':
28446
+ {'wallpaperimage':
28447
+ {'casedField': 'wallpaperImage',
28448
+ 'type': 'downloadUri'}},
28449
+ 'chrome.devices.SignInWallpaperImage':
28450
+ {'devicewallpaperimage':
28451
+ {'casedField': 'deviceWallpaperImage',
28452
+ 'type': 'downloadUri'}},
28453
+ 'chrome.devices.managedguest.Avatar':
28454
+ {'useravatarimage':
28455
+ {'casedField': 'userAvatarImage',
28456
+ 'type': 'downloadUri'}},
28418
28457
  'chrome.devices.managedguest.Wallpaper':
28419
28458
  {'wallpaperimage':
28420
28459
  {'casedField': 'wallpaperImage',
@@ -28892,7 +28931,7 @@ def _showChromePolicySchema(schema, FJQC, i=0, count=0):
28892
28931
  return
28893
28932
  printEntity([Ent.CHROME_POLICY_SCHEMA, schema['name']], i, count)
28894
28933
  Ind.Increment()
28895
- showJSON(None, schema)
28934
+ showJSON(None, schema, dictObjectsKey={'messageType': 'name', 'field': 'name'})
28896
28935
  Ind.Decrement()
28897
28936
 
28898
28937
  CHROME_POLICY_SCHEMA_FIELDS_CHOICE_MAP = {
@@ -28915,6 +28954,9 @@ CHROME_POLICY_SCHEMA_FIELDS_CHOICE_MAP = {
28915
28954
  # [formatjson]
28916
28955
  def doInfoChromePolicySchemas():
28917
28956
  cp = buildGAPIObject(API.CHROMEPOLICY)
28957
+ if checkArgumentPresent('std'):
28958
+ doInfoChromePolicySchemasStd(cp)
28959
+ return
28918
28960
  FJQC = FormatJSONQuoteChar()
28919
28961
  fieldsList = []
28920
28962
  name = _getChromePolicySchemaName()
@@ -28943,7 +28985,7 @@ def doInfoChromePolicySchemas():
28943
28985
  # [filter <String>]
28944
28986
  # <ChromePolicySchemaFieldName>* [fields <ChromePolicySchemaFieldNameList>]
28945
28987
  # [[formatjson [quotechar <Character>]]
28946
- def doPrintShowChromeSchemas():
28988
+ def doPrintShowChromePolicySchemas():
28947
28989
  def _printChromePolicySchema(schema):
28948
28990
  row = flattenJSON(schema)
28949
28991
  if not FJQC.formatJSON:
@@ -28957,10 +28999,12 @@ def doPrintShowChromeSchemas():
28957
28999
  row['JSON'] = json.dumps(cleanJSON(schema), ensure_ascii=False, sort_keys=True)
28958
29000
  csvPF.WriteRowNoFilter(row)
28959
29001
 
28960
- if checkArgumentPresent('std'):
28961
- doShowChromeSchemasStd()
28962
- return
28963
29002
  cp = buildGAPIObject(API.CHROMEPOLICY)
29003
+ if checkArgumentPresent('std'):
29004
+ if not Act.csvFormat():
29005
+ doShowChromePolicySchemasStd(cp)
29006
+ return
29007
+ unknownArgumentExit()
28964
29008
  parent = _getCustomersCustomerIdWithC()
28965
29009
  csvPF = CSVPrintFile(['name', 'schemaName', 'policyDescription',
28966
29010
  'policyApiLifecycle.policyApiLifecycleStage',
@@ -29020,9 +29064,51 @@ def doPrintShowChromeSchemas():
29020
29064
  if csvPF:
29021
29065
  csvPF.writeCSVfile('Chrome Policy Schemas')
29022
29066
 
29067
+ def _showChromePolicySchemaStd(schema):
29068
+ printKeyValueList([f'{schema.get("name")}', f'{schema.get("description")}'])
29069
+ Ind.Increment()
29070
+ for val in schema['settings'].values():
29071
+ vtype = val.get('type')
29072
+ printKeyValueList([f'{val.get("name")}', f'{vtype}'])
29073
+ Ind.Increment()
29074
+ if vtype == 'TYPE_ENUM':
29075
+ enums = val.get('enums', [])
29076
+ descriptions = val.get('descriptions', [])
29077
+ for i in range(len(val.get('enums', []))):
29078
+ printKeyValueList([f'{enums[i]}', f'{descriptions[i]}'])
29079
+ elif vtype == 'TYPE_BOOL':
29080
+ pvs = val.get('descriptions')
29081
+ for pvi in pvs:
29082
+ if isinstance(pvi, dict):
29083
+ pvalue = pvi.get('value')
29084
+ pdescription = pvi.get('description')
29085
+ printKeyValueList([f'{pvalue}', f'{pdescription}'])
29086
+ elif isinstance(pvi, list):
29087
+ printKeyValueList([f'{pvi[0]}'])
29088
+ else:
29089
+ description = val.get('descriptions')
29090
+ if len(description) > 0:
29091
+ printKeyValueList([f'{description[0]}'])
29092
+ Ind.Decrement()
29093
+ Ind.Decrement()
29094
+
29095
+ # gam info chromeschema std <SchemaName>
29096
+ def doInfoChromePolicySchemasStd(cp):
29097
+ name = _getChromePolicySchemaName()
29098
+ checkForExtraneousArguments()
29099
+ try:
29100
+ schema = callGAPI(cp.customers().policySchemas(), 'get',
29101
+ throwReasons=[GAPI.NOT_FOUND, GAPI.BAD_REQUEST, GAPI.FORBIDDEN],
29102
+ name=name)
29103
+ _, schema_dict = simplifyChromeSchema(schema)
29104
+ _showChromePolicySchemaStd(schema_dict)
29105
+ except GAPI.notFound:
29106
+ entityUnknownWarning(Ent.CHROME_POLICY_SCHEMA, name)
29107
+ except (GAPI.badRequest, GAPI.forbidden):
29108
+ accessErrorExit(None)
29109
+
29023
29110
  # gam show chromeschemas std [filter <String>]
29024
- def doShowChromeSchemasStd():
29025
- cp = buildGAPIObject(API.CHROMEPOLICY)
29111
+ def doShowChromePolicySchemasStd(cp):
29026
29112
  sfilter = None
29027
29113
  while Cmd.ArgumentsRemaining():
29028
29114
  myarg = getArgument()
@@ -29038,33 +29124,8 @@ def doShowChromeSchemasStd():
29038
29124
  for schema in result:
29039
29125
  schema_name, schema_dict = simplifyChromeSchema(schema)
29040
29126
  schemas[schema_name.lower()] = schema_dict
29041
- for _, value in sorted(iter(schemas.items())):
29042
- printKeyValueList([f'{value.get("name")}', f'{value.get("description")}'])
29043
- Ind.Increment()
29044
- for val in value['settings'].values():
29045
- vtype = val.get('type')
29046
- printKeyValueList([f'{val.get("name")}', f'{vtype}'])
29047
- Ind.Increment()
29048
- if vtype == 'TYPE_ENUM':
29049
- enums = val.get('enums', [])
29050
- descriptions = val.get('descriptions', [])
29051
- for i in range(len(val.get('enums', []))):
29052
- printKeyValueList([f'{enums[i]}', f'{descriptions[i]}'])
29053
- elif vtype == 'TYPE_BOOL':
29054
- pvs = val.get('descriptions')
29055
- for pvi in pvs:
29056
- if isinstance(pvi, dict):
29057
- pvalue = pvi.get('value')
29058
- pdescription = pvi.get('description')
29059
- printKeyValueList([f'{pvalue}', f'{pdescription}'])
29060
- elif isinstance(pvi, list):
29061
- printKeyValueList([f'{pvi[0]}'])
29062
- else:
29063
- description = val.get('descriptions')
29064
- if len(description) > 0:
29065
- printKeyValueList([f'{description[0]}'])
29066
- Ind.Decrement()
29067
- Ind.Decrement()
29127
+ for _, schema in sorted(iter(schemas.items())):
29128
+ _showChromePolicySchemaStd(schema)
29068
29129
  printBlankLine()
29069
29130
 
29070
29131
  # gam create chromenetwork
@@ -57296,6 +57357,7 @@ def printDiskUsage(users):
57296
57357
  topFolder['path'] = f'{SHARED_DRIVES}{pathDelimiter}{topFolder["name"]}'
57297
57358
  else:
57298
57359
  topFolder['path'] = topFolder['name']
57360
+ topFolder.pop('ownedByMe', None)
57299
57361
  elif topFolder['name'] == MY_DRIVE and not topFolder.get('parents'):
57300
57362
  topFolder['path'] = MY_DRIVE
57301
57363
  else:
@@ -57306,7 +57368,6 @@ def printDiskUsage(users):
57306
57368
  if owners:
57307
57369
  topFolder['Owner'] = owners[0].get('emailAddress', 'Unknown')
57308
57370
  trashFolder['Owner'] = topFolder['Owner']
57309
- topFolder.pop('ownedByMe', None)
57310
57371
  topFolder.pop('parents', None)
57311
57372
  topFolder.update(zeroFolderInfo)
57312
57373
  topFolder.pop(sizeField, None)
@@ -76101,7 +76162,7 @@ MAIN_COMMANDS_WITH_OBJECTS = {
76101
76162
  Cmd.ARG_CHROMENEEDSATTN: doPrintShowChromeNeedsAttn,
76102
76163
  Cmd.ARG_CHROMEPOLICY: doPrintShowChromePolicies,
76103
76164
  Cmd.ARG_CHROMEPROFILE: doPrintShowChromeProfiles,
76104
- Cmd.ARG_CHROMESCHEMA: doPrintShowChromeSchemas,
76165
+ Cmd.ARG_CHROMESCHEMA: doPrintShowChromePolicySchemas,
76105
76166
  Cmd.ARG_CHROMESNVALIDITY: doPrintChromeSnValidity,
76106
76167
  Cmd.ARG_CHROMEVERSIONS: doPrintShowChromeVersions,
76107
76168
  Cmd.ARG_CIGROUP: doPrintCIGroups,
@@ -76233,7 +76294,7 @@ MAIN_COMMANDS_WITH_OBJECTS = {
76233
76294
  Cmd.ARG_CHROMENEEDSATTN: doPrintShowChromeNeedsAttn,
76234
76295
  Cmd.ARG_CHROMEPOLICY: doPrintShowChromePolicies,
76235
76296
  Cmd.ARG_CHROMEPROFILE: doPrintShowChromeProfiles,
76236
- Cmd.ARG_CHROMESCHEMA: doPrintShowChromeSchemas,
76297
+ Cmd.ARG_CHROMESCHEMA: doPrintShowChromePolicySchemas,
76237
76298
  Cmd.ARG_CHROMEVERSIONS: doPrintShowChromeVersions,
76238
76299
  Cmd.ARG_CIGROUPMEMBERS: doShowCIGroupMembers,
76239
76300
  Cmd.ARG_CIPOLICY: doPrintShowCIPolicies,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gam7
3
- Version: 7.9.0
3
+ Version: 7.9.2
4
4
  Summary: CLI tool to manage Google Workspace
5
5
  Project-URL: Homepage, https://github.com/GAM-team/GAM
6
6
  Project-URL: Issues, https://github.com/GAM-team/GAM/issues
@@ -1,4 +1,4 @@
1
- gam/__init__.py,sha256=9lZJAb1VOh7DXESSPZj1YJ-yenkZ1vAec5fNgvhwlLE,3515488
1
+ gam/__init__.py,sha256=k24a3tQujvq-K_PZ-10jWwxI5_JNQF17IeNgswZNo4s,3518201
2
2
  gam/__main__.py,sha256=amz0-959ph6zkZKqjaar4n60yho-T37w6qWI36qx0CA,1049
3
3
  gam/cacerts.pem,sha256=82Ak7btW_2XvocLUvAwPmpx8Chi0oqtZUG1gseLK_t4,50235
4
4
  gam/cbcm-v1.1beta1.json,sha256=xO5XloCQQULmPbFBx5bckdqmbLFQ7sJ2TImhE1ysDIY,19439
@@ -65,8 +65,8 @@ gam/googleapiclient/discovery_cache/base.py,sha256=yCDPtxnbNN-p5_9fzBacC6P3wcUPl
65
65
  gam/googleapiclient/discovery_cache/file_cache.py,sha256=sim3Mg4HgRYo3vX75jvcKy_aV568EvIrtBfvfbw-044,4774
66
66
  gam/iso8601/__init__.py,sha256=Z2PsYbXgAH5a5xzUvgczCboPzqWpm65kRcIngCnhViU,1218
67
67
  gam/iso8601/iso8601.py,sha256=Li2FHZ4sBTWuthuQhyCvmvj0j6At8JbGzkSv2fc2RHU,4384
68
- gam7-7.9.0.dist-info/METADATA,sha256=oJvqu8C_6f7KNMBhg1z0LAhjR5HS-ccmNgHucvMaplU,2977
69
- gam7-7.9.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
70
- gam7-7.9.0.dist-info/entry_points.txt,sha256=HVUM5J7dA8YwvJfG30jiLefR19ExMs387TWugWd9sf4,42
71
- gam7-7.9.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
72
- gam7-7.9.0.dist-info/RECORD,,
68
+ gam7-7.9.2.dist-info/METADATA,sha256=CpMi20gNqtuKBx1Z1Z7K70qhg7vscF_HLoQGNW99DNE,2977
69
+ gam7-7.9.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
70
+ gam7-7.9.2.dist-info/entry_points.txt,sha256=HVUM5J7dA8YwvJfG30jiLefR19ExMs387TWugWd9sf4,42
71
+ gam7-7.9.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
72
+ gam7-7.9.2.dist-info/RECORD,,
File without changes