gam7 7.16.0__py3-none-any.whl → 7.17.0__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.00'
28
+ __version__ = '7.17.00'
29
29
  __license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
30
30
 
31
31
  #pylint: disable=wrong-import-position
@@ -47077,6 +47077,72 @@ def doInfoSiteVerification():
47077
47077
  else:
47078
47078
  printKeyValueList(['No Sites Verified.'])
47079
47079
 
47080
+ # gam <UserTypeEntity> show webresources
47081
+ # gam <UserTypeEntity> print webresources [todrive <ToDriveAttribute>*]
47082
+ def printShowWebResources(users):
47083
+ csvPF = CSVPrintFile(['User', 'site.identifier']) if Act.csvFormat() else None
47084
+ while Cmd.ArgumentsRemaining():
47085
+ myarg = getArgument()
47086
+ if csvPF and myarg == 'todrive':
47087
+ csvPF.GetTodriveParameters()
47088
+ else:
47089
+ unknownArgumentExit()
47090
+ i, count, users = getEntityArgument(users)
47091
+ for user in users:
47092
+ i += 1
47093
+ user, verif = buildGAPIServiceObject(API.SITEVERIFICATION, user, i, count)
47094
+ if not verif:
47095
+ continue
47096
+ sites = callGAPIitems(verif.webResource(), 'list', 'items')
47097
+ jcount = len(sites)
47098
+ if not csvPF:
47099
+ entityPerformActionNumItems([Ent.USER, user], jcount, Ent.WEB_RESOURCE, i, count)
47100
+ Ind.Increment()
47101
+ j = 0
47102
+ for site in sorted(sites, key=lambda k: (k['site']['type'], k['site']['identifier'])):
47103
+ j += 1
47104
+ _showSiteVerificationInfo(site)
47105
+ Ind.Decrement()
47106
+ else:
47107
+ for site in sites:
47108
+ row = flattenJSON(site, flattened={'User': user})
47109
+ csvPF.WriteRowTitles(row)
47110
+ if csvPF:
47111
+ csvPF.writeCSVfile('Web Resources')
47112
+
47113
+ # gam <UserTypeEntity> show webmastersites
47114
+ # gam <UserTypeEntity> print webmastersites [todrive <ToDriveAttribute>*]
47115
+ def printShowWebMasterSites(users):
47116
+ csvPF = CSVPrintFile(['User', 'siteUrl']) if Act.csvFormat() else None
47117
+ while Cmd.ArgumentsRemaining():
47118
+ myarg = getArgument()
47119
+ if csvPF and myarg == 'todrive':
47120
+ csvPF.GetTodriveParameters()
47121
+ else:
47122
+ unknownArgumentExit()
47123
+ i, count, users = getEntityArgument(users)
47124
+ for user in users:
47125
+ i += 1
47126
+ user, searchconsole = buildGAPIServiceObject(API.SEARCHCONSOLE, user, i, count)
47127
+ if not searchconsole:
47128
+ continue
47129
+ sites = callGAPIitems(searchconsole.sites(), 'list', 'siteEntry')
47130
+ jcount = len(sites)
47131
+ if not csvPF:
47132
+ entityPerformActionNumItems([Ent.USER, user], jcount, Ent.WEB_MASTERSITE, i, count)
47133
+ Ind.Increment()
47134
+ j = 0
47135
+ for site in sorted(sites, key=lambda k: k['siteUrl']):
47136
+ j += 1
47137
+ _showSiteVerificationInfo(site)
47138
+ Ind.Decrement()
47139
+ else:
47140
+ for site in sites:
47141
+ row = flattenJSON(site, flattened={'User': user})
47142
+ csvPF.WriteRowTitles(row)
47143
+ if csvPF:
47144
+ csvPF.writeCSVfile('Web Master Sites')
47145
+
47080
47146
  def checkCourseExists(croom, courseId, i=0, count=0, entityType=Ent.COURSE):
47081
47147
  courseId = addCourseIdScope(courseId)
47082
47148
  try:
@@ -53817,6 +53883,13 @@ DRIVE_FILE_CONTENT_RESTRICTIONS_CHOICE_MAP = {
53817
53883
  'ownerrestricted': 'ownerRestricted',
53818
53884
  }
53819
53885
 
