gam7 7.15.1__py3-none-any.whl → 7.16.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 +90 -199
- gam/gamlib/glapi.py +0 -50
- gam/gamlib/glcfg.py +0 -4
- {gam7-7.15.1.dist-info → gam7-7.16.1.dist-info}/METADATA +1 -1
- {gam7-7.15.1.dist-info → gam7-7.16.1.dist-info}/RECORD +8 -8
- {gam7-7.15.1.dist-info → gam7-7.16.1.dist-info}/WHEEL +0 -0
- {gam7-7.15.1.dist-info → gam7-7.16.1.dist-info}/entry_points.txt +0 -0
- {gam7-7.15.1.dist-info → gam7-7.16.1.dist-info}/licenses/LICENSE +0 -0
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.
|
|
28
|
+
__version__ = '7.16.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
|
|
@@ -7862,7 +7862,6 @@ class CSVPrintFile():
|
|
|
7862
7862
|
GM.Globals[GM.CSV_OUTPUT_TIMESTAMP_COLUMN] = GC.Values.get(GC.CSV_OUTPUT_TIMESTAMP_COLUMN, '')
|
|
7863
7863
|
self.SetTimestampColumn(GM.Globals[GM.CSV_OUTPUT_TIMESTAMP_COLUMN])
|
|
7864
7864
|
self.SetFormatJSON(False)
|
|
7865
|
-
self.SetMapDrive3Titles(False)
|
|
7866
7865
|
self.SetNodataFields(False, None, None, None, False)
|
|
7867
7866
|
self.SetFixPaths(False)
|
|
7868
7867
|
self.SetShowPermissionsLast(False)
|
|
@@ -7932,13 +7931,6 @@ class CSVPrintFile():
|
|
|
7932
7931
|
self.sortTitlesList = self.titlesList[:]
|
|
7933
7932
|
self.sortTitlesSet = set(self.sortTitlesList)
|
|
7934
7933
|
|
|
7935
|
-
def SetMapDrive3Titles(self, mapDrive3Titles):
|
|
7936
|
-
self.mapDrive3Titles = mapDrive3Titles
|
|
7937
|
-
|
|
7938
|
-
def MapDrive3TitlesToDrive2(self):
|
|
7939
|
-
_mapDrive3TitlesToDrive2(self.titlesList, API.DRIVE3_TO_DRIVE2_FILES_FIELDS_MAP)
|
|
7940
|
-
self.titlesSet = set(self.titlesList)
|
|
7941
|
-
|
|
7942
7934
|
def AddJSONTitle(self, title):
|
|
7943
7935
|
self.JSONtitlesSet.add(title)
|
|
7944
7936
|
self.JSONtitlesList.append(title)
|
|
@@ -8974,7 +8966,6 @@ class CSVPrintFile():
|
|
|
8974
8966
|
self.formatJSON, self.JSONtitlesList,
|
|
8975
8967
|
self.columnDelimiter, self.noEscapeChar, self.quoteChar,
|
|
8976
8968
|
self.sortHeaders, self.timestampColumn,
|
|
8977
|
-
self.mapDrive3Titles,
|
|
8978
8969
|
self.fixPaths,
|
|
8979
8970
|
self.mapNodataFields,
|
|
8980
8971
|
self.nodataFields,
|
|
@@ -9009,8 +9000,6 @@ class CSVPrintFile():
|
|
|
9009
9000
|
self.MovePermsToEnd()
|
|
9010
9001
|
if not self.rows and self.nodataFields is not None:
|
|
9011
9002
|
self.FixNodataTitles()
|
|
9012
|
-
if self.mapDrive3Titles:
|
|
9013
|
-
self. MapDrive3TitlesToDrive2()
|
|
9014
9003
|
else:
|
|
9015
9004
|
self.titlesList = self.headerForce
|
|
9016
9005
|
if self.timestampColumn:
|
|
@@ -9646,11 +9635,10 @@ def CSVFileQueueHandler(mpQueue, mpQueueStdout, mpQueueStderr, csvPF, datetimeNo
|
|
|
9646
9635
|
csvPF.SetQuoteChar(dataItem[7])
|
|
9647
9636
|
csvPF.SetSortHeaders(dataItem[8])
|
|
9648
9637
|
csvPF.SetTimestampColumn(dataItem[9])
|
|
9649
|
-
csvPF.
|
|
9650
|
-
csvPF.
|
|
9651
|
-
csvPF.
|
|
9652
|
-
csvPF.
|
|
9653
|
-
csvPF.SetZeroBlankMimeTypeCounts(dataItem[18])
|
|
9638
|
+
csvPF.SetFixPaths(dataItem[10])
|
|
9639
|
+
csvPF.SetNodataFields(dataItem[11], dataItem[12], dataItem[13], dataItem[14], dataItem[15])
|
|
9640
|
+
csvPF.SetShowPermissionsLast(dataItem[16])
|
|
9641
|
+
csvPF.SetZeroBlankMimeTypeCounts(dataItem[17])
|
|
9654
9642
|
elif dataType == GM.REDIRECT_QUEUE_DATA:
|
|
9655
9643
|
csvPF.rows.extend(dataItem)
|
|
9656
9644
|
elif dataType == GM.REDIRECT_QUEUE_ARGS:
|
|
@@ -53829,6 +53817,11 @@ DRIVE_FILE_CONTENT_RESTRICTIONS_CHOICE_MAP = {
|
|
|
53829
53817
|
'ownerrestricted': 'ownerRestricted',
|
|
53830
53818
|
}
|
|
53831
53819
|
|
|
53820
|
+
DRIVE_FILE_ITEM_DOWNLOAD_RESTRICTION_CHOICE_MAP = {
|
|
53821
|
+
'restrictedforreaders': 'restrictedForReaders',
|
|
53822
|
+
'restrictedforwriters': 'restrictedForWriters',
|
|
53823
|
+
}
|
|
53824
|
+
|
|
53832
53825
|
def getDriveFileProperty(visibility=None):
|
|
53833
53826
|
key = getString(Cmd.OB_PROPERTY_KEY)
|
|
53834
53827
|
value = getString(Cmd.OB_PROPERTY_VALUE, minLen=0) or None
|
|
@@ -53915,6 +53908,10 @@ def getDriveFileCopyAttribute(myarg, body, parameters):
|
|
|
53915
53908
|
else:
|
|
53916
53909
|
Cmd.Backup()
|
|
53917
53910
|
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()
|
|
53918
53915
|
elif myarg == 'inheritedpermissionsdisabled':
|
|
53919
53916
|
body['inheritedPermissionsDisabled'] = getBoolean()
|
|
53920
53917
|
elif myarg == 'property':
|
|
@@ -54605,11 +54602,6 @@ DRIVEFILE_ORDERBY_CHOICE_MAP = {
|
|
|
54605
54602
|
'viewedbymetime': 'viewedByMeTime',
|
|
54606
54603
|
}
|
|
54607
54604
|
|
|
54608
|
-
def _mapDrive3TitlesToDrive2(titles, drive3TitlesMap):
|
|
54609
|
-
for i, title in enumerate(titles):
|
|
54610
|
-
if title in drive3TitlesMap:
|
|
54611
|
-
titles[i] = drive3TitlesMap[title]
|
|
54612
|
-
|
|
54613
54605
|
def _mapDriveUser(field):
|
|
54614
54606
|
if 'me' in field:
|
|
54615
54607
|
field['isAuthenticatedUser'] = field.pop('me')
|
|
@@ -54617,32 +54609,25 @@ def _mapDriveUser(field):
|
|
|
54617
54609
|
field['picture'] = {'url': field.pop('photoLink')}
|
|
54618
54610
|
|
|
54619
54611
|
def _mapDrivePermissionNames(permission):
|
|
54620
|
-
if not GC.Values[GC.DRIVE_V3_NATIVE_NAMES]:
|
|
54621
|
-
if 'displayName' in permission:
|
|
54622
|
-
permission['name'] = permission.pop('displayName')
|
|
54623
|
-
if 'expirationTime' in permission:
|
|
54624
|
-
permission['expirationDate'] = formatLocalTime(permission.pop('expirationTime'))
|
|
54625
|
-
if 'allowFileDiscovery' in permission:
|
|
54626
|
-
permission['withLink'] = not permission.pop('allowFileDiscovery')
|
|
54627
54612
|
emailAddress = permission.get('emailAddress')
|
|
54628
54613
|
if emailAddress:
|
|
54629
54614
|
_, permission['domain'] = splitEmailAddress(emailAddress)
|
|
54630
54615
|
|
|
54631
|
-
def
|
|
54616
|
+
def _mapDriveInfo(f_file, parentsSubFields, showParentsIdsAsList):
|
|
54632
54617
|
if 'parents' in f_file:
|
|
54633
54618
|
parents = f_file.pop('parents')
|
|
54634
|
-
if
|
|
54635
|
-
|
|
54636
|
-
|
|
54637
|
-
|
|
54638
|
-
|
|
54639
|
-
|
|
54640
|
-
|
|
54641
|
-
|
|
54642
|
-
|
|
54643
|
-
|
|
54644
|
-
|
|
54645
|
-
|
|
54619
|
+
if showParentsIdsAsList:
|
|
54620
|
+
f_file['parentsIds'] = parents
|
|
54621
|
+
elif len(parents) != 1 or parents[0] != ORPHANS:
|
|
54622
|
+
f_file['parents'] = []
|
|
54623
|
+
for parentId in parents:
|
|
54624
|
+
parent = {}
|
|
54625
|
+
if parentsSubFields['id']:
|
|
54626
|
+
parent['id'] = parentId
|
|
54627
|
+
if parentsSubFields['isRoot']:
|
|
54628
|
+
parent['isRoot'] = parentId == parentsSubFields['rootFolderId']
|
|
54629
|
+
f_file['parents'].append(parent)
|
|
54630
|
+
|
|
54646
54631
|
appProperties = f_file.pop('appProperties', [])
|
|
54647
54632
|
properties = f_file.pop('properties', [])
|
|
54648
54633
|
if appProperties:
|
|
@@ -54654,51 +54639,10 @@ def _mapDriveProperties(f_file):
|
|
|
54654
54639
|
for key, value in sorted(properties.items()):
|
|
54655
54640
|
f_file['properties'].append({'key': key, 'value': value, 'visibility': 'PUBLIC'})
|
|
54656
54641
|
|
|
54657
|
-
def _mapDriveFieldNames(f_file, user, parentsSubFields, mapToLabels):
|
|
54658
|
-
if mapToLabels:
|
|
54659
|
-
for attrib, v2attrib in API.DRIVE3_TO_DRIVE2_LABELS_MAP.items():
|
|
54660
|
-
if attrib in f_file:
|
|
54661
|
-
f_file.setdefault('labels', {})
|
|
54662
|
-
f_file['labels'][v2attrib] = f_file.pop(attrib)
|
|
54663
|
-
for attrib, v2attrib in API.DRIVE3_TO_DRIVE2_FILES_FIELDS_MAP.items():
|
|
54664
|
-
if attrib in f_file:
|
|
54665
|
-
f_file[v2attrib] = f_file.pop(attrib)
|
|
54666
|
-
capabilities = f_file.get('capabilities')
|
|
54667
|
-
if capabilities:
|
|
54668
|
-
for attrib, v2attrib in API.DRIVE3_TO_DRIVE2_CAPABILITIES_FIELDS_MAP.items():
|
|
54669
|
-
if attrib in capabilities:
|
|
54670
|
-
f_file[v2attrib] = capabilities[attrib]
|
|
54671
|
-
for attrib, v2attrib in API.DRIVE3_TO_DRIVE2_CAPABILITIES_NAMES_MAP.items():
|
|
54672
|
-
if attrib in capabilities:
|
|
54673
|
-
capabilities[v2attrib] = capabilities.pop(attrib)
|
|
54674
|
-
if 'spaces' in f_file:
|
|
54675
|
-
f_file['appDataContents'] = 'appDataFolder' in f_file['spaces']
|
|
54676
|
-
if 'lastModifyingUser' in f_file:
|
|
54677
|
-
if 'displayName' in f_file['lastModifyingUser']:
|
|
54678
|
-
f_file['lastModifyingUserName'] = f_file['lastModifyingUser']['displayName']
|
|
54679
|
-
_mapDriveUser(f_file['lastModifyingUser'])
|
|
54680
|
-
if 'owners' in f_file:
|
|
54681
|
-
for owner in f_file['owners']:
|
|
54682
|
-
_mapDriveUser(owner)
|
|
54683
|
-
if 'displayName' in owner:
|
|
54684
|
-
f_file.setdefault('ownerNames', [])
|
|
54685
|
-
f_file['ownerNames'].append(owner['displayName'])
|
|
54686
|
-
_mapDriveUser(f_file.get('sharingUser', {}))
|
|
54687
|
-
_mapDriveParents(f_file, parentsSubFields)
|
|
54688
|
-
_mapDriveProperties(f_file)
|
|
54689
54642
|
for permission in f_file.get('permissions', []):
|
|
54690
|
-
|
|
54691
|
-
|
|
54692
|
-
|
|
54693
|
-
|
|
54694
|
-
def _mapDriveRevisionNames(revision):
|
|
54695
|
-
for attrib, v2attrib in API.DRIVE3_TO_DRIVE2_REVISIONS_FIELDS_MAP.items():
|
|
54696
|
-
if attrib in revision:
|
|
54697
|
-
revision[v2attrib] = revision.pop(attrib)
|
|
54698
|
-
if 'lastModifyingUser' in revision:
|
|
54699
|
-
if 'displayName' in revision['lastModifyingUser']:
|
|
54700
|
-
revision['lastModifyingUserName'] = revision['lastModifyingUser']['displayName']
|
|
54701
|
-
_mapDriveUser(revision['lastModifyingUser'])
|
|
54643
|
+
emailAddress = permission.get('emailAddress')
|
|
54644
|
+
if emailAddress:
|
|
54645
|
+
_, permission['domain'] = splitEmailAddress(emailAddress)
|
|
54702
54646
|
|
|
54703
54647
|
DRIVEFILE_BASIC_PERMISSION_FIELDS = [
|
|
54704
54648
|
'displayName', 'id', 'emailAddress', 'domain', 'role', 'type',
|
|
@@ -54722,6 +54666,7 @@ DRIVE_FIELDS_CHOICE_MAP = {
|
|
|
54722
54666
|
'createddate': 'createdTime',
|
|
54723
54667
|
'createdtime': 'createdTime',
|
|
54724
54668
|
'description': 'description',
|
|
54669
|
+
'downloadrestrictions': 'downloadRestrictions',
|
|
54725
54670
|
'driveid': 'driveId',
|
|
54726
54671
|
'drivename': 'driveId',
|
|
54727
54672
|
'editable': 'capabilities.canEdit',
|
|
@@ -54868,6 +54813,11 @@ DRIVE_CONTENT_RESTRICTIONS_SUBFIELDS_CHOICE_MAP = {
|
|
|
54868
54813
|
'type': 'type',
|
|
54869
54814
|
}
|
|
54870
54815
|
|
|
54816
|
+
DRIVE_DOWNLOAD_RESTRICTIONS_SUBFIELDS_CHOICE_MAP = {
|
|
54817
|
+
'itemdownloadrestriction': 'itemDownloadRestriction',
|
|
54818
|
+
'effectivedownloadrestrictionwithcontext': 'effectiveDownloadRestrictionWithContext',
|
|
54819
|
+
}
|
|
54820
|
+
|
|
54871
54821
|
DRIVE_LABELINFO_SUBFIELDS_CHOICE_MAP = {
|
|
54872
54822
|
'id': 'labels(id)',
|
|
54873
54823
|
'fields': 'labels(fields)',
|
|
@@ -54932,6 +54882,7 @@ DRIVE_SHORTCUTDETAILS_SUBFIELDS_CHOICE_MAP = {
|
|
|
54932
54882
|
DRIVE_SUBFIELDS_CHOICE_MAP = {
|
|
54933
54883
|
'capabilities': DRIVE_CAPABILITIES_SUBFIELDS_CHOICE_MAP,
|
|
54934
54884
|
'contentrestrictions': DRIVE_CONTENT_RESTRICTIONS_SUBFIELDS_CHOICE_MAP,
|
|
54885
|
+
'downloadrestrictions': DRIVE_DOWNLOAD_RESTRICTIONS_SUBFIELDS_CHOICE_MAP,
|
|
54935
54886
|
'labelinfo': DRIVE_LABELINFO_SUBFIELDS_CHOICE_MAP,
|
|
54936
54887
|
'labels': DRIVE_LABEL_CHOICE_MAP,
|
|
54937
54888
|
'lastmodifyinguser': DRIVE_SHARINGUSER_SUBFIELDS_CHOICE_MAP,
|
|
@@ -54949,11 +54900,7 @@ FILEINFO_FIELDS_TITLES = ['name', 'mimeType']
|
|
|
54949
54900
|
FILEPATH_FIELDS_TITLES = ['name', 'id', 'mimeType', 'ownedByMe', 'parents', 'sharedWithMeTime', 'driveId']
|
|
54950
54901
|
FILEPATH_FIELDS = ','.join(FILEPATH_FIELDS_TITLES)
|
|
54951
54902
|
|
|
54952
|
-
|
|
54953
|
-
timeObjects = ['createdTime', 'viewedByMeTime', 'modifiedByMeTime', 'modifiedTime', 'restrictionTime', 'sharedWithMeTime', 'trashedTime']
|
|
54954
|
-
if not GC.Values[GC.DRIVE_V3_NATIVE_NAMES]:
|
|
54955
|
-
_mapDrive3TitlesToDrive2(timeObjects, API.DRIVE3_TO_DRIVE2_FILES_FIELDS_MAP)
|
|
54956
|
-
return set(timeObjects)
|
|
54903
|
+
DRIVE_TIME_OBJECTS = {'createdTime', 'viewedByMeTime', 'modifiedByMeTime', 'modifiedTime', 'restrictionTime', 'sharedWithMeTime', 'trashedTime'}
|
|
54957
54904
|
|
|
54958
54905
|
def _getDriveFieldSubField(field, fieldsList, parentsSubFields):
|
|
54959
54906
|
field, subField = field.split('.', 1)
|
|
@@ -55150,7 +55097,6 @@ def showFileInfo(users):
|
|
|
55150
55097
|
showNoParents = True
|
|
55151
55098
|
includeLabels = ','.join(DFF.includeLabels)
|
|
55152
55099
|
pathFields = FILEPATH_FIELDS
|
|
55153
|
-
timeObjects = _getDriveTimeObjects()
|
|
55154
55100
|
i, count, users = getEntityArgument(users)
|
|
55155
55101
|
for user in users:
|
|
55156
55102
|
i += 1
|
|
@@ -55244,22 +55190,14 @@ def showFileInfo(users):
|
|
|
55244
55190
|
if fullpath:
|
|
55245
55191
|
# Save simple parents list as mappings turn it into a list of dicts
|
|
55246
55192
|
fpparents = result['parents'][:]
|
|
55247
|
-
|
|
55248
|
-
result['parentsIds'] = result.pop('parents')
|
|
55249
|
-
if not GC.Values[GC.DRIVE_V3_NATIVE_NAMES]:
|
|
55250
|
-
_mapDriveFieldNames(result, user, DFF.parentsSubFields, True)
|
|
55251
|
-
else:
|
|
55252
|
-
_mapDriveParents(result, DFF.parentsSubFields)
|
|
55253
|
-
_mapDriveProperties(result)
|
|
55254
|
-
for permission in result.get('permissions', []):
|
|
55255
|
-
_mapDrivePermissionNames(permission)
|
|
55193
|
+
_mapDriveInfo(result, DFF.parentsSubFields, showParentsIdsAsList)
|
|
55256
55194
|
if not FJQC.formatJSON:
|
|
55257
|
-
showJSON(None, result, skipObjects=skipObjects, timeObjects=
|
|
55195
|
+
showJSON(None, result, skipObjects=skipObjects, timeObjects=DRIVE_TIME_OBJECTS, simpleLists=simpleLists,
|
|
55258
55196
|
dictObjectsKey={'owners': 'displayName', 'fields': 'id', 'labels': 'id', 'user': 'emailAddress', 'parents': 'id',
|
|
55259
|
-
'permissions':
|
|
55197
|
+
'permissions': 'displayName'})
|
|
55260
55198
|
Ind.Decrement()
|
|
55261
55199
|
else:
|
|
55262
|
-
printLine(json.dumps(cleanJSON(result, skipObjects=skipObjects, timeObjects=
|
|
55200
|
+
printLine(json.dumps(cleanJSON(result, skipObjects=skipObjects, timeObjects=DRIVE_TIME_OBJECTS), ensure_ascii=False, sort_keys=True))
|
|
55263
55201
|
if fullpath:
|
|
55264
55202
|
# Restore simple parents list
|
|
55265
55203
|
fileTree[fileId]['info']['parents'] = fpparents[:]
|
|
@@ -55651,18 +55589,12 @@ FILEREVISIONS_FIELDS_CHOICE_MAP = {
|
|
|
55651
55589
|
'size': 'size',
|
|
55652
55590
|
}
|
|
55653
55591
|
|
|
55654
|
-
|
|
55655
|
-
timeObjects = ['modifiedTime']
|
|
55656
|
-
if not GC.Values[GC.DRIVE_V3_NATIVE_NAMES]:
|
|
55657
|
-
_mapDrive3TitlesToDrive2(timeObjects, API.DRIVE3_TO_DRIVE2_FILES_FIELDS_MAP)
|
|
55658
|
-
return set(timeObjects)
|
|
55592
|
+
FILEREVISIONS_TIME_OBJECTS = {'modifiedTime'}
|
|
55659
55593
|
|
|
55660
|
-
def _showRevision(revision,
|
|
55594
|
+
def _showRevision(revision, i=0, count=0):
|
|
55661
55595
|
printEntity([Ent.DRIVE_FILE_REVISION, revision['id']], i, count)
|
|
55662
55596
|
Ind.Increment()
|
|
55663
|
-
|
|
55664
|
-
_mapDriveRevisionNames(revision)
|
|
55665
|
-
showJSON(None, revision, ['id'], timeObjects)
|
|
55597
|
+
showJSON(None, revision, ['id'], timeObjects=FILEREVISIONS_TIME_OBJECTS)
|
|
55666
55598
|
Ind.Decrement()
|
|
55667
55599
|
|
|
55668
55600
|
DRIVE_REVISIONS_INDEXED_TITLES = ['revisions']
|
|
@@ -55686,7 +55618,6 @@ def printShowFileRevisions(users):
|
|
|
55686
55618
|
revisionsEntity = None
|
|
55687
55619
|
oneItemPerRow = previewDelete = showTitles = stripCRsFromName = False
|
|
55688
55620
|
OBY = OrderBy(DRIVEFILE_ORDERBY_CHOICE_MAP)
|
|
55689
|
-
fileNameTitle = 'title' if not GC.Values[GC.DRIVE_V3_NATIVE_NAMES] else 'name'
|
|
55690
55621
|
while Cmd.ArgumentsRemaining():
|
|
55691
55622
|
myarg = getArgument()
|
|
55692
55623
|
if csvPF and myarg == 'todrive':
|
|
@@ -55704,7 +55635,7 @@ def printShowFileRevisions(users):
|
|
|
55704
55635
|
elif myarg == 'showtitles':
|
|
55705
55636
|
showTitles = True
|
|
55706
55637
|
if csvPF:
|
|
55707
|
-
csvPF.AddTitles(
|
|
55638
|
+
csvPF.AddTitles('name')
|
|
55708
55639
|
elif myarg == 'stripcrsfromname':
|
|
55709
55640
|
stripCRsFromName = True
|
|
55710
55641
|
elif getFieldsList(myarg, FILEREVISIONS_FIELDS_CHOICE_MAP, fieldsList, initialField='id'):
|
|
@@ -55715,7 +55646,6 @@ def printShowFileRevisions(users):
|
|
|
55715
55646
|
fields = getItemFieldsFromFieldsList('revisions', fieldsList)
|
|
55716
55647
|
else:
|
|
55717
55648
|
fields = '*'
|
|
55718
|
-
timeObjects = _getFileRevisionsTimeObjects()
|
|
55719
55649
|
i, count, users = getEntityArgument(users)
|
|
55720
55650
|
for user in users:
|
|
55721
55651
|
i += 1
|
|
@@ -55755,29 +55685,24 @@ def printShowFileRevisions(users):
|
|
|
55755
55685
|
k = 0
|
|
55756
55686
|
for revision in results:
|
|
55757
55687
|
k += 1
|
|
55758
|
-
_showRevision(revision,
|
|
55688
|
+
_showRevision(revision, k, kcount)
|
|
55759
55689
|
Ind.Decrement()
|
|
55760
55690
|
elif results:
|
|
55761
55691
|
if oneItemPerRow:
|
|
55762
55692
|
for revision in results:
|
|
55763
55693
|
row = {'Owner': user, 'id': fileId}
|
|
55764
55694
|
if showTitles:
|
|
55765
|
-
row[
|
|
55766
|
-
|
|
55767
|
-
_mapDriveRevisionNames(revision)
|
|
55768
|
-
csvPF.WriteRowTitles(flattenJSON({'revision': revision}, flattened=row, timeObjects=timeObjects))
|
|
55695
|
+
row['name'] = fileName
|
|
55696
|
+
csvPF.WriteRowTitles(flattenJSON({'revision': revision}, flattened=row, timeObjects=FILEREVISIONS_TIME_OBJECTS))
|
|
55769
55697
|
else:
|
|
55770
|
-
if not GC.Values[GC.DRIVE_V3_NATIVE_NAMES]:
|
|
55771
|
-
for revision in results:
|
|
55772
|
-
_mapDriveRevisionNames(revision)
|
|
55773
55698
|
if showTitles:
|
|
55774
|
-
csvPF.WriteRowTitles(flattenJSON({'revisions': results}, flattened={'Owner': user, 'id': fileId,
|
|
55699
|
+
csvPF.WriteRowTitles(flattenJSON({'revisions': results}, flattened={'Owner': user, 'id': fileId, 'name': fileName}, timeObjects=FILEREVISIONS_TIME_OBJECTS))
|
|
55775
55700
|
else:
|
|
55776
|
-
csvPF.WriteRowTitles(flattenJSON({'revisions': results}, flattened={'Owner': user, 'id': fileId}, timeObjects=
|
|
55701
|
+
csvPF.WriteRowTitles(flattenJSON({'revisions': results}, flattened={'Owner': user, 'id': fileId}, timeObjects=FILEREVISIONS_TIME_OBJECTS))
|
|
55777
55702
|
Ind.Decrement()
|
|
55778
55703
|
if csvPF:
|
|
55779
55704
|
if oneItemPerRow:
|
|
55780
|
-
csvPF.SetSortTitles(['Owner', 'id',
|
|
55705
|
+
csvPF.SetSortTitles(['Owner', 'id', 'name', 'revision.id'])
|
|
55781
55706
|
else:
|
|
55782
55707
|
csvPF.SetSortTitles(['Owner', 'id', 'revisions'])
|
|
55783
55708
|
csvPF.SetIndexedTitles(DRIVE_REVISIONS_INDEXED_TITLES)
|
|
@@ -56587,10 +56512,10 @@ def printFileList(users):
|
|
|
56587
56512
|
def _printFileInfoRow(baserow, fileInfo):
|
|
56588
56513
|
row = baserow.copy()
|
|
56589
56514
|
if not FJQC.formatJSON:
|
|
56590
|
-
csvPF.WriteRowTitles(flattenJSON(fileInfo, flattened=row, skipObjects=skipObjects, timeObjects=
|
|
56515
|
+
csvPF.WriteRowTitles(flattenJSON(fileInfo, flattened=row, skipObjects=skipObjects, timeObjects=DRIVE_TIME_OBJECTS,
|
|
56591
56516
|
simpleLists=simpleLists, delimiter=delimiter))
|
|
56592
56517
|
else:
|
|
56593
|
-
row['JSON'] = json.dumps(cleanJSON(fileInfo, skipObjects=skipObjects, timeObjects=
|
|
56518
|
+
row['JSON'] = json.dumps(cleanJSON(fileInfo, skipObjects=skipObjects, timeObjects=DRIVE_TIME_OBJECTS),
|
|
56594
56519
|
ensure_ascii=False, sort_keys=True)
|
|
56595
56520
|
csvPF.WriteRowTitlesJSONNoFilter(row)
|
|
56596
56521
|
|
|
@@ -56641,15 +56566,7 @@ def printFileList(users):
|
|
|
56641
56566
|
fullpath=fullpath, showDepth=showDepth, folderPathOnly=folderPathOnly)
|
|
56642
56567
|
else:
|
|
56643
56568
|
addFilePathsToInfo(drive, fileTree, fileInfo, filePathInfo, folderPathOnly=folderPathOnly)
|
|
56644
|
-
|
|
56645
|
-
fileInfo['parentsIds'] = fileInfo.pop('parents')
|
|
56646
|
-
if not GC.Values[GC.DRIVE_V3_NATIVE_NAMES]:
|
|
56647
|
-
_mapDriveFieldNames(fileInfo, user, DFF.parentsSubFields, False)
|
|
56648
|
-
else:
|
|
56649
|
-
_mapDriveParents(fileInfo, DFF.parentsSubFields)
|
|
56650
|
-
_mapDriveProperties(fileInfo)
|
|
56651
|
-
for permission in fileInfo.get('permissions', []):
|
|
56652
|
-
_mapDrivePermissionNames(permission)
|
|
56569
|
+
_mapDriveInfo(fileInfo, DFF.parentsSubFields, showParentsIdsAsList)
|
|
56653
56570
|
if showParentsIdsAsList and 'parentsIds' in fileInfo:
|
|
56654
56571
|
fileInfo['parents'] = len(fileInfo['parentsIds'])
|
|
56655
56572
|
if addCSVData:
|
|
@@ -56657,24 +56574,24 @@ def printFileList(users):
|
|
|
56657
56574
|
if not countsOnly:
|
|
56658
56575
|
if not oneItemPerRow or 'permissions' not in fileInfo:
|
|
56659
56576
|
if not FJQC.formatJSON:
|
|
56660
|
-
csvPF.WriteRowTitles(flattenJSON(fileInfo, flattened=row, skipObjects=skipObjects, timeObjects=
|
|
56577
|
+
csvPF.WriteRowTitles(flattenJSON(fileInfo, flattened=row, skipObjects=skipObjects, timeObjects=DRIVE_TIME_OBJECTS,
|
|
56661
56578
|
simpleLists=simpleLists, delimiter=delimiter))
|
|
56662
56579
|
else:
|
|
56663
56580
|
if 'id' in fileInfo:
|
|
56664
56581
|
row['id'] = fileInfo['id']
|
|
56665
|
-
if
|
|
56666
|
-
row[
|
|
56582
|
+
if 'name' in fileInfo:
|
|
56583
|
+
row['name'] = fileInfo['name']
|
|
56667
56584
|
if 'owners' in fileInfo:
|
|
56668
56585
|
flattenJSON({'owners': fileInfo['owners']}, flattened=row, skipObjects=skipObjects)
|
|
56669
|
-
row['JSON'] = json.dumps(cleanJSON(fileInfo, skipObjects=skipObjects, timeObjects=
|
|
56586
|
+
row['JSON'] = json.dumps(cleanJSON(fileInfo, skipObjects=skipObjects, timeObjects=DRIVE_TIME_OBJECTS),
|
|
56670
56587
|
ensure_ascii=False, sort_keys=True)
|
|
56671
56588
|
csvPF.WriteRowTitlesJSONNoFilter(row)
|
|
56672
56589
|
else:
|
|
56673
56590
|
baserow = row.copy()
|
|
56674
56591
|
if 'id' in fileInfo:
|
|
56675
56592
|
baserow['id'] = fileInfo['id']
|
|
56676
|
-
if
|
|
56677
|
-
baserow[
|
|
56593
|
+
if 'name' in fileInfo:
|
|
56594
|
+
baserow['name'] = fileInfo['name']
|
|
56678
56595
|
if 'owners' in fileInfo:
|
|
56679
56596
|
flattenJSON({'owners': fileInfo['owners']}, flattened=baserow, skipObjects=skipObjects)
|
|
56680
56597
|
for permission in fileInfo.pop('permissions'):
|
|
@@ -56688,7 +56605,7 @@ def printFileList(users):
|
|
|
56688
56605
|
_printFileInfoRow(baserow, fileInfo)
|
|
56689
56606
|
else:
|
|
56690
56607
|
if not countsRowFilter:
|
|
56691
|
-
csvPFco.UpdateMimeTypeCounts(flattenJSON(fileInfo, flattened=row, skipObjects=skipObjects, timeObjects=
|
|
56608
|
+
csvPFco.UpdateMimeTypeCounts(flattenJSON(fileInfo, flattened=row, skipObjects=skipObjects, timeObjects=DRIVE_TIME_OBJECTS,
|
|
56692
56609
|
simpleLists=simpleLists, delimiter=delimiter), mimeTypeInfo, sizeField)
|
|
56693
56610
|
else:
|
|
56694
56611
|
mimeTypeInfo.setdefault(fileInfo['mimeType'], {'count': 0, 'size': 0})
|
|
@@ -56955,12 +56872,6 @@ def printFileList(users):
|
|
|
56955
56872
|
csvPF.AddTitles('paths')
|
|
56956
56873
|
csvPF.SetFixPaths(True)
|
|
56957
56874
|
includeLabels = ','.join(DFF.includeLabels)
|
|
56958
|
-
timeObjects = _getDriveTimeObjects()
|
|
56959
|
-
if not GC.Values[GC.DRIVE_V3_NATIVE_NAMES]:
|
|
56960
|
-
fileNameTitle = 'title'
|
|
56961
|
-
csvPF.SetMapDrive3Titles(True)
|
|
56962
|
-
else:
|
|
56963
|
-
fileNameTitle = 'name'
|
|
56964
56875
|
csvPF.RemoveTitles(['capabilities'])
|
|
56965
56876
|
if DLP.queryTimes and selectSubQuery:
|
|
56966
56877
|
for queryTimeName, queryTimeValue in DLP.queryTimes.items():
|
|
@@ -56980,9 +56891,9 @@ def printFileList(users):
|
|
|
56980
56891
|
if not FJQC.formatJSON:
|
|
56981
56892
|
nodataFields = ['Owner']+list(set(DFF.fieldsList)-skipObjects)
|
|
56982
56893
|
else:
|
|
56983
|
-
nodataFields = ['Owner', 'id',
|
|
56894
|
+
nodataFields = ['Owner', 'id', 'name', 'owners.emailAddress']
|
|
56984
56895
|
else:
|
|
56985
|
-
nodataFields = ['Owner', 'id',
|
|
56896
|
+
nodataFields = ['Owner', 'id', 'name', 'owners.emailAddress']
|
|
56986
56897
|
if not FJQC.formatJSON:
|
|
56987
56898
|
nodataFields.append('permissions')
|
|
56988
56899
|
if filepath:
|
|
@@ -57162,7 +57073,7 @@ def printFileList(users):
|
|
|
57162
57073
|
if not csvPF.rows:
|
|
57163
57074
|
setSysExitRC(NO_ENTITIES_FOUND_RC)
|
|
57164
57075
|
if not FJQC.formatJSON:
|
|
57165
|
-
csvPF.SetSortTitles(['Owner', 'id',
|
|
57076
|
+
csvPF.SetSortTitles(['Owner', 'id', 'name'])
|
|
57166
57077
|
else:
|
|
57167
57078
|
if 'JSON' in csvPF.JSONtitlesList:
|
|
57168
57079
|
csvPF.MoveJSONTitlesToEnd(['JSON'])
|
|
@@ -57430,8 +57341,7 @@ def printShowFileComments(users):
|
|
|
57430
57341
|
# [fullpath] [folderpathonly [<Boolean>]] [pathdelimiter <Character>]
|
|
57431
57342
|
# [followshortcuts [<Boolean>]]
|
|
57432
57343
|
def printShowFilePaths(users):
|
|
57433
|
-
|
|
57434
|
-
csvPF = CSVPrintFile(['Owner', 'id', fileNameTitle, 'paths'], 'sortall', ['paths']) if Act.csvFormat() else None
|
|
57344
|
+
csvPF = CSVPrintFile(['Owner', 'id', 'name', 'paths'], 'sortall', ['paths']) if Act.csvFormat() else None
|
|
57435
57345
|
fileIdEntity = getDriveFileEntity()
|
|
57436
57346
|
fullpath = folderPathOnly = followShortcuts = oneItemPerRow = returnPathOnly = stripCRsFromName = False
|
|
57437
57347
|
pathDelimiter = '/'
|
|
@@ -57532,11 +57442,11 @@ def printShowFilePaths(users):
|
|
|
57532
57442
|
if oneItemPerRow:
|
|
57533
57443
|
if paths:
|
|
57534
57444
|
for path in paths:
|
|
57535
|
-
csvPF.WriteRow({'Owner': user, 'id': fileId,
|
|
57445
|
+
csvPF.WriteRow({'Owner': user, 'id': fileId, 'name': result['name'], 'path': path})
|
|
57536
57446
|
else:
|
|
57537
|
-
csvPF.WriteRow({'Owner': user, 'id': fileId,
|
|
57447
|
+
csvPF.WriteRow({'Owner': user, 'id': fileId, 'name': result['name']})
|
|
57538
57448
|
else:
|
|
57539
|
-
csvPF.WriteRowTitles(flattenJSON({'paths': paths}, flattened={'Owner': user, 'id': fileId,
|
|
57449
|
+
csvPF.WriteRowTitles(flattenJSON({'paths': paths}, flattened={'Owner': user, 'id': fileId, 'name': result['name']}))
|
|
57540
57450
|
except GAPI.fileNotFound:
|
|
57541
57451
|
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE_OR_FOLDER_ID, fileId], Msg.DOES_NOT_EXIST, j, jcount)
|
|
57542
57452
|
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
|
@@ -57549,8 +57459,7 @@ def printShowFilePaths(users):
|
|
|
57549
57459
|
# gam <UserTypeEntity> print fileparenttree <DriveFileEntity> [todrive <ToDriveAttribute>*]
|
|
57550
57460
|
# [stripcrsfromname]
|
|
57551
57461
|
def printFileParentTree(users):
|
|
57552
|
-
|
|
57553
|
-
csvPF = CSVPrintFile(['Owner', 'isBase', 'baseId', 'id', fileNameTitle, 'parentId', 'depth', 'isRoot'], 'sortall')
|
|
57462
|
+
csvPF = CSVPrintFile(['Owner', 'isBase', 'baseId', 'id', 'name', 'parentId', 'depth', 'isRoot'], 'sortall')
|
|
57554
57463
|
fileIdEntity = getDriveFileEntity()
|
|
57555
57464
|
stripCRsFromName = False
|
|
57556
57465
|
while Cmd.ArgumentsRemaining():
|
|
@@ -57610,7 +57519,7 @@ def printFileParentTree(users):
|
|
|
57610
57519
|
kcount = len(fileList)
|
|
57611
57520
|
isBase = True
|
|
57612
57521
|
for result in fileList:
|
|
57613
|
-
csvPF.WriteRow({'Owner': user, 'isBase': isBase, 'baseId': baseId, 'id': result['id'],
|
|
57522
|
+
csvPF.WriteRow({'Owner': user, 'isBase': isBase, 'baseId': baseId, 'id': result['id'], 'name': result['name'],
|
|
57614
57523
|
'parentId': result['parents'][0], 'depth': kcount, 'isRoot': result['isRoot']})
|
|
57615
57524
|
isBase = False
|
|
57616
57525
|
kcount -= 1
|
|
@@ -58409,7 +58318,7 @@ def printShowFileTree(users):
|
|
|
58409
58318
|
userInfo['index'] += 1
|
|
58410
58319
|
row = userInfo.copy()
|
|
58411
58320
|
row['depth'] = depth
|
|
58412
|
-
row[
|
|
58321
|
+
row['name'] = ('' if noindent else Ind.SpacesSub1())+fileEntry['name']
|
|
58413
58322
|
for field in FILETREE_FIELDS_PRINT_ORDER:
|
|
58414
58323
|
if showFields[field]:
|
|
58415
58324
|
if field == 'parents':
|
|
@@ -58417,7 +58326,7 @@ def printShowFileTree(users):
|
|
|
58417
58326
|
elif field == 'owners':
|
|
58418
58327
|
row[field] = delimiter.join([owner['emailAddress'] for owner in fileEntry.get(field, [])])
|
|
58419
58328
|
elif field == 'size':
|
|
58420
|
-
row[
|
|
58329
|
+
row['size'] = fileEntry.get(sizeField, 0)
|
|
58421
58330
|
else:
|
|
58422
58331
|
row[field] = fileEntry.get(field, '')
|
|
58423
58332
|
csvPF.WriteRow(row)
|
|
@@ -58518,14 +58427,6 @@ def printShowFileTree(users):
|
|
|
58518
58427
|
unknownArgumentExit()
|
|
58519
58428
|
fieldsList = ['driveId', 'id', 'name', 'parents', 'mimeType', 'ownedByMe', 'owners(emailAddress)',
|
|
58520
58429
|
'shared', sizeField, 'explicitlyTrashed', 'trashed', 'webViewLink']
|
|
58521
|
-
if csvPF:
|
|
58522
|
-
if not GC.Values[GC.DRIVE_V3_NATIVE_NAMES]:
|
|
58523
|
-
fileNameTitle = 'title'
|
|
58524
|
-
fileSize = 'fileSize'
|
|
58525
|
-
csvPF.SetMapDrive3Titles(True)
|
|
58526
|
-
else:
|
|
58527
|
-
fileNameTitle = 'name'
|
|
58528
|
-
fileSize = 'size'
|
|
58529
58430
|
buildTree = (not fileIdEntity
|
|
58530
58431
|
or (not fileIdEntity['dict']
|
|
58531
58432
|
and not fileIdEntity['query']
|
|
@@ -58585,7 +58486,7 @@ def printShowFileTree(users):
|
|
|
58585
58486
|
if jcount == 0:
|
|
58586
58487
|
continue
|
|
58587
58488
|
if csvPF:
|
|
58588
|
-
userInfo = {'User': user, 'index': 0, 'depth': 0,
|
|
58489
|
+
userInfo = {'User': user, 'index': 0, 'depth': 0, 'name': ''}
|
|
58589
58490
|
j = 0
|
|
58590
58491
|
Ind.Increment()
|
|
58591
58492
|
for fileId in fileIdEntity['list']:
|
|
@@ -58745,8 +58646,7 @@ def createDriveFile(users):
|
|
|
58745
58646
|
media_body = getMediaBody(parameters)
|
|
58746
58647
|
body['mimeType'] = parameters[DFA_LOCALMIMETYPE]
|
|
58747
58648
|
if csvPF:
|
|
58748
|
-
|
|
58749
|
-
csvPF.SetTitles(['User', fileNameTitle, 'id'])
|
|
58649
|
+
csvPF.SetTitles(['User', 'name', 'id'])
|
|
58750
58650
|
if showDetails:
|
|
58751
58651
|
csvPF.AddTitles(['parentId', 'mimeType'])
|
|
58752
58652
|
if addCSVData:
|
|
@@ -58806,7 +58706,7 @@ def createDriveFile(users):
|
|
|
58806
58706
|
else:
|
|
58807
58707
|
entityActionPerformed(kvList, i, count)
|
|
58808
58708
|
else:
|
|
58809
|
-
row = {'User': user,
|
|
58709
|
+
row = {'User': user, 'name': result['name'], 'id': result['id']}
|
|
58810
58710
|
if showDetails:
|
|
58811
58711
|
row.update({'parentId': parentId, 'mimeType': result['mimeType']})
|
|
58812
58712
|
if addCSVData:
|
|
@@ -60362,8 +60262,8 @@ copyReturnItemMap = {
|
|
|
60362
60262
|
# [enforceexpansiveaccess [<Boolean>]]
|
|
60363
60263
|
def copyDriveFile(users):
|
|
60364
60264
|
def _writeCSVData(user, oldName, oldId, newName, newId, mimeType):
|
|
60365
|
-
row = {'User': user,
|
|
60366
|
-
|
|
60265
|
+
row = {'User': user, 'name': oldName, 'id': oldId,
|
|
60266
|
+
'newName': newName, 'newId': newId, 'mimeType': mimeType}
|
|
60367
60267
|
if addCSVData:
|
|
60368
60268
|
row.update(addCSVData)
|
|
60369
60269
|
csvPF.WriteRow(row)
|
|
@@ -60753,9 +60653,7 @@ def copyDriveFile(users):
|
|
|
60753
60653
|
else:
|
|
60754
60654
|
unknownArgumentExit()
|
|
60755
60655
|
if csvPF:
|
|
60756
|
-
|
|
60757
|
-
newFileNameTitle = f'new{fileNameTitle.capitalize()}'
|
|
60758
|
-
csvPF.SetTitles(['User', fileNameTitle, 'id', newFileNameTitle, 'newId', 'mimeType'])
|
|
60656
|
+
csvPF.SetTitles(['User', 'name', 'id', 'newName', 'newId', 'mimeType'])
|
|
60759
60657
|
if addCSVData:
|
|
60760
60658
|
csvPF.AddTitles(sorted(addCSVData.keys()))
|
|
60761
60659
|
i, count, users = getEntityArgument(users)
|
|
@@ -64155,11 +64053,8 @@ def _getDriveFileACLPrintKeysTimeObjects():
|
|
|
64155
64053
|
printKeys = ['id', 'type', 'emailAddress', 'domain', 'role', 'permissionDetails',
|
|
64156
64054
|
'expirationTime', 'photoLink', 'allowFileDiscovery', 'deleted',
|
|
64157
64055
|
'pendingOwner', 'view']
|
|
64158
|
-
timeObjects =
|
|
64159
|
-
|
|
64160
|
-
_mapDrive3TitlesToDrive2(printKeys, API.DRIVE3_TO_DRIVE2_FILES_FIELDS_MAP)
|
|
64161
|
-
_mapDrive3TitlesToDrive2(timeObjects, API.DRIVE3_TO_DRIVE2_FILES_FIELDS_MAP)
|
|
64162
|
-
return (printKeys, set(timeObjects))
|
|
64056
|
+
timeObjects = {'expirationTime'}
|
|
64057
|
+
return (printKeys, timeObjects)
|
|
64163
64058
|
|
|
64164
64059
|
# DriveFileACL commands utilities
|
|
64165
64060
|
def _showDriveFilePermissionJSON(user, fileId, fileName, createdTime, permission, timeObjects):
|
|
@@ -64251,7 +64146,6 @@ def createDriveFileACL(users, useDomainAdminAccess=False):
|
|
|
64251
64146
|
showDetails = True
|
|
64252
64147
|
csvPF = None
|
|
64253
64148
|
FJQC = FormatJSONQuoteChar(csvPF)
|
|
64254
|
-
fileNameTitle = 'title' if not GC.Values[GC.DRIVE_V3_NATIVE_NAMES] else 'name'
|
|
64255
64149
|
fileIdEntity = getDriveFileEntity()
|
|
64256
64150
|
body = {}
|
|
64257
64151
|
body['type'] = permType = getChoice(DRIVEFILE_ACL_PERMISSION_TYPES)
|
|
@@ -64327,7 +64221,7 @@ def createDriveFileACL(users, useDomainAdminAccess=False):
|
|
|
64327
64221
|
printKeys, timeObjects = _getDriveFileACLPrintKeysTimeObjects()
|
|
64328
64222
|
if csvPF:
|
|
64329
64223
|
if showTitles:
|
|
64330
|
-
csvPF.AddTitles(
|
|
64224
|
+
csvPF.AddTitles('name')
|
|
64331
64225
|
csvPF.SetSortAllTitles()
|
|
64332
64226
|
if FJQC.formatJSON:
|
|
64333
64227
|
csvPF.SetJSONTitles(csvPF.titlesList+['JSON'])
|
|
@@ -64366,7 +64260,7 @@ def createDriveFileACL(users, useDomainAdminAccess=False):
|
|
|
64366
64260
|
if csvPF:
|
|
64367
64261
|
baserow = {'Owner': user, 'id': fileId}
|
|
64368
64262
|
if showTitles:
|
|
64369
|
-
baserow[
|
|
64263
|
+
baserow['name'] = fileName
|
|
64370
64264
|
row = baserow.copy()
|
|
64371
64265
|
_mapDrivePermissionNames(permission)
|
|
64372
64266
|
flattenJSON({'permission': permission}, flattened=row, timeObjects=timeObjects)
|
|
@@ -64422,7 +64316,6 @@ def updateDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
64422
64316
|
showDetails = True
|
|
64423
64317
|
csvPF = None
|
|
64424
64318
|
FJQC = FormatJSONQuoteChar(csvPF)
|
|
64425
|
-
fileNameTitle = 'title' if not GC.Values[GC.DRIVE_V3_NATIVE_NAMES] else 'name'
|
|
64426
64319
|
body = {}
|
|
64427
64320
|
while Cmd.ArgumentsRemaining():
|
|
64428
64321
|
myarg = getArgument()
|
|
@@ -64457,7 +64350,7 @@ def updateDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
64457
64350
|
missingArgumentExit(f'role {formatChoiceList(DRIVEFILE_ACL_ROLES_MAP)}')
|
|
64458
64351
|
printKeys, timeObjects = _getDriveFileACLPrintKeysTimeObjects()
|
|
64459
64352
|
if csvPF and showTitles:
|
|
64460
|
-
csvPF.AddTitles(
|
|
64353
|
+
csvPF.AddTitles('name')
|
|
64461
64354
|
csvPF.SetSortAllTitles()
|
|
64462
64355
|
if FJQC.formatJSON:
|
|
64463
64356
|
csvPF.SetJSONTitles(csvPF.titlesList+['JSON'])
|
|
@@ -64500,7 +64393,7 @@ def updateDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
64500
64393
|
if csvPF:
|
|
64501
64394
|
baserow = {'Owner': user, 'id': fileId}
|
|
64502
64395
|
if showTitles:
|
|
64503
|
-
baserow[
|
|
64396
|
+
baserow['name'] = fileName
|
|
64504
64397
|
row = baserow.copy()
|
|
64505
64398
|
_mapDrivePermissionNames(permission)
|
|
64506
64399
|
flattenJSON({'permission': permission}, flattened=row, timeObjects=timeObjects)
|
|
@@ -65065,7 +64958,6 @@ def printShowDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
65065
64958
|
fieldsList = []
|
|
65066
64959
|
OBY = OrderBy(DRIVEFILE_ORDERBY_CHOICE_MAP)
|
|
65067
64960
|
PM = PermissionMatch()
|
|
65068
|
-
fileNameTitle = 'title' if not GC.Values[GC.DRIVE_V3_NATIVE_NAMES] else 'name'
|
|
65069
64961
|
while Cmd.ArgumentsRemaining():
|
|
65070
64962
|
myarg = getArgument()
|
|
65071
64963
|
if csvPF and myarg == 'todrive':
|
|
@@ -65084,7 +64976,7 @@ def printShowDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
65084
64976
|
addTitle = getString(Cmd.OB_STRING)
|
|
65085
64977
|
showTitles = False
|
|
65086
64978
|
if csvPF:
|
|
65087
|
-
csvPF.AddTitles(
|
|
64979
|
+
csvPF.AddTitles('name')
|
|
65088
64980
|
csvPF.SetSortAllTitles()
|
|
65089
64981
|
elif getDriveFilePermissionsFields(myarg, fieldsList):
|
|
65090
64982
|
pass
|
|
@@ -65169,7 +65061,7 @@ def printShowDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
65169
65061
|
else:
|
|
65170
65062
|
baserow = {'Owner': user, 'id': fileId}
|
|
65171
65063
|
if showTitles or addTitle:
|
|
65172
|
-
baserow[
|
|
65064
|
+
baserow['name'] = fileName
|
|
65173
65065
|
if oneItemPerRow:
|
|
65174
65066
|
for permission in permissions:
|
|
65175
65067
|
_mapDrivePermissionNames(permission)
|
|
@@ -65736,7 +65628,6 @@ def doPrintShowOwnership():
|
|
|
65736
65628
|
customerId = GC.Values[GC.CUSTOMER_ID]
|
|
65737
65629
|
if customerId == GC.MY_CUSTOMER:
|
|
65738
65630
|
customerId = None
|
|
65739
|
-
fileNameTitle = 'title' if not GC.Values[GC.DRIVE_V3_NATIVE_NAMES] else 'name'
|
|
65740
65631
|
csvPF = CSVPrintFile('Owner') if Act.csvFormat() else None
|
|
65741
65632
|
FJQC = FormatJSONQuoteChar(csvPF)
|
|
65742
65633
|
addCSVData = {}
|
|
@@ -65781,7 +65672,7 @@ def doPrintShowOwnership():
|
|
|
65781
65672
|
else:
|
|
65782
65673
|
FJQC.GetFormatJSONQuoteChar(myarg, True)
|
|
65783
65674
|
if csvPF and not FJQC.formatJSON:
|
|
65784
|
-
csvPF.AddTitles(['id',
|
|
65675
|
+
csvPF.AddTitles(['id', 'name', 'type', 'ownerIsSharedDrive', 'driveId', 'event'])
|
|
65785
65676
|
if addCSVData:
|
|
65786
65677
|
csvPF.AddTitles(sorted(addCSVData.keys()))
|
|
65787
65678
|
csvPF.SetSortAllTitles()
|
|
@@ -65814,7 +65705,7 @@ def doPrintShowOwnership():
|
|
|
65814
65705
|
elif event['name'] != 'change_owner' and item['name'] == 'owner':
|
|
65815
65706
|
fileInfo['Owner'] = item['value']
|
|
65816
65707
|
elif item['name'] == 'doc_title':
|
|
65817
|
-
fileInfo[
|
|
65708
|
+
fileInfo['name'] = item['value']
|
|
65818
65709
|
elif item['name'] == 'doc_type':
|
|
65819
65710
|
fileInfo['type'] = item['value']
|
|
65820
65711
|
elif item['name'] == 'owner_is_shared_drive':
|
|
@@ -65827,7 +65718,7 @@ def doPrintShowOwnership():
|
|
|
65827
65718
|
if not csvPF:
|
|
65828
65719
|
if not FJQC.formatJSON:
|
|
65829
65720
|
printEntityKVList([Ent.OWNER, fileInfo['Owner']],
|
|
65830
|
-
['id', fileInfo['id'],
|
|
65721
|
+
['id', fileInfo['id'], 'name', fileInfo.get('name', ''),
|
|
65831
65722
|
'type', fileInfo.get('type', ''),
|
|
65832
65723
|
'ownerIsSharedDrive', fileInfo.get('ownerIsSharedDrive', False),
|
|
65833
65724
|
'driveId', fileInfo.get('driveId', ''),
|
gam/gamlib/glapi.py
CHANGED
|
@@ -750,56 +750,6 @@ _USER_SVCACCT_ONLY_SCOPES = [
|
|
|
750
750
|
'scope': 'https://www.googleapis.com/auth/apps.groups.migration'},
|
|
751
751
|
]
|
|
752
752
|
|
|
753
|
-
DRIVE3_TO_DRIVE2_ABOUT_FIELDS_MAP = {
|
|
754
|
-
'displayName': 'name',
|
|
755
|
-
'limit': 'quotaBytesTotal',
|
|
756
|
-
'usage': 'quotaBytesUsedAggregate',
|
|
757
|
-
'usageInDrive': 'quotaBytesUsed',
|
|
758
|
-
'usageInDriveTrash': 'quotaBytesUsedInTrash',
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
DRIVE3_TO_DRIVE2_CAPABILITIES_FIELDS_MAP = {
|
|
762
|
-
'canComment': 'canComment',
|
|
763
|
-
'canReadRevisions': 'canReadRevisions',
|
|
764
|
-
'canCopy': 'copyable',
|
|
765
|
-
'canEdit': 'editable',
|
|
766
|
-
'canShare': 'shareable',
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
DRIVE3_TO_DRIVE2_CAPABILITIES_NAMES_MAP = {
|
|
770
|
-
'canChangeViewersCanCopyContent': 'canChangeRestrictedDownload',
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
DRIVE3_TO_DRIVE2_FILES_FIELDS_MAP = {
|
|
774
|
-
'allowFileDiscovery': 'withLink',
|
|
775
|
-
'createdTime': 'createdDate',
|
|
776
|
-
'expirationTime': 'expirationDate',
|
|
777
|
-
'modifiedByMe': 'modified',
|
|
778
|
-
'modifiedByMeTime': 'modifiedByMeDate',
|
|
779
|
-
'modifiedTime': 'modifiedDate',
|
|
780
|
-
'name': 'title',
|
|
781
|
-
'restrictionTime': 'restrictionDate',
|
|
782
|
-
'sharedWithMeTime': 'sharedWithMeDate',
|
|
783
|
-
'size': 'fileSize',
|
|
784
|
-
'trashedTime': 'trashedDate',
|
|
785
|
-
'viewedByMe': 'viewed',
|
|
786
|
-
'viewedByMeTime': 'lastViewedByMeDate',
|
|
787
|
-
'webViewLink': 'alternateLink',
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
DRIVE3_TO_DRIVE2_LABELS_MAP = {
|
|
791
|
-
'modifiedByMe': 'modified',
|
|
792
|
-
'starred': 'starred',
|
|
793
|
-
'trashed': 'trashed',
|
|
794
|
-
'viewedByMe': 'viewed',
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
DRIVE3_TO_DRIVE2_REVISIONS_FIELDS_MAP = {
|
|
798
|
-
'modifiedTime': 'modifiedDate',
|
|
799
|
-
'keepForever': 'pinned',
|
|
800
|
-
'size': 'fileSize',
|
|
801
|
-
}
|
|
802
|
-
|
|
803
753
|
def getAPIName(api):
|
|
804
754
|
return _INFO[api]['name']
|
|
805
755
|
|
gam/gamlib/glcfg.py
CHANGED
|
@@ -155,8 +155,6 @@ DRIVE_DIR = 'drive_dir'
|
|
|
155
155
|
DRIVE_MAX_RESULTS = 'drive_max_results'
|
|
156
156
|
# Use Drive V3 beta
|
|
157
157
|
DRIVE_V3_BETA = 'drive_v3_beta'
|
|
158
|
-
# Use Drive V3 ntive names
|
|
159
|
-
DRIVE_V3_NATIVE_NAMES = 'drive_v3_native_names'
|
|
160
158
|
# When processing email messages in batches, how many should be processed in each batch
|
|
161
159
|
EMAIL_BATCH_SIZE = 'email_batch_size'
|
|
162
160
|
# Enable Delegated Admin Service Account
|
|
@@ -382,7 +380,6 @@ Defaults = {
|
|
|
382
380
|
ENFORCE_EXPANSIVE_ACCESS: TRUE,
|
|
383
381
|
DRIVE_MAX_RESULTS: '1000',
|
|
384
382
|
DRIVE_V3_BETA: FALSE,
|
|
385
|
-
DRIVE_V3_NATIVE_NAMES: TRUE,
|
|
386
383
|
EMAIL_BATCH_SIZE: '50',
|
|
387
384
|
ENABLE_DASA: FALSE,
|
|
388
385
|
ENABLE_GCLOUD_REAUTH: FALSE,
|
|
@@ -551,7 +548,6 @@ VAR_INFO = {
|
|
|
551
548
|
ENFORCE_EXPANSIVE_ACCESS: {VAR_TYPE: TYPE_BOOLEAN},
|
|
552
549
|
DRIVE_MAX_RESULTS: {VAR_TYPE: TYPE_INTEGER, VAR_LIMITS: (1, 1000)},
|
|
553
550
|
DRIVE_V3_BETA: {VAR_TYPE: TYPE_BOOLEAN},
|
|
554
|
-
DRIVE_V3_NATIVE_NAMES: {VAR_TYPE: TYPE_BOOLEAN},
|
|
555
551
|
EMAIL_BATCH_SIZE: {VAR_TYPE: TYPE_INTEGER, VAR_LIMITS: (1, 100)},
|
|
556
552
|
ENABLE_DASA: {VAR_TYPE: TYPE_BOOLEAN, VAR_SIGFILE: 'enabledasa.txt', VAR_SFFT: (FALSE, TRUE)},
|
|
557
553
|
ENABLE_GCLOUD_REAUTH: {VAR_TYPE: TYPE_BOOLEAN},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
gam/__init__.py,sha256
|
|
1
|
+
gam/__init__.py,sha256=-iK1wx4zPLo48IM9piErpNOHxAqS7lFpkO3M31iF-iw,3566026
|
|
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,8 +23,8 @@ 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=
|
|
27
|
-
gam/gamlib/glcfg.py,sha256=
|
|
26
|
+
gam/gamlib/glapi.py,sha256=l3iC1H2_slHFaJ8tIvx3n4JY-1_hqP5xF541YD06zEY,34738
|
|
27
|
+
gam/gamlib/glcfg.py,sha256=J4w16Nfk282S7iuSmk3601GHgt_MJ4qWeSzF5y7ZzX0,28139
|
|
28
28
|
gam/gamlib/glclargs.py,sha256=zCfq3-XRiaEF58o5lmQVnxgV3AqMWMIs4Ra42iHExPQ,43538
|
|
29
29
|
gam/gamlib/glentity.py,sha256=bFVeXqJ4VLIpFgc9y083oeBn8JzbwPYVJeuJF0yrnk8,34405
|
|
30
30
|
gam/gamlib/glgapi.py,sha256=pdBbwNtnCwFWxJGaP-_3hdTjSNoOCJF2yo76WdQOi1k,40426
|
|
@@ -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.
|
|
69
|
-
gam7-7.
|
|
70
|
-
gam7-7.
|
|
71
|
-
gam7-7.
|
|
72
|
-
gam7-7.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|