mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-28 18:01:36 +00:00
Added option stripcrsfromname to gam <UserTypeEntity> print driveactivity
Some checks are pending
Build and test GAM / build (Win64, build, 8, VC-WIN64A, windows-2022) (push) Waiting to run
Build and test GAM / build (aarch64, build, 2, linux-aarch64, [self-hosted linux arm64]) (push) Waiting to run
Build and test GAM / build (aarch64, build, 4, linux-aarch64, [self-hosted linux arm64], yes) (push) Waiting to run
Build and test GAM / build (aarch64, build, 6, darwin64-arm64, macos-14) (push) Waiting to run
Build and test GAM / build (universal2, build, 7, darwin64-arm64 darwin64-x86_64, macos-14) (push) Waiting to run
Build and test GAM / build (x86_64, build, 1, linux-x86_64, ubuntu-20.04) (push) Waiting to run
Build and test GAM / build (x86_64, build, 3, linux-x86_64, ubuntu-20.04, yes) (push) Waiting to run
Build and test GAM / build (x86_64, build, 5, darwin64-x86_64, macos-12) (push) Waiting to run
Build and test GAM / build (x86_64, test, 10, ubuntu-22.04, 3.9) (push) Waiting to run
Build and test GAM / build (x86_64, test, 11, ubuntu-22.04, 3.10) (push) Waiting to run
Build and test GAM / build (x86_64, test, 12, ubuntu-22.04, 3.11) (push) Waiting to run
Build and test GAM / build (x86_64, test, 9, ubuntu-22.04, 3.8) (push) Waiting to run
Build and test GAM / merge (push) Blocked by required conditions
Build and test GAM / publish (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Check for Google Root CA Updates / check-apis (push) Waiting to run
Some checks are pending
Build and test GAM / build (Win64, build, 8, VC-WIN64A, windows-2022) (push) Waiting to run
Build and test GAM / build (aarch64, build, 2, linux-aarch64, [self-hosted linux arm64]) (push) Waiting to run
Build and test GAM / build (aarch64, build, 4, linux-aarch64, [self-hosted linux arm64], yes) (push) Waiting to run
Build and test GAM / build (aarch64, build, 6, darwin64-arm64, macos-14) (push) Waiting to run
Build and test GAM / build (universal2, build, 7, darwin64-arm64 darwin64-x86_64, macos-14) (push) Waiting to run
Build and test GAM / build (x86_64, build, 1, linux-x86_64, ubuntu-20.04) (push) Waiting to run
Build and test GAM / build (x86_64, build, 3, linux-x86_64, ubuntu-20.04, yes) (push) Waiting to run
Build and test GAM / build (x86_64, build, 5, darwin64-x86_64, macos-12) (push) Waiting to run
Build and test GAM / build (x86_64, test, 10, ubuntu-22.04, 3.9) (push) Waiting to run
Build and test GAM / build (x86_64, test, 11, ubuntu-22.04, 3.10) (push) Waiting to run
Build and test GAM / build (x86_64, test, 12, ubuntu-22.04, 3.11) (push) Waiting to run
Build and test GAM / build (x86_64, test, 9, ubuntu-22.04, 3.8) (push) Waiting to run
Build and test GAM / merge (push) Blocked by required conditions
Build and test GAM / publish (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Check for Google Root CA Updates / check-apis (push) Waiting to run
This commit is contained in:
@@ -51992,7 +51992,7 @@ DRIVE_ACTIVITY_ACTION_MAP = {
|
||||
|
||||
CONSOLIDATION_GROUPING_STRATEGY_CHOICE_MAP = {'driveui': 'legacy', 'legacy': 'legacy', 'none': 'none'}
|
||||
|
||||
# gam <UserTypeEntity> print|show driveactivity [todrive <ToDriveAttribute>*]
|
||||
# gam <UserTypeEntity> print driveactivity [todrive <ToDriveAttribute>*]
|
||||
# [(fileid <DriveFileID>) | (folderid <DriveFolderID>) |
|
||||
# (drivefilename <DriveFileName>) | (drivefoldername <DriveFolderName>) | (query <QueryDriveFile>)]
|
||||
# [([start <Date>|<Time>] [end <Date>|<Time>])|(range <Date>|<Time> <Date>|<Time>)|
|
||||
@@ -52000,7 +52000,7 @@ CONSOLIDATION_GROUPING_STRATEGY_CHOICE_MAP = {'driveui': 'legacy', 'legacy': 'le
|
||||
# [action|actions [not] <DriveActivityActionList>]
|
||||
# [consolidationstrategy legacy|none]
|
||||
# [idmapfile <CSVFileInput> endcsv]
|
||||
# [formatjson [quotechar <Character>]]
|
||||
# [stripcrsfromname] [formatjson [quotechar <Character>]]
|
||||
def printDriveActivity(users):
|
||||
def _getUserInfo(userId):
|
||||
if userId.startswith('people/'):
|
||||
@@ -52041,7 +52041,7 @@ def printDriveActivity(users):
|
||||
activityFilter = ''
|
||||
actions = set()
|
||||
strategy = 'none'
|
||||
negativeAction = False
|
||||
negativeAction = stripCRsFromName = False
|
||||
checkArgumentPresent(['v2'])
|
||||
csvPF = CSVPrintFile([f'user{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}name',
|
||||
f'user{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}emailAddress',
|
||||
@@ -52086,6 +52086,8 @@ def printDriveActivity(users):
|
||||
for row in csvFile:
|
||||
userInfo[row['id']] = (row['primaryEmail'], row.get('name.fullName', UNKNOWN))
|
||||
closeFile(f)
|
||||
elif myarg == 'stripcrsfromname':
|
||||
stripCRsFromName = True
|
||||
else:
|
||||
FJQC.GetFormatJSONQuoteChar(myarg, True)
|
||||
if not baseFileList and not query:
|
||||
@@ -52173,12 +52175,16 @@ def printDriveActivity(users):
|
||||
driveItem = targets[0].get('driveItem')
|
||||
if driveItem:
|
||||
eventRow[f'target{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}id'] = driveItem['name'][6:]
|
||||
if stripCRsFromName:
|
||||
driveItem['title'] = _stripControlCharsFromName(driveItem['title'])
|
||||
eventRow[f'target{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}name'] = driveItem['title']
|
||||
eventRow[f'target{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}mimeType'] = driveItem['mimeType']
|
||||
else:
|
||||
sharedDrive = targets[0].get('teamDrive')
|
||||
if sharedDrive:
|
||||
eventRow[f'target{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}id'] = sharedDrive['name'][11:]
|
||||
if stripCRsFromName:
|
||||
sharedDrive['title'] = _stripControlCharsFromName(sharedDrive['title'])
|
||||
eventRow[f'target{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}name'] = sharedDrive['title']
|
||||
if 'timestamp' in activityEvent:
|
||||
eventRow['eventTime'] = formatLocalTime(activityEvent['timestamp'])
|
||||
|
||||
Reference in New Issue
Block a user