gam7 7.10.7__py3-none-any.whl → 7.10.8__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.10.07'
28
+ __version__ = '7.10.08'
29
29
  __license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
30
30
 
31
31
  #pylint: disable=wrong-import-position
@@ -5187,6 +5187,12 @@ def checkGAPIError(e, softErrors=False, retryOnHttpError=False, mapNotFound=True
5187
5187
  return (0, None, None)
5188
5188
  else:
5189
5189
  systemErrorExit(HTTP_ERROR_RC, eContent)
5190
+ requiredScopes = ''
5191
+ wwwAuthenticate = e.resp.get('www-authenticate', '')
5192
+ if 'insufficient_scope' in wwwAuthenticate:
5193
+ mg = re.match(r'.+scope="(.+)"', wwwAuthenticate)
5194
+ if mg:
5195
+ requiredScopes = mg.group(1).split(' ')
5190
5196
  if 'error' in error:
5191
5197
  http_status = error['error']['code']
5192
5198
  reason = ''
@@ -5256,6 +5262,8 @@ def checkGAPIError(e, softErrors=False, retryOnHttpError=False, mapNotFound=True
5256
5262
  elif 'the authenticated user cannot access this service' in lmessage:
5257
5263
  error = makeErrorDict(http_status, GAPI.SERVICE_NOT_AVAILABLE, message)
5258
5264
  elif status == 'PERMISSION_DENIED' or 'the caller does not have permission' in lmessage or 'permission iam.serviceaccountkeys' in lmessage:
5265
+ if requiredScopes:
5266
+ message += f', {Msg.NO_SCOPES_FOR_API.format(API.findAPIforScope(requiredScopes))}'
5259
5267
  error = makeErrorDict(http_status, GAPI.PERMISSION_DENIED, message)
5260
5268
  elif http_status == 404:
5261
5269
  if status == 'NOT_FOUND' or 'requested entity was not found' in lmessage or 'does not exist' in lmessage:
@@ -70247,14 +70255,16 @@ def _finalizeMessageSelectParameters(parameters, queryOrIdsRequired):
70247
70255
  for queryTimeName, queryTimeValue in iter(parameters['queryTimes'].items()):
70248
70256
  parameters['query'] = parameters['query'].replace(f'#{queryTimeName}#', queryTimeValue)
70249
70257
  _mapMessageQueryDates(parameters)
70250
- elif queryOrIdsRequired and parameters['messageEntity'] is None:
70251
- missingArgumentExit('query|matchlabel|ids')
70258
+ elif queryOrIdsRequired and parameters['messageEntity'] is None and not parameters['labelIds']:
70259
+ missingArgumentExit('query|matchlabel|ids|labelids')
70252
70260
  else:
70253
70261
  parameters['query'] = None
70254
70262
  parameters['maxItems'] = parameters['maxToProcess'] if parameters['quick'] and not parameters['labelMatchPattern'] else 0
70255
70263
 
70256
70264
  # gam <UserTypeEntity> archive messages <GroupItem>
70257
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_archive <Number>])|(ids <MessageIDEntity>)
70265
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
70266
+ # [labelids <LabelIDList>]
70267
+ # [quick|notquick] [doit] [max_to_archive <Number>])|(ids <MessageIDEntity>)
70258
70268
  # [csv [todrive <ToDriveAttribute>*]]
70259
70269
  def archiveMessages(users):
70260
70270
  def _processMessageFailed(user, idsList, errMsg, j=0, jcount=0):
@@ -70539,39 +70549,59 @@ def _processMessagesThreads(users, entityType):
70539
70549
  csvPF.writeCSVfile(f'{Act.ToPerform()} Messages')
70540
70550
 
70541
70551
  # gam <UserTypeEntity> delete message|messages
70542
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_delete <Number>])|(ids <MessageIDEntity>)
70552
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
70553
+ # [labelids <LabelIDList>]
70554
+ # [quick|notquick] [doit] [max_to_delete <Number>])|(ids <MessageIDEntity>)
70543
70555
  # [csv [todrive <ToDriveAttribute>*]]
