Updated functionality of option preservefiletimes in gam <UserTypeEntity> update drivefile <DriveFileEntity>.

This commit is contained in:
Ross Scroggs
2023-12-14 10:06:46 -08:00
parent 2bb0088ade
commit 80fc40a9c7
8 changed files with 46 additions and 13 deletions

View File

@@ -322,12 +322,12 @@ Version `6.21.02` is required.
Display direct policies, update all
```
gam redirect csv ChromePolicies.csv print chromepolicies ou "/Path/To/OU1" show direct formatjson quotechar "'"
gam csv ChromePolicies.csv quotechar "'" gam update chromepolicy "~name" json "~JSON"
gam csv ChromePolicies.csv quotechar "'" gam update chromepolicy "~name" json "~JSON" ou "/Path/To/OU2"
```
Display all policies, select direct on update
```
gam redirect csv ChromePolicies.csv print chromepolicies ou "/Path/To/OU1" formatjson quotechar "'"
gam config csv_input_row_filter "direct:boolean:true" csv ChromePolicies.csv quotechar "'" gam update chromepolicy "~name" json "~JSON"
gam config csv_input_row_filter "direct:boolean:true" csv ChromePolicies.csv quotechar "'" gam update chromepolicy "~name" json "~JSON" ou "/Path/To/OU2"
```
## Create Chrome network

View File

@@ -10,6 +10,17 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation
### 6.66.13
Updated functionality of option `preservefiletimes` in `gam <UserTypeEntity> update drivefile <DriveFileEntity>`.
* Current
* `preservefiletimes localfile <FileName>` - `modifiedTime` of `<DriveFileEntity>` is set to that of `localfile <FileName>`
* `preservefiletimes` - No effect
* Updated
* `preservefiletimes localfile <FileName>` - `modifiedTime` of `<DriveFileEntity>` is set to that of `localfile <FileName>`
* `preservefiletimes` - `modifiedTime` of `<DriveFileEntity>` retains its current value
### 6.66.12
Upgraded to Python 3.12.1 where possible.

View File

@@ -334,7 +334,7 @@ writes the credentials into the file oauth2.txt.
admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt
admin@server:/Users/admin/bin/gamadv-xtd3$ ./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.66.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.66.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.10.8 64-bit final
MacOS High Sierra 10.13.6 x86_64
@@ -1002,7 +1002,7 @@ writes the credentials into the file oauth2.txt.
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
C:\GAMADV-XTD3>gam version
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
GAMADV-XTD3 6.66.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.66.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
Windows-10-10.0.17134 AMD64

View File

@@ -493,7 +493,8 @@ From the Google Drive API documentation.
By default, Google assigns the current time to the attribute `modifiedTime`; you can assign your own value
with `modifiedtime <Time>`.
The option `preservefiletimes`, when used with `localfile <FileName>`, will set the `modifiedTime` attribute from the local file.
* `preservefiletimes localfile <FileName>` - `modifiedTime` of `<DriveFileEntity>` is set to that of `localfile <FileName>`
* `preservefiletimes` - `modifiedTime` of `<DriveFileEntity>` retains its current value
These are the naming rules when updating from a local file:
* `update drivefile drivefilename "GoogleFile.csv" localfile "NewLocalFile.csv"` - Google Drive file "GoogleFile.csv" is renamed "NewLocalFile.csv"

View File

@@ -13,6 +13,7 @@
## API documentation
* https://developers.google.com/gmail/api/reference/rest/v1/users.settings.sendAs
* https://developers.google.com/gmail/api/v1/reference/users/settings
* https://support.google.com/a/answer/1710338
## Definitions
* [`<UserTypeEntity>`](Collections-of-Users)
@@ -87,6 +88,8 @@ of the sendas address.
The `default` option sets `<EmailAddress>` as the default sendas address for the user.
For `treatasalias`, see: https://support.google.com/a/answer/1710338
You can allow users to send mail through an external SMTP server when configuring a sendas address hosted outside your email domains. You must enable
this capability in Admin Console/Apps/Google Workspace/Gmail/Advanced settings/End User Access/Allow per-user outbound gateways.
@@ -145,6 +148,8 @@ gam <UserTypeEntity> signature|sig
The `default` option sets `<EmailAddress>` as the default sendas address for the user.
For `treatasalias`, see: https://support.google.com/a/answer/1710338
When `<UserTypeEntity>` specifies an alias, the `primary` option causes the primary
email address signature rather than the alias signature to be set.

