Updated gam <UserTypeEntity> print filelist ... showshareddrivepermissions

This commit is contained in:
Ross Scroggs
2024-05-31 20:47:00 -07:00
parent 1f9624ad5c
commit f6b949e4c1
9 changed files with 41 additions and 12 deletions

View File

@@ -53776,6 +53776,7 @@ def printFileList(users):
csvPF.WriteRowTitlesJSONNoFilter(row)
def _printFileInfo(drive, user, f_file, cleanFileName):
nonlocal getSharedDriveACLsCount, getSharedDriveACLsCountMsg
driveId = f_file.get('driveId')
checkSharedDrivePermissions = getPermissionsForSharedDrives and driveId and 'permissions' not in f_file
if (f_file.get('noDisplay', False) or
@@ -53789,6 +53790,10 @@ def printFileList(users):
(DLP.onlySharedDrives and not driveId)):
return
if checkSharedDrivePermissions:
if not incrementalPrint:
getSharedDriveACLsCount += 1
if getSharedDriveACLsCount % 100 == 0:
writeStderr(f'{Msg.GOT} {getSharedDriveACLsCount} {getSharedDriveACLsCountMsg}')
try:
f_file['permissions'] = callGAPIpages(drive.permissions(), 'list', 'permissions',
throwReasons=GAPI.DRIVE3_GET_ACL_REASONS,
@@ -54053,6 +54058,7 @@ def printFileList(users):
elif myarg == 'showshareddrivepermissions':
getPermissionsForSharedDrives = True
permissionsFields = f'nextPageToken,permissions({",".join(DRIVEFILE_BASIC_PERMISSION_FIELDS)})'
getSharedDriveACLsCountMsg = f'{Ent.Plural(Ent.DRIVE_FILE_OR_FOLDER_ACL)} {Msg.FOR} {Ent.Plural(Ent.SHAREDDRIVE)}\n'
elif myarg == 'pmfilter':
pmselect = False
elif myarg == 'oneitemperrow':
@@ -54198,6 +54204,7 @@ def printFileList(users):
filePathInfo = initFilePathInfo(pathDelimiter)
filesPrinted = set()
mimeTypeInfo = {}
getSharedDriveACLsCount = 0
if buildTree:
printGettingAllEntityItemsForWhom(Ent.DRIVE_FILE_OR_FOLDER, user, i, count, query=DLP.fileIdEntity['query'])
if not incrementalPrint: