gam7 7.16.1__py3-none-any.whl → 7.17.1__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.16.01'
28
+ __version__ = '7.17.01'
29
29
  __license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
30
30
 
31
31
  #pylint: disable=wrong-import-position
@@ -46963,8 +46963,8 @@ def doCreateSiteVerification():
46963
46963
  printKeyValueList(['Meta HTML Header Data', webserver_meta_record['token']])
46964
46964
  printBlankLine()
46965
46965
 
46966
- def _showSiteVerificationInfo(site):
46967
- printKeyValueList(['Site', site['site']['identifier']])
46966
+ def _showSiteVerificationInfo(site, i=0, count=0):
46967
+ printKeyValueListWithCount(['Site', site['site']['identifier']], i, count)
46968
46968
  Ind.Increment()
46969
46969
  printKeyValueList(['ID', unquote(site['id'])])
46970
46970
  printKeyValueList(['Type', site['site']['type']])
@@ -47072,11 +47072,83 @@ def doInfoSiteVerification():
47072
47072
  checkForExtraneousArguments()
47073
47073
  sites = callGAPIitems(verif.webResource(), 'list', 'items')
47074
47074
  if sites:
47075
+ count = len(sites)
47076
+ i = 0
47075
47077
  for site in sorted(sites, key=lambda k: (k['site']['type'], k['site']['identifier'])):
47076
- _showSiteVerificationInfo(site)
47078
+ i += 1
47079
+ _showSiteVerificationInfo(site, i, count)
47077
47080
  else:
47078
47081
  printKeyValueList(['No Sites Verified.'])
47079
47082
 
47083
+ # gam <UserTypeEntity> show webresources
47084
+ # gam <UserTypeEntity> print webresources [todrive <ToDriveAttribute>*]
47085
+ def printShowWebResources(users):
47086
+ csvPF = CSVPrintFile(['User', 'site.identifier']) if Act.csvFormat() else None
47087
+ while Cmd.ArgumentsRemaining():
47088
+ myarg = getArgument()
47089
+ if csvPF and myarg == 'todrive':
47090
+ csvPF.GetTodriveParameters()
47091
+ else:
47092
+ unknownArgumentExit()
47093
+ i, count, users = getEntityArgument(users)
47094
+ for user in users:
47095
+ i += 1
47096
+ user, verif = buildGAPIServiceObject(API.SITEVERIFICATION, user, i, count)
47097
+ if not verif:
47098
+ continue
47099
+ sites = callGAPIitems(verif.webResource(), 'list', 'items')
47100
+ jcount = len(sites)
47101
+ if not csvPF:
47102
+ entityPerformActionNumItems([Ent.USER, user], jcount, Ent.WEB_RESOURCE, i, count)
47103
+ Ind.Increment()
47104
+ j = 0
47105
+ for site in sorted(sites, key=lambda k: (k['site']['type'], k['site']['identifier'])):
47106
+ j += 1
47107
+ _showSiteVerificationInfo(site, j, jcount)
47108
+ Ind.Decrement()
47109
+ else:
47110
+ for site in sites:
47111
+ row = flattenJSON(site, flattened={'User': user})
47112
+ csvPF.WriteRowTitles(row)
47113
+ if csvPF:
47114
+ csvPF.writeCSVfile('Web Resources')
47115
+
47116
+ # gam <UserTypeEntity> show webmastersites
47117
+ # gam <UserTypeEntity> print webmastersites [todrive <ToDriveAttribute>*]
47118
+ def printShowWebMasterSites(users):
47119
+ csvPF = CSVPrintFile(['User', 'siteUrl']) if Act.csvFormat() else None
47120
+ while Cmd.ArgumentsRemaining():
47121
+ myarg = getArgument()
47122
+ if csvPF and myarg == 'todrive':
47123
+ csvPF.GetTodriveParameters()
47124
+ else:
47125
+ unknownArgumentExit()
47126
+ i, count, users = getEntityArgument(users)
47127
+ for user in users:
47128
+ i += 1
47129
+ user, searchconsole = buildGAPIServiceObject(API.SEARCHCONSOLE, user, i, count)
47130
+ if not searchconsole:
47131
+ continue
47132
+ sites = callGAPIitems(searchconsole.sites(), 'list', 'siteEntry')
47133
+ jcount = len(sites)
47134
+ if not csvPF:
47135
+ entityPerformActionNumItems([Ent.USER, user], jcount, Ent.WEB_MASTERSITE, i, count)
47136
+ Ind.Increment()
47137
+ j = 0
47138
+ for site in sorted(sites, key=lambda k: k['siteUrl']):
47139
+ j += 1
47140
+ printKeyValueListWithCount(['Site', site['siteUrl']], j, jcount)
47141
+ Ind.Increment()
47142
+ printKeyValueList(['permissionLevel', site['permissionLevel']])
47143
+ Ind.Decrement()
47144
+ Ind.Decrement()
47145
+ else:
47146
+ for site in sites:
47147
+ row = flattenJSON(site, flattened={'User': user})
47148
+ csvPF.WriteRowTitles(row)
47149
+ if csvPF:
47150
+ csvPF.writeCSVfile('Web Master Sites')
47151
+
47080
47152
  def checkCourseExists(croom, courseId, i=0, count=0, entityType=Ent.COURSE):