53886
+ DRIVE_FILE_ITEM_DOWNLOAD_RESTRICTION_CHOICE_MAP = {
53887
+ 'downloadrestrictedforreaders': 'restrictedForReaders',
53888
+ 'downloadrestrictedforwriters': 'restrictedForWriters',
53889
+ 'restrictedforreaders': 'restrictedForReaders',
53890
+ 'restrictedforwriters': 'restrictedForWriters',
53891
+ }
53892
+
53820
53893
  def getDriveFileProperty(visibility=None):
53821
53894
  key = getString(Cmd.OB_PROPERTY_KEY)
53822
53895
  value = getString(Cmd.OB_PROPERTY_VALUE, minLen=0) or None
@@ -53868,6 +53941,20 @@ def getDriveFileAddRemoveParentAttribute(myarg, parameters):
53868
53941
  return False
53869
53942
  return True
53870
53943
 
53944
+ def _getDriveFileDownloadRestrictions(myarg, body):
53945
+ subField = myarg
53946
+ if subField.startswith('downloadrestrictions.'):
53947
+ _, subField = subField.split('.', 1)
53948
+ if subField.startswith('itemdownloadrestriction.'):
53949
+ _, subField = subField.split('.', 1)
53950
+ if subField == 'itemdownloadrestriction':
53951
+ subField = getChoice(DRIVE_FILE_ITEM_DOWNLOAD_RESTRICTION_CHOICE_MAP)
53952
+ if subField in DRIVE_FILE_ITEM_DOWNLOAD_RESTRICTION_CHOICE_MAP:
53953
+ body.setdefault('downloadRestrictions', {'itemDownloadRestriction': {}})
53954
+ body['downloadRestrictions']['itemDownloadRestriction'][DRIVE_FILE_ITEM_DOWNLOAD_RESTRICTION_CHOICE_MAP[subField]] = getBoolean()
53955
+ return True
53956
+ return False
53957
+
53871
53958
  def getDriveFileCopyAttribute(myarg, body, parameters):
53872
53959
  if myarg == 'ignoredefaultvisibility':
53873
53960
  parameters[DFA_IGNORE_DEFAULT_VISIBILITY] = getBoolean()
@@ -53903,6 +53990,8 @@ def getDriveFileCopyAttribute(myarg, body, parameters):
53903
53990
  else:
53904
53991
  Cmd.Backup()
53905
53992
  usageErrorExit(Msg.REASON_ONLY_VALID_WITH_CONTENTRESTRICTIONS_READONLY_TRUE)
53993
+ elif _getDriveFileDownloadRestrictions(myarg, body):
53994
+ pass
53906
53995
  elif myarg == 'inheritedpermissionsdisabled':
53907
53996
  body['inheritedPermissionsDisabled'] = getBoolean()
53908
53997
  elif myarg == 'property':