View File

@@ -4,7 +4,7 @@
Print the current version of Gam with details
```
gam version
GAMADV-XTD3 6.66.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.66.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
MacOS Monterey 12.7 x86_64
@@ -16,7 +16,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.66.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.66.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
MacOS Monterey 12.7 x86_64
@@ -28,7 +28,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.66.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.66.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
MacOS Monterey 12.7 x86_64
@@ -65,7 +65,7 @@ MacOS High Sierra 10.13.6 x86_64
Path: /Users/Admin/bin/gamadv-xtd3
Version Check:
Current: 5.35.08
Latest: 6.66.12
Latest: 6.66.13
echo $?
1
```
@@ -73,7 +73,7 @@ echo $?
Print the current version number without details
```
gam version simple
6.66.12
6.66.13
```
In Linux/MacOS you can do:
```
@@ -83,7 +83,7 @@ echo $VER
Print the current version of Gam and address of this Wiki
```
gam help
GAM 6.66.12 - https://github.com/taers232c/GAMADV-XTD3
GAM 6.66.13 - https://github.com/taers232c/GAMADV-XTD3
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
MacOS Monterey 12.7 x86_64

View File

@@ -2,6 +2,17 @@
Merged GAM-Team version
6.66.13
Updated functionality of option `preservefiletimes` in `gam <UserTypeEntity> update drivefile <DriveFileEntity>`.
* Current
* `preservefiletimes localfile <FileName>` - `modifiedTime` of `<DriveFileEntity>` is set to that of `localfile <FileName>`
* `preservefiletimes` - No effect
* Updated
* `preservefiletimes localfile <FileName>` - `modifiedTime` of `<DriveFileEntity>` is set to that of `localfile <FileName>`
* `preservefiletimes` - `modifiedTime` of `<DriveFileEntity>` retains its current value
6.66.12
Upgraded to Python 3.12.1 where possible.

View File

@@ -54825,6 +54825,7 @@ def updateDriveFile(users):
addSheetEntity = None
updateSheetEntity = None
clearFilter = False
preserveModifiedTime = False
encoding = GC.Values[GC.CHARSET]
columnDelimiter = GC.Values[GC.CSV_INPUT_COLUMN_DELIMITER]
returnIdLink = None
@@ -54877,6 +54878,8 @@ def updateDriveFile(users):
addSheetEntity = updateSheetEntity = None
media_body = getMediaBody(parameters)
body['mimeType'] = parameters[DFA_LOCALMIMETYPE]
elif operation == 'update' and parameters[DFA_PRESERVE_FILE_TIMES]:
preserveModifiedTime = True
i, count, users = getEntityArgument(users)
for user in users:
i += 1
@@ -54898,15 +54901,17 @@ def updateDriveFile(users):
try:
addParents = addParentsBase[:]
removeParents = removeParentsBase[:]
if newParents or (not newName and parameters[DFA_REPLACEFILENAME]):
if newParents or (not newName and parameters[DFA_REPLACEFILENAME]) or preserveModifiedTime:
result = callGAPI(drive.files(), 'get',
throwReasons=GAPI.DRIVE_GET_THROW_REASONS,
fileId=fileId, fields='name,parents', supportsAllDrives=True)
fileId=fileId, fields='name,parents,modifiedTime', supportsAllDrives=True)
if newParents:
addParents.extend(newParents)
removeParents.extend(result.get('parents', []))
if not newName and parameters[DFA_REPLACEFILENAME]:
body['name'] = processFilenameReplacements(result['name'], parameters[DFA_REPLACEFILENAME])
if preserveModifiedTime:
body['modifiedTime'] = result['modifiedTime']
if newName:
if parameters[DFA_REPLACEFILENAME]:
body['name'] = processFilenameReplacements(newName, parameters[DFA_REPLACEFILENAME])