47081
47153
  courseId = addCourseIdScope(courseId)
47082
47154
  try:
@@ -53818,6 +53890,8 @@ DRIVE_FILE_CONTENT_RESTRICTIONS_CHOICE_MAP = {
53818
53890
  }
53819
53891
 
53820
53892
  DRIVE_FILE_ITEM_DOWNLOAD_RESTRICTION_CHOICE_MAP = {
53893
+ 'downloadrestrictedforreaders': 'restrictedForReaders',
53894
+ 'downloadrestrictedforwriters': 'restrictedForWriters',
53821
53895
  'restrictedforreaders': 'restrictedForReaders',
53822
53896
  'restrictedforwriters': 'restrictedForWriters',
53823
53897
  }
@@ -53873,6 +53947,20 @@ def getDriveFileAddRemoveParentAttribute(myarg, parameters):
53873
53947
  return False
53874
53948
  return True
53875
53949
 
53950
+ def _getDriveFileDownloadRestrictions(myarg, body):
53951
+ subField = myarg
53952
+ if subField.startswith('downloadrestrictions.'):
53953
+ _, subField = subField.split('.', 1)
53954
+ if subField.startswith('itemdownloadrestriction.'):
53955
+ _, subField = subField.split('.', 1)
53956
+ if subField == 'itemdownloadrestriction':
53957
+ subField = getChoice(DRIVE_FILE_ITEM_DOWNLOAD_RESTRICTION_CHOICE_MAP)
53958
+ if subField in DRIVE_FILE_ITEM_DOWNLOAD_RESTRICTION_CHOICE_MAP:
53959
+ body.setdefault('downloadRestrictions', {'itemDownloadRestriction': {}})
53960
+ body['downloadRestrictions']['itemDownloadRestriction'][DRIVE_FILE_ITEM_DOWNLOAD_RESTRICTION_CHOICE_MAP[subField]] = getBoolean()
53961
+ return True
53962
+ return False
53963
+
53876
53964
  def getDriveFileCopyAttribute(myarg, body, parameters):
53877
53965
  if myarg == 'ignoredefaultvisibility':
53878
53966
  parameters[DFA_IGNORE_DEFAULT_VISIBILITY] = getBoolean()
@@ -53908,10 +53996,8 @@ def getDriveFileCopyAttribute(myarg, body, parameters):
53908
53996
  else:
53909
53997
  Cmd.Backup()
53910
53998
  usageErrorExit(Msg.REASON_ONLY_VALID_WITH_CONTENTRESTRICTIONS_READONLY_TRUE)
53911
- elif myarg == 'itemdownloadrestriction':
53912
- body.setdefault('downloadRestrictions', {'itemDownloadRestriction': {}})
53913
- restriction = getChoice(DRIVE_FILE_ITEM_DOWNLOAD_RESTRICTION_CHOICE_MAP, mapChoice=True)
53914
- body['downloadRestrictions']['itemDownloadRestriction'][restriction] = getBoolean()
53999
+ elif _getDriveFileDownloadRestrictions(myarg, body):
54000
+ pass
53915
54001
  elif myarg == 'inheritedpermissionsdisabled':
53916
54002
  body['inheritedPermissionsDisabled'] = getBoolean()
53917
54003
  elif myarg == 'property':
@@ -78284,6 +78370,8 @@ USER_COMMANDS_WITH_OBJECTS = {
78284
78370
  Cmd.ARG_USERLIST: doPrintUserList,
78285
78371
  Cmd.ARG_VACATION: printShowVacation,
78286
78372
  Cmd.ARG_VAULTHOLD: printShowUserVaultHolds,
78373
+ Cmd.ARG_WEBMASTERSITE: printShowWebMasterSites,
78374
+ Cmd.ARG_WEBRESOURCE: printShowWebResources,
78287
78375
  Cmd.ARG_WORKINGLOCATION: printShowWorkingLocation,
78288
78376
  Cmd.ARG_YOUTUBECHANNEL: printShowYouTubeChannel,
78289
78377
  }
@@ -78394,6 +78482,8 @@ USER_COMMANDS_WITH_OBJECTS = {
78394
78482
  Cmd.ARG_TOKEN: printShowTokens,
78395
78483
  Cmd.ARG_VAULTHOLD: printShowUserVaultHolds,
78396
78484
  Cmd.ARG_VACATION: printShowVacation,
78485
+ Cmd.ARG_WEBMASTERSITE: printShowWebMasterSites,
78486
+ Cmd.ARG_WEBRESOURCE: printShowWebResources,
78397
78487
  Cmd.ARG_WORKINGLOCATION: printShowWorkingLocation,
78398
78488
  Cmd.ARG_YOUTUBECHANNEL: printShowYouTubeChannel,
78399
78489
  }
@@ -78645,6 +78735,8 @@ USER_COMMANDS_OBJ_ALIASES = {
78645
78735
  Cmd.ARG_USERS: Cmd.ARG_USER,
78646
78736
  Cmd.ARG_VAULTHOLDS: Cmd.ARG_VAULTHOLD,
78647
78737
  Cmd.ARG_VERIFICATIONCODES: Cmd.ARG_BACKUPCODE,
78738
+ Cmd.ARG_WEBMASTERSITES: Cmd.ARG_WEBMASTERSITE,
78739
+ Cmd.ARG_WEBRESOURCES: Cmd.ARG_WEBRESOURCE,
78648
78740
  Cmd.ARG_WORKINGLOCATIONS: Cmd.ARG_WORKINGLOCATION,
78649
78741
  Cmd.ARG_YOUTUBECHANNELS: Cmd.ARG_YOUTUBECHANNEL,
78650
78742
  }
gam/gamlib/glapi.py CHANGED
@@ -85,6 +85,7 @@ PRINTERS = 'printers'
85
85
  PUBSUB = 'pubsub'
86
86
  REPORTS = 'reports'
87
87
  RESELLER = 'reseller'
88
+ SEARCHCONSOLE = 'searchconsole'
88
89
  SERVICEACCOUNTLOOKUP = 'serviceaccountlookup'
89
90
  SERVICEMANAGEMENT = 'servicemanagement'
90
91
  SERVICEUSAGE = 'serviceusage'