@@ -54657,6 +54746,7 @@ DRIVE_FIELDS_CHOICE_MAP = {
54657
54746
  'createddate': 'createdTime',
54658
54747
  'createdtime': 'createdTime',
54659
54748
  'description': 'description',
54749
+ 'downloadrestrictions': 'downloadRestrictions',
54660
54750
  'driveid': 'driveId',
54661
54751
  'drivename': 'driveId',
54662
54752
  'editable': 'capabilities.canEdit',
@@ -54803,6 +54893,11 @@ DRIVE_CONTENT_RESTRICTIONS_SUBFIELDS_CHOICE_MAP = {
54803
54893
  'type': 'type',
54804
54894
  }
54805
54895
 
54896
+ DRIVE_DOWNLOAD_RESTRICTIONS_SUBFIELDS_CHOICE_MAP = {
54897
+ 'itemdownloadrestriction': 'itemDownloadRestriction',
54898
+ 'effectivedownloadrestrictionwithcontext': 'effectiveDownloadRestrictionWithContext',
54899
+ }
54900
+
54806
54901
  DRIVE_LABELINFO_SUBFIELDS_CHOICE_MAP = {
54807
54902
  'id': 'labels(id)',
54808
54903
  'fields': 'labels(fields)',
@@ -54867,6 +54962,7 @@ DRIVE_SHORTCUTDETAILS_SUBFIELDS_CHOICE_MAP = {
54867
54962
  DRIVE_SUBFIELDS_CHOICE_MAP = {
54868
54963
  'capabilities': DRIVE_CAPABILITIES_SUBFIELDS_CHOICE_MAP,
54869
54964
  'contentrestrictions': DRIVE_CONTENT_RESTRICTIONS_SUBFIELDS_CHOICE_MAP,
54965
+ 'downloadrestrictions': DRIVE_DOWNLOAD_RESTRICTIONS_SUBFIELDS_CHOICE_MAP,
54870
54966
  'labelinfo': DRIVE_LABELINFO_SUBFIELDS_CHOICE_MAP,
54871
54967
  'labels': DRIVE_LABEL_CHOICE_MAP,
54872
54968
  'lastmodifyinguser': DRIVE_SHARINGUSER_SUBFIELDS_CHOICE_MAP,
@@ -78268,6 +78364,8 @@ USER_COMMANDS_WITH_OBJECTS = {
78268
78364
  Cmd.ARG_USERLIST: doPrintUserList,
78269
78365
  Cmd.ARG_VACATION: printShowVacation,
78270
78366
  Cmd.ARG_VAULTHOLD: printShowUserVaultHolds,
78367
+ Cmd.ARG_WEBMASTERSITE: printShowWebMasterSites,
78368
+ Cmd.ARG_WEBRESOURCE: printShowWebResources,
78271
78369
  Cmd.ARG_WORKINGLOCATION: printShowWorkingLocation,
78272
78370
  Cmd.ARG_YOUTUBECHANNEL: printShowYouTubeChannel,
78273
78371
  }
@@ -78378,6 +78476,8 @@ USER_COMMANDS_WITH_OBJECTS = {
78378
78476
  Cmd.ARG_TOKEN: printShowTokens,
78379
78477
  Cmd.ARG_VAULTHOLD: printShowUserVaultHolds,
78380
78478
  Cmd.ARG_VACATION: printShowVacation,
78479
+ Cmd.ARG_WEBMASTERSITE: printShowWebMasterSites,
78480
+ Cmd.ARG_WEBRESOURCE: printShowWebResources,
78381
78481
  Cmd.ARG_WORKINGLOCATION: printShowWorkingLocation,
78382
78482
  Cmd.ARG_YOUTUBECHANNEL: printShowYouTubeChannel,
78383
78483
  }
@@ -78629,6 +78729,8 @@ USER_COMMANDS_OBJ_ALIASES = {
78629
78729
  Cmd.ARG_USERS: Cmd.ARG_USER,
78630
78730
  Cmd.ARG_VAULTHOLDS: Cmd.ARG_VAULTHOLD,
78631
78731
  Cmd.ARG_VERIFICATIONCODES: Cmd.ARG_BACKUPCODE,
78732
+ Cmd.ARG_WEBMASTERSITES: Cmd.ARG_WEBMASTERSITE,
78733
+ Cmd.ARG_WEBRESOURCES: Cmd.ARG_WEBRESOURCE,
78632
78734
  Cmd.ARG_WORKINGLOCATIONS: Cmd.ARG_WORKINGLOCATION,
78633
78735
  Cmd.ARG_YOUTUBECHANNELS: Cmd.ARG_YOUTUBECHANNEL,
78634
78736
  }
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.0
3
+ Version: 7.17.0
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=perhavDdZW3_hdf1AuU294vfvQh2pj13FeSsMzMalVc,3565240
1
+ gam/__init__.py,sha256=HL9H4SdRvRO90h8nlVV4ZzHqrHi3eC-s4H2UDMv-GeA,3569213
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.0.dist-info/METADATA,sha256=lIaqYcMVQWQlnGY40LjHvt_okQe9bZfWurvdMlCT_uM,2940
69
- gam7-7.16.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
70
- gam7-7.16.0.dist-info/entry_points.txt,sha256=HVUM5J7dA8YwvJfG30jiLefR19ExMs387TWugWd9sf4,42
71
- gam7-7.16.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
72
- gam7-7.16.0.dist-info/RECORD,,
68
+ gam7-7.17.0.dist-info/METADATA,sha256=7bOQtLmPkHfOEw9WxA3ZOF9wwZntEfpZxUwOxuPd5tg,2940
69
+ gam7-7.17.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
70
+ gam7-7.17.0.dist-info/entry_points.txt,sha256=HVUM5J7dA8YwvJfG30jiLefR19ExMs387TWugWd9sf4,42
71
+ gam7-7.17.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
72
+ gam7-7.17.0.dist-info/RECORD,,
File without changes