70544
70556
  # gam <UserTypeEntity> modify message|messages
70545
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_modify <Number>])|(ids <MessageIDEntity>)
70557
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
70558
+ # [labelids <LabelIDList>]
70559
+ # [quick|notquick] [doit] [max_to_modify <Number>])|(ids <MessageIDEntity>)
70546
70560
  # (addlabel <LabelName>)* (removelabel <LabelName>)*
70547
70561
  # [csv [todrive <ToDriveAttribute>*]]
70548
70562
  # gam <UserTypeEntity> spam message|messages
70549
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_spam <Number>])|(ids <MessageIDEntity>)
70563
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
70564
+ # [labelids <LabelIDList>]
70565
+ # [quick|notquick] [doit] [max_to_spam <Number>])|(ids <MessageIDEntity>)
70550
70566
  # [csv [todrive <ToDriveAttribute>*]]
70551
70567
  # gam <UserTypeEntity> trash message|messages
70552
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_trash <Number>])|(ids <MessageIDEntity>)
70568
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
70569
+ # [labelids <LabelIDList>]
70570
+ # [quick|notquick] [doit] [max_to_trash <Number>])|(ids <MessageIDEntity>)
70553
70571
  # [csv [todrive <ToDriveAttribute>*]]
70554
70572
  # gam <UserTypeEntity> untrash message|messages
70555
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_untrash <Number>])|(ids <MessageIDEntity>)
70573
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
70574
+ # [labelids <LabelIDList>]
70575
+ # [quick|notquick] [doit] [max_to_untrash <Number>])|(ids <MessageIDEntity>)
70556
70576
  # [csv [todrive <ToDriveAttribute>*]]
70557
70577
  def processMessages(users):
70558
70578
  _processMessagesThreads(users, Ent.MESSAGE)
70559
70579
 
70560
70580
  # gam <UserTypeEntity> delete thread|threads
70561
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_delete <Number>])|(ids <ThreadIDEntity>)
70581
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
70582
+ # [labelids <LabelIDList>]
70583
+ # [quick|notquick] [doit] [max_to_delete <Number>])|(ids <ThreadIDEntity>)
70562
70584
  # [csv [todrive <ToDriveAttribute>*]]
70563
70585
  # gam <UserTypeEntity> modify thread|threads
70564
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_modify <Number>])|(ids <ThreadIDEntity>)
70586
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
70587
+ # [labelids <LabelIDList>]
70588
+ # [quick|notquick] [doit] [max_to_modify <Number>])|(ids <ThreadIDEntity>)
70565
70589
  # (addlabel <LabelName>)* (removelabel <LabelName>)*
70566
70590
  # [csv [todrive <ToDriveAttribute>*]]
70567
70591
  # gam <UserTypeEntity> spam thread|threads
70568
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_spam <Number>])|(ids <ThreadIDEntity>)
70592
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
70593
+ # [labelids <LabelIDList>]
70594
+ # [quick|notquick] [doit] [max_to_spam <Number>])|(ids <ThreadIDEntity>)
70569
70595
  # [csv [todrive <ToDriveAttribute>*]]
70570
70596
  # gam <UserTypeEntity> trash thread|threads
70571
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_trash <Number>])|(ids <MessageIDEntity>)
70597
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
70598
+ # [labelids <LabelIDList>]
70599
+ # [quick|notquick] [doit] [max_to_trash <Number>])|(ids <ThreadIDEntity>)
70572
70600
  # [csv [todrive <ToDriveAttribute>*]]
70573
70601
  # gam <UserTypeEntity> untrash thread|threads
70574
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+ [quick|notquick] [doit] [max_to_untrash <Number>])|(ids <ThreadIDEntity>)
70602
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+
70603
+ # [labelids <LabelIDList>]
70604
+ # [quick|notquick] [doit] [max_to_untrash <Number>])|(ids <ThreadIDEntity>)
70575
70605
  # [csv [todrive <ToDriveAttribute>*]]