@@ -198,6 +199,7 @@ PROJECT_APIS = [
198
199
  'people.googleapis.com',
199
200
  'pubsub.googleapis.com',
200
201
  'reseller.googleapis.com',
202
+ 'searchconsole.googleapis.com',
201
203
  'sheets.googleapis.com',
202
204
  'siteverification.googleapis.com',
203
205
  'storage-api.googleapis.com',
@@ -271,6 +273,7 @@ _INFO = {
271
273
  PUBSUB: {'name': 'Pub / Sub API', 'version': 'v1', 'v2discovery': True},
272
274
  REPORTS: {'name': 'Reports API', 'version': 'reports_v1', 'v2discovery': True, 'mappedAPI': 'admin'},
273
275
  RESELLER: {'name': 'Reseller API', 'version': 'v1', 'v2discovery': True},
276
+ SEARCHCONSOLE: {'name': 'Search Console API', 'version': 'v1', 'v2discovery': True},
274
277
  SERVICEACCOUNTLOOKUP: {'name': 'Service Account Lookup pseudo-API', 'version': 'v1', 'v2discovery': True, 'localjson': True},
275
278
  SERVICEMANAGEMENT: {'name': 'Service Management API', 'version': 'v1', 'v2discovery': True},
276
279
  SERVICEUSAGE: {'name': 'Service Usage API', 'version': 'v1', 'v2discovery': True},
@@ -697,10 +700,20 @@ _SVCACCT_SCOPES = [
697
700
  'api': PEOPLE_OTHERCONTACTS,
698
701
  'subscopes': [],
699
702
  'scope': 'https://www.googleapis.com/auth/contacts.other.readonly'},
703
+ {'name': 'Search Console API - read only',
704
+ 'api': SEARCHCONSOLE,
705
+ 'subscopes': [],
706
+ 'offByDefault': True,
707
+ 'scope': 'https://www.googleapis.com/auth/webmasters.readonly'},
700
708
  {'name': 'Sheets API',
701
709
  'api': SHEETS,
702
710
  'subscopes': READONLY,
703
711
  'scope': 'https://www.googleapis.com/auth/spreadsheets'},
712
+ {'name': 'Site Verification API',
713
+ 'api': SITEVERIFICATION,
714
+ 'subscopes': [],
715
+ 'offByDefault': True,
716
+ 'scope': 'https://www.googleapis.com/auth/siteverification'},
704
717
  {'name': 'Tag Manager API - Accounts, Containers, Workspaces, Tags - read only',
705
718
  'api': TAGMANAGER,
706
719
  'subscopes': [],
gam/gamlib/glclargs.py CHANGED
@@ -830,6 +830,10 @@ class GamCLArgs():
830
830
  ARG_VERIFICATION = 'verification'
831
831
  ARG_VERIFICATIONCODES = 'verificationcodes'
832
832
  ARG_VERIFY = 'verify'
833
+ ARG_WEBMASTERSITE = 'webmastersite'
834
+ ARG_WEBMASTERSITES = 'webmastersites'
835
+ ARG_WEBRESOURCE = 'webresource'
836
+ ARG_WEBRESOURCES = 'webresources'
833
837
  ARG_WORKINGLOCATION = 'workinglocation'
834
838
  ARG_WORKINGLOCATIONS = 'workinglocations'
835
839
  ARG_YOUTUBECHANNEL = 'youtubechannel'
gam/gamlib/glentity.py CHANGED
@@ -394,6 +394,8 @@ class GamEntity():
394
394
  VAULT_MATTER_ID = 'vlmi'
395
395
  VAULT_OPERATION = 'vlto'
396
396
  VAULT_QUERY = 'vltq'
397
+ WEB_MASTERSITE = 'wems'
398
+ WEB_RESOURCE = 'were'
397
399
  WEBCLIPS_ENABLED = 'webc'
398
400
  YOUTUBE_CHANNEL = 'ytch'
399
401
  # _NAMES[0] is plural, _NAMES[1] is singular unless the item name is explicitly plural (Calendar Settings)
@@ -752,6 +754,8 @@ class GamEntity():
752
754
  VAULT_OPERATION: ['Vault Operations', 'Vault Operation'],
753
755
  VAULT_QUERY: ['Vault Queries', 'Vault Query'],
754
756
  WEBCLIPS_ENABLED: ['Web Clips Enabled', 'Web Clips Enabled'],
757
+ WEB_MASTERSITE: ['Web Master Sites', 'Web Master Site'],
758
+ WEB_RESOURCE: ['Web Resources', 'Web Resource'],
755
759
  YOUTUBE_CHANNEL: ['YouTube Channels', 'YouTube Channel'],
756
760
  ROLE_MANAGER: ['Managers', 'Manager'],
757
761
  ROLE_MEMBER: ['Members', 'Member'],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gam7
3
- Version: 7.16.1
3
+ Version: 7.17.1
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=-iK1wx4zPLo48IM9piErpNOHxAqS7lFpkO3M31iF-iw,3566026
1
+ gam/__init__.py,sha256=iyTl-pcv9rgneWPM50y1WsDmuLd6UBFYcYNQVrKwQro,3569466
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,10 +23,10 @@ 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=l3iC1H2_slHFaJ8tIvx3n4JY-1_hqP5xF541YD06zEY,34738
26
+ gam/gamlib/glapi.py,sha256=Ohi-KNxCKAEB-nRFnD8RvMhcjS1kCj6NtHWnonJoglM,35249
27
27
  gam/gamlib/glcfg.py,sha256=J4w16Nfk282S7iuSmk3601GHgt_MJ4qWeSzF5y7ZzX0,28139
28
- gam/gamlib/glclargs.py,sha256=zCfq3-XRiaEF58o5lmQVnxgV3AqMWMIs4Ra42iHExPQ,43538
29
- gam/gamlib/glentity.py,sha256=bFVeXqJ4VLIpFgc9y083oeBn8JzbwPYVJeuJF0yrnk8,34405
28
+ gam/gamlib/glclargs.py,sha256=lovS0A1Le0-ocEgIZuHqWa6UHVypAWyt_Lc_rOS9tV4,43686
29
+ gam/gamlib/glentity.py,sha256=E3cQTL9_OdduMaOmrDi0ROFrkJeAdITRLZizBGBPSso,34569
30
30
  gam/gamlib/glgapi.py,sha256=pdBbwNtnCwFWxJGaP-_3hdTjSNoOCJF2yo76WdQOi1k,40426
31
31
  gam/gamlib/glgdata.py,sha256=weRppttWm6uRyqtBoGPKoHiNZ2h28nhfUV4J_mbCszY,2707
32
32
  gam/gamlib/glglobals.py,sha256=J0xcHggVrUBzHJ5GruenKV-qV1zPKcK2qWgAgN3i5Jw,9608
@@ -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.16.1.dist-info/METADATA,sha256=bO_Ob09BGUsCLr_SHcrs3AwoCObQ7VH18w7qvX2c9mI,2940
69
- gam7-7.16.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
70
- gam7-7.16.1.dist-info/entry_points.txt,sha256=HVUM5J7dA8YwvJfG30jiLefR19ExMs387TWugWd9sf4,42
71
- gam7-7.16.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
72
- gam7-7.16.1.dist-info/RECORD,,
68
+ gam7-7.17.1.dist-info/METADATA,sha256=G_WiPureV-B_yL5RqM55Iaz_chLX3Lrh5Q_QyQW9LH4,2940
69
+ gam7-7.17.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
70
+ gam7-7.17.1.dist-info/entry_points.txt,sha256=HVUM5J7dA8YwvJfG30jiLefR19ExMs387TWugWd9sf4,42
71
+ gam7-7.17.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
72
+ gam7-7.17.1.dist-info/RECORD,,
File without changes