mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-03 22:01:39 +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:
@@ -10,6 +10,11 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
|
||||
|
||||
See [Downloads-Installs](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads-Installs) for Windows or other options, including manual installation
|
||||
|
||||
### 6.80.03
|
||||
|
||||
Added option `stripcrsfromname` to `gam <UserTypeEntity> print driveactivity` that causes carriage returns,
|
||||
linefeeds and nulls to be stripped from file names.
|
||||
|
||||
### 6.80.02
|
||||
|
||||
Added option `addcsvdata <FieldName> <String>` to `gam <UserTypeEntity> print filecounts` that adds
|
||||
|
||||
@@ -251,7 +251,7 @@ writes the credentials into the file oauth2.txt.
|
||||
admin@server:/Users/admin$ rm -f /Users/admin/GAMConfig/oauth2.txt
|
||||
admin@server:/Users/admin$ gam version
|
||||
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
|
||||
GAMADV-XTD3 6.80.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.80.03 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.12.4 64-bit final
|
||||
MacOS Sonoma 14.5 x86_64
|
||||
@@ -923,7 +923,7 @@ writes the credentials into the file oauth2.txt.
|
||||
C:\>del C:\GAMConfig\oauth2.txt
|
||||
C:\>gam version
|
||||
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
|
||||
GAMADV-XTD3 6.80.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.80.03 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.12.4 64-bit final
|
||||
Windows-10-10.0.17134 AMD64
|
||||
|
||||
@@ -70,7 +70,7 @@ Google has introduced Drive Activity API v2; it adds time and action filtering a
|
||||
Drive Activity API v1 has been deprecated.
|
||||
* https://developers.google.com/drive/activity/v2/migrating
|
||||
```
|
||||
gam <UserTypeEntity> print|show driveactivity [v2] [todrive <ToDriveAttributes>*]
|
||||
gam <UserTypeEntity> print driveactivity [v2] [todrive <ToDriveAttributes>*]
|
||||
[(fileid <DriveFileID>)|(folderid <DriveFolderID>)|
|
||||
(drivefilename <DriveFileName>)|(drivefoldername <DriveFolderName>)|
|
||||
(query <QueryDriveFile>)]
|
||||
@@ -79,7 +79,7 @@ gam <UserTypeEntity> print|show driveactivity [v2] [todrive <ToDriveAttributes>*
|
||||
[action|actions [not] <DriveActivityActionList>]
|
||||
[consolidationstrategy legacy|none]
|
||||
[idmapfile <FileName>|(gsheet <UserGoogleSheet>) [charset <String>] [columndelimiter <Character>] [noescapechar <Boolean>] [quotechar <Character>]]
|
||||
[formatjson [quotechar <Character>]]
|
||||
[stripcrsfromname] [formatjson [quotechar <Character>]]
|
||||
```
|
||||
By default, Drive Activity API v2 is used; the `v2` option is ignored.
|
||||
|
||||
@@ -128,6 +128,9 @@ must be present in the file; the column `name.fullName` will be used if present.
|
||||
|
||||
If you don't use the `idmapfile` option, Gam makes an additional API call per user to get the name and email address.
|
||||
|
||||
The `stripcrsfromname` option strips nulls, carriage returns and linefeeds from drive file names.
|
||||
Use this option if you discover filenames containing these special characters; it is not common.
|
||||
|
||||
By default, Gam displays the information as columns of fields; the following option causes the output to be in JSON format,
|
||||
* `formatjson` - Display the fields in JSON format.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Print the current version of Gam with details
|
||||
```
|
||||
gam version
|
||||
GAMADV-XTD3 6.80.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.80.03 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.12.4 64-bit final
|
||||
MacOS Sonoma 14.5 x86_64
|
||||
@@ -15,7 +15,7 @@ Time: 2023-06-02T21:10:00-07:00
|
||||
Print the current version of Gam with details and time offset information
|
||||
```
|
||||
gam version timeoffset
|
||||
GAMADV-XTD3 6.80.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.80.03 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.12.4 64-bit final
|
||||
MacOS Sonoma 14.5 x86_64
|
||||
@@ -27,7 +27,7 @@ Your system time differs from www.googleapis.com by less than 1 second
|
||||
Print the current version of Gam with extended details and SSL information
|
||||
```
|
||||
gam version extended
|
||||
GAMADV-XTD3 6.80.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.80.03 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.12.4 64-bit final
|
||||
MacOS Sonoma 14.5 x86_64
|
||||
@@ -64,7 +64,7 @@ MacOS High Sierra 10.13.6 x86_64
|
||||
Path: /Users/Admin/bin/gamadv-xtd3
|
||||
Version Check:
|
||||
Current: 5.35.08
|
||||
Latest: 6.80.02
|
||||
Latest: 6.80.03
|
||||
echo $?
|
||||
1
|
||||
```
|
||||
@@ -72,7 +72,7 @@ echo $?
|
||||
Print the current version number without details
|
||||
```
|
||||
gam version simple
|
||||
6.80.02
|
||||
6.80.03
|
||||
```
|
||||
In Linux/MacOS you can do:
|
||||
```
|
||||
@@ -82,7 +82,7 @@ echo $VER
|
||||
Print the current version of Gam and address of this Wiki
|
||||
```
|
||||
gam help
|
||||
GAM 6.80.02 - https://github.com/taers232c/GAMADV-XTD3
|
||||
GAM 6.80.03 - https://github.com/taers232c/GAMADV-XTD3
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.12.4 64-bit final
|
||||
MacOS Sonoma 14.5 x86_64
|
||||
|
||||
@@ -7142,7 +7142,7 @@ gam <UserTypeEntity> print diskusage <DriveFileEntity> [todrive <ToDriveAttribut
|
||||
upload
|
||||
<DriveActivityActionList> ::= "<DriveActivityAction>(,<DriveActivityAction>)*"
|
||||
|
||||
gam <UserTypeEntity> print|show driveactivity [todrive <ToDriveAttribute>*]
|
||||
gam <UserTypeEntity> print driveactivity [todrive <ToDriveAttribute>*]
|
||||
[(fileid <DriveFileID>) | (folderid <DriveFolderID>) |
|
||||
(drivefilename <DriveFileName>) | (drivefoldername <DriveFolderName>) | (query <QueryDriveFile>)]
|
||||
[([start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>])|(range <Date>|<Time> <Date>)|<Time>|
|
||||
@@ -7150,7 +7150,7 @@ gam <UserTypeEntity> print|show driveactivity [todrive <ToDriveAttribute>*]
|
||||
[action|actions [not] <DriveActivityActionList>]
|
||||
[consolidationstrategy legacy|none]
|
||||
[idmapfile <CSVFileInput> endcsv]
|
||||
[formatjson [quotechar <Character>]]
|
||||
[stripcrsfromname] [formatjson [quotechar <Character>]]
|
||||
|
||||
<DriveSettingsFieldName> ::=
|
||||
appinstalled|
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
Merged GAM-Team version
|
||||
|
||||
6.80.03
|
||||
|
||||
Added option `stripcrsfromname` to `gam <UserTypeEntity> print driveactivity` that causes carriage returns,
|
||||
linefeeds and nulls to be stripped from file names.
|
||||
|
||||
6.80.02
|
||||
|
||||
Added option `addcsvdata <FieldName> <String>` to `gam <UserTypeEntity> print filecounts` that adds
|
||||
|
||||
@@ -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