70576
70606
  def processThreads(users):
70577
70607
  _processMessagesThreads(users, Ent.THREAD)
@@ -71993,7 +72023,9 @@ def printShowMessagesThreads(users, entityType):
71993
72023
  csvPF.writeCSVfile('Message Counts' if not show_labels else 'Message Label Counts')
71994
72024
 
71995
72025
  # gam <UserTypeEntity> print message|messages [todrive <ToDriveAttribute>*]
71996
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])* [quick|notquick] [max_to_print <Number>] [includespamtrash])|(ids <MessageIDEntity>)
72026
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])*
72027
+ # [labelids <LabelIDList>]
72028
+ # [quick|notquick] [max_to_print <Number>] [includespamtrash])|(ids <MessageIDEntity>)
71997
72029
  # [labelmatchpattern <REMatchPattern>] [sendermatchpattern <REMatchPattern>]
71998
72030
  # [headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String>] [dateheaderconverttimezone [<Boolean>]]
71999
72031
  # [showlabels] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
@@ -72003,7 +72035,9 @@ def printShowMessagesThreads(users, entityType):
72003
72035
  # [showattachments [noshowtextplain]]]
72004
72036
  # (addcsvdata <FieldName> <String>)*
72005
72037
  # gam <UserTypeEntity> show message|messages
72006
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])* [quick|notquick] [max_to_show <Number>] [includespamtrash])|(ids <MessageIDEntity>)
72038
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])*
72039
+ # [labelids <LabelIDList>]
72040
+ # [quick|notquick] [max_to_show <Number>] [includespamtrash])|(ids <MessageIDEntity>)
72007
72041
  # [labelmatchpattern <REMatchPattern>] [sendermatchpattern <REMatchPattern>]
72008
72042
  # [headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String>] [dateheaderconverttimezone [<Boolean>]]
72009
72043
  # [showlabels] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
@@ -72016,7 +72050,9 @@ def printShowMessages(users):
72016
72050
  printShowMessagesThreads(users, Ent.MESSAGE)
72017
72051
 
72018
72052
  # gam <UserTypeEntity> print thread|threads [todrive <ToDriveAttribute>*]
72019
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])* [quick|notquick] [max_to_print <Number>] [includespamtrash])|(ids <ThreadIDEntity>)
72053
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])*
72054
+ # [labelids <LabelIDList>]
72055
+ # [quick|notquick] [max_to_print <Number>] [includespamtrash])|(ids <ThreadIDEntity>)
72020
72056
  # [labelmatchpattern <REMatchPattern>]
72021
72057
  # [headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String>] [dateheaderconverttimezone [<Boolean>]]
72022
72058
  # [showlabels] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
@@ -72026,7 +72062,9 @@ def printShowMessages(users):
72026
72062
  # [showattachments [noshowtextplain]]]
72027
72063
  # (addcsvdata <FieldName> <String>)*
72028
72064
  # gam <UserTypeEntity> show thread|threads
72029
- # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])* [quick|notquick] [max_to_show <Number>] [includespamtrash])|(ids <ThreadIDEntity>)
72065
+ # (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])*
72066
+ # [labelids <LabelIDList>]
72067
+ # [quick|notquick] [max_to_show <Number>] [includespamtrash])|(ids <ThreadIDEntity>)
72030
72068
  # [labelmatchpattern <REMatchPattern>]
72031
72069
  # [headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String>] [dateheaderconverttimezone [<Boolean>]]
72032
72070
  # [showlabels] [showbody] [showhtml] [showdate] [showsize] [showsnippet]
gam/gamlib/glapi.py CHANGED
@@ -226,15 +226,15 @@ _INFO = {
226
226
  CHROMEMANAGEMENT_TELEMETRY: {'name': 'Chrome Management API - Telemetry', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHROMEMANAGEMENT},
227
227
  CHROMEPOLICY: {'name': 'Chrome Policy API', 'version': 'v1', 'v2discovery': True},
228
228
  CHROMEVERSIONHISTORY: {'name': 'Chrome Version History API', 'version': 'v1', 'v2discovery': True},
229
- CLOUDCHANNEL: {'name': 'Channel Channel API', 'version': 'v1', 'v2discovery': True},
230
- CLOUDIDENTITY_DEVICES: {'name': 'Cloud Identity Devices API', 'version': 'v1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
231
- CLOUDIDENTITY_GROUPS: {'name': 'Cloud Identity Groups API', 'version': 'v1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
232
- CLOUDIDENTITY_GROUPS_BETA: {'name': 'Cloud Identity Groups API', 'version': 'v1beta1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
233
- CLOUDIDENTITY_INBOUND_SSO: {'name': 'Cloud Identity Inbound SSO API', 'version': 'v1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
234
- CLOUDIDENTITY_ORGUNITS: {'name': 'Cloud Identity OrgUnits API', 'version': 'v1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
235
- CLOUDIDENTITY_ORGUNITS_BETA: {'name': 'Cloud Identity OrgUnits API', 'version': 'v1beta1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
236
- CLOUDIDENTITY_POLICY: {'name': 'Cloud Identity Policy API', 'version': 'v1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
237
- CLOUDIDENTITY_USERINVITATIONS: {'name': 'Cloud Identity User Invitations API', 'version': 'v1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
229
+ CLOUDCHANNEL: {'name': 'Cloud Channel API', 'version': 'v1', 'v2discovery': True},
230
+ CLOUDIDENTITY_DEVICES: {'name': 'Cloud Identity API - Devices', 'version': 'v1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
231
+ CLOUDIDENTITY_GROUPS: {'name': 'Cloud Identity API - Groups', 'version': 'v1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
232
+ CLOUDIDENTITY_GROUPS_BETA: {'name': 'Cloud Identity API - Groups Beta', 'version': 'v1beta1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
233
+ CLOUDIDENTITY_INBOUND_SSO: {'name': 'Cloud Identity API - Inbound SSO Settings', 'version': 'v1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
234
+ CLOUDIDENTITY_ORGUNITS: {'name': 'Cloud Identity API - OrgUnits', 'version': 'v1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
235
+ CLOUDIDENTITY_ORGUNITS_BETA: {'name': 'Cloud Identity API - OrgUnits Beta', 'version': 'v1beta1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
236
+ CLOUDIDENTITY_POLICY: {'name': 'Cloud Identity API - Policy', 'version': 'v1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
237
+ CLOUDIDENTITY_USERINVITATIONS: {'name': 'Cloud Identity API - User Invitations', 'version': 'v1', 'v2discovery': True, 'mappedAPI': 'cloudidentity'},
238
238
  CLOUDRESOURCEMANAGER: {'name': 'Cloud Resource Manager API v3', 'version': 'v3', 'v2discovery': True},
239
239
  CONTACTS: {'name': 'Contacts API', 'version': 'v3', 'v2discovery': False},
240
240
  CONTACTDELEGATION: {'name': 'Contact Delegation API', 'version': 'v1', 'v2discovery': True, 'localjson': True},
@@ -258,13 +258,13 @@ _INFO = {
258
258
  LICENSING: {'name': 'License Manager API', 'version': 'v1', 'v2discovery': True},
259
259
  LOOKERSTUDIO: {'name': 'Looker Studio API', 'version': 'v1', 'v2discovery': True, 'localjson': True},
260
260
  MEET: {'name': 'Meet API', 'version': 'v2', 'v2discovery': True},
261
- MEET_BETA: {'name': 'Meet API', 'version': 'v2beta', 'v2discovery': True, 'localjson': True, 'mappedAPI': MEET},
261
+ MEET_BETA: {'name': 'Meet API Beta', 'version': 'v2beta', 'v2discovery': True, 'localjson': True, 'mappedAPI': MEET},
262
262
  OAUTH2: {'name': 'OAuth2 API', 'version': 'v2', 'v2discovery': False},
263
263
  ORGPOLICY: {'name': 'Organization Policy API', 'version': 'v2', 'v2discovery': True},
264
264
  PEOPLE: {'name': 'People API', 'version': 'v1', 'v2discovery': True},
265
265
  PEOPLE_DIRECTORY: {'name': 'People Directory API', 'version': 'v1', 'v2discovery': True, 'mappedAPI': PEOPLE},
266
266
  PEOPLE_OTHERCONTACTS: {'name': 'People API - Other Contacts', 'version': 'v1', 'v2discovery': True, 'mappedAPI': PEOPLE},
267
- PRINTERS: {'name': 'Directory API Printers', 'version': 'directory_v1', 'v2discovery': True, 'mappedAPI': 'admin'},
267
+ PRINTERS: {'name': 'Directory API - Printers', 'version': 'directory_v1', 'v2discovery': True, 'mappedAPI': 'admin'},
268
268
  PUBSUB: {'name': 'Pub / Sub API', 'version': 'v1', 'v2discovery': True},
269
269
  REPORTS: {'name': 'Reports API', 'version': 'reports_v1', 'v2discovery': True, 'mappedAPI': 'admin'},
270
270
  RESELLER: {'name': 'Reseller API', 'version': 'v1', 'v2discovery': True},
@@ -362,29 +362,29 @@ _CLIENT_SCOPES = [
362
362
  'subscopes': READONLY,
363
363
  'offByDefault': True,
364
364
  'scope': 'https://www.googleapis.com/auth/apps.order'},
365
- {'name': 'Cloud Identity Groups API',
365
+ {'name': 'Cloud Identity API - Groups',
366
366
  'api': CLOUDIDENTITY_GROUPS,
367
367
  'subscopes': READONLY,
368
368
  'scope': 'https://www.googleapis.com/auth/cloud-identity.groups'},
369
- {'name': 'Cloud Identity Groups API Beta (Enables group locking/unlocking)',
369
+ {'name': 'Cloud Identity API - Groups Beta (Enables group locking/unlocking)',
370
370
  'api': CLOUDIDENTITY_GROUPS_BETA,
371
371
  'subscopes': [],
372
372
  'scope': 'https://www.googleapis.com/auth/cloud-identity.groups'},
373
- {'name': 'Cloud Identity - Inbound SSO Settings',
373
+ {'name': 'Cloud Identity API - Inbound SSO Settings',
374
374
  'api': CLOUDIDENTITY_INBOUND_SSO,
375
375
  'subscopes': READONLY,
376
376
  'scope': 'https://www.googleapis.com/auth/cloud-identity.inboundsso'},
377
- {'name': 'Cloud Identity OrgUnits API',
377
+ {'name': 'Cloud Identity API - OrgUnits Beta',
378
378
  'api': CLOUDIDENTITY_ORGUNITS_BETA,
379
379
  'subscopes': READONLY,
380
380
  'scope': 'https://www.googleapis.com/auth/cloud-identity.orgunits'},
381
- {'name': 'Cloud Identity - Policy',
381
+ {'name': 'Cloud Identity API - Policy',
382
382
  'api': CLOUDIDENTITY_POLICY,
383
383
  'subscopes': READONLY,
384
384
  'roByDefault': True,
385
385
  'scope': 'https://www.googleapis.com/auth/cloud-identity.policies'
386
386
  },
387
- {'name': 'Cloud Identity User Invitations API',
387
+ {'name': 'Cloud Identity API - User Invitations',
388
388
  'api': CLOUDIDENTITY_USERINVITATIONS,
389
389
  'subscopes': READONLY,
390
390
  'scope': 'https://www.googleapis.com/auth/cloud-identity.userinvitations'},
@@ -833,3 +833,27 @@ def getSvcAcctScopesList(userServiceAccountAccessOnly, svcAcctSpecialScopes):
833
833
 
834
834
  def hasLocalJSON(api):
835
835
  return _INFO[api].get('localjson', False)
836
+
837
+ def findAPIforScope(scopesList):
838
+ def checkScopeMatch(scope, cscope):
839
+ if cscope['scope'] == scope:
840
+ requiredAPIs.append(cscope['name'])
841
+ return True
842
+ if cscope['subscopes'] == READONLY and cscope['scope']+'.readonly' == scope:
843
+ requiredAPIs.append(cscope['name']+' (supports readonly)')
844
+ return True
845
+ return False
846
+
847
+ requiredAPIs = []
848
+ for scope in scopesList:
849
+ for cscope in _CLIENT_SCOPES:
850
+ if checkScopeMatch(scope, cscope):
851
+ break
852
+ else:
853
+ for cscope in _SVCACCT_SCOPES:
854
+ if checkScopeMatch(scope, cscope):
855
+ break
856
+ if not requiredAPIs:
857
+ requiredAPIs = scopesList
858
+ return ' or '.join(requiredAPIs)
859
+
gam/gamlib/glmsgs.py CHANGED
@@ -184,8 +184,8 @@ ALREADY_EXISTS_IN_TARGET_FOLDER = 'Already exists in {0}: {1}'
184
184
  ALREADY_EXISTS_USE_MERGE_ARGUMENT = 'Already exists; use the "merge" argument to merge the labels'
185
185
  API_ACCESS_DENIED = 'API access Denied'
186
186
  API_CALLS_RETRY_DATA = 'API calls retry data\n'
187
- API_CHECK_CLIENT_AUTHORIZATION = 'Please make sure the Client ID: {0} is authorized for the appropriate API or scopes:\n{1}\n\nRun: gam oauth create\n'
188
- API_CHECK_SVCACCT_AUTHORIZATION = 'Please make sure the Service Account Client ID: {0} is authorized for the appropriate API or scopes:\n{1}\n\nRun: gam user {2} update serviceaccount\n'
187
+ API_CHECK_CLIENT_AUTHORIZATION = 'Please make sure the Client ID: {0} is authorized for the appropriate API or scopes: {1}\n\nRun: gam oauth create\n'
188
+ API_CHECK_SVCACCT_AUTHORIZATION = 'Please make sure the Service Account Client ID: {0} is authorized for the appropriate API or scopes: {1}\n\nRun: gam user {2} update serviceaccount\n'
189
189
  API_ERROR_SETTINGS = 'API error, some settings not set'
190
190
  ARE_BOTH_REQUIRED = 'Arguments {0} and {1} are both required'
191
191
  ARE_MUTUALLY_EXCLUSIVE = 'Arguments {0} and {1} are mutually exclusive'
@@ -425,7 +425,7 @@ NO_LABELS_TO_PROCESS = 'No Labels to process'
425
425
  NO_MESSAGES_WITH_LABEL = 'No Messages with Label'
426
426
  NO_PARENTS_TO_CONVERT_TO_SHORTCUTS = 'No parents to convert to shortcuts'
427
427
  NO_REPORT_AVAILABLE = 'No {0} report available.'
428
- NO_SCOPES_FOR_API = 'There are no scopes authorized for the {0}'
428
+ NO_SCOPES_FOR_API = 'There are no scopes authorized for the API(s): {0}'
429
429
  NO_SERIAL_NUMBERS_SPECIFIED = 'No serial numbers specified'
430
430
  NO_SSO_PROFILE_MATCHES = 'No SSO profile matches display name {0}'
431
431
  NO_SSO_PROFILE_ASSIGNED = 'No SSO profile assigned to {0} {1}'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gam7
3
- Version: 7.10.7
3
+ Version: 7.10.8
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=gqwRxpsHisE3vG2X2AHWvt6mgfwCTjW1rGYI2q0z9ao,3534107
1
+ gam/__init__.py,sha256=dylNcZjzYccpgDnK8eV0UehP3HfMc_XbIv8AW7NKuf8,3534966
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
@@ -23,7 +23,7 @@ gam/atom/token_store.py,sha256=7E6Ecvxa86WCvl1pJAhv78jg9OxQv8pMtIUcPhZCq04,3803
23
23
  gam/atom/url.py,sha256=pxO1TlORxyKQTQ1bkBE1unFzjnv9c8LjJkm-UEORShY,4276
24
24
  gam/gamlib/__init__.py,sha256=z5mF-y0j8pm-YNFBaiuxB4M_GAUPG-cXWwrhYwrVReM,679
25
25
  gam/gamlib/glaction.py,sha256=1Il_HrChVnPkzZwiZs5au4mFQVtq4K1Z42uIuR6qdnI,9419
26
- gam/gamlib/glapi.py,sha256=A6kdyCacc9tvTaxMUNvWj8jWbOrss8e8XdkqF1xbN70,34572
26
+ gam/gamlib/glapi.py,sha256=27NW2etvdNK4jfR699eqFzhV4gPotijXIQeX-wxCvHA,35319
27
27
  gam/gamlib/glcfg.py,sha256=bNTckxzIM_HruxO2DfYsDbEgqOIz1RX6CbU6XOQQQyg,28296
28
28
  gam/gamlib/glclargs.py,sha256=Ohe746FOQqMlXlutH-XJ6E1unYNzf_EJhdubnPp3new,42472
29
29
  gam/gamlib/glentity.py,sha256=c9-7MAp0HruXEUVq8Nwkllxc4KypFeZRUFkvVzPwrwk,33760
@@ -31,7 +31,7 @@ gam/gamlib/glgapi.py,sha256=2mu7DQGGYmF7ZGXeBQu_mT1FNZgXbEQqcddJjHzbvE4,39833
31
31
  gam/gamlib/glgdata.py,sha256=weRppttWm6uRyqtBoGPKoHiNZ2h28nhfUV4J_mbCszY,2707
32
32
  gam/gamlib/glglobals.py,sha256=J0xcHggVrUBzHJ5GruenKV-qV1zPKcK2qWgAgN3i5Jw,9608
33
33
  gam/gamlib/glindent.py,sha256=RfBa2LDfLIqPLL5vMfC689TCVmqn8xf-qulSzkiatrc,1228
34
- gam/gamlib/glmsgs.py,sha256=uSshtTyemMcJGCnYMy3hIilYHIh-IHFbCLlY2aAyTGM,33798
34
+ gam/gamlib/glmsgs.py,sha256=c6ff4fetFjcMtOA37-jdkNNdQVgmFgbkzoUPt99vcpI,33804
35
35
  gam/gamlib/glskus.py,sha256=e1u3zw1MGQjBgAFXqjrGWQl2d7eYpVlMYGpIKNwjskQ,15360
36
36
  gam/gamlib/gluprop.py,sha256=IyPLCyvn7-NHTUenM71YPQPXRZXx6CB5q-GtJ-FYd1c,11461
37
37
  gam/gamlib/glverlibs.py,sha256=xoQXiwcE_-HVYKv-VYA8O0mazRsc9mN-_ysj1dAlMyc,992
@@ -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.10.7.dist-info/METADATA,sha256=magKLnQvWiUc1Exm6w0uq8CAPWXSSw8VeANe4O4yWqs,2978
69
- gam7-7.10.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
70
- gam7-7.10.7.dist-info/entry_points.txt,sha256=HVUM5J7dA8YwvJfG30jiLefR19ExMs387TWugWd9sf4,42
71
- gam7-7.10.7.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
72
- gam7-7.10.7.dist-info/RECORD,,
68
+ gam7-7.10.8.dist-info/METADATA,sha256=aj7mavAYxuN9vF7DjO56zXVMgQoY2BW2SkVq27MFCv8,2978
69
+ gam7-7.10.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
70
+ gam7-7.10.8.dist-info/entry_points.txt,sha256=HVUM5J7dA8YwvJfG30jiLefR19ExMs387TWugWd9sf4,42
71
+ gam7-7.10.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
72
+ gam7-7.10.8.dist-info/RECORD,,
File without changes