mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-04 03:33:44 +00:00
Revert "Sdd skids to more command, handle Shared Drive limitations"
This reverts commit 5271368776
.
This commit is contained in:
@ -10,25 +10,6 @@ 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
|
See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation
|
||||||
|
|
||||||
### 6.67.02
|
|
||||||
|
|
||||||
Added option `skipids <DriveFileEntity>` to `gam <UserTypeEntity> transfer drive` that handles special cases
|
|
||||||
where you want to prevent ownership from being transferred for selected files/folders.
|
|
||||||
|
|
||||||
Added option `skipids <DriveFileEntity>` to `gam <UserTypeEntity> copy drivefile` that handles special cases
|
|
||||||
where you want to prevent selected files/folders from being copied.
|
|
||||||
|
|
||||||
Added option `skipids <DriveFileEntity>` to `gam <UserTypeEntity> move drivefile` that handles special cases
|
|
||||||
where you want to prevent selected files/folders from being moved.
|
|
||||||
|
|
||||||
Updated commands that create files/folders on Shared Drives to handle the following errors:
|
|
||||||
```
|
|
||||||
storageQuotaExceeded
|
|
||||||
teamDriveFileLimitExceeded
|
|
||||||
teamDriveHierarchyTooDeep
|
|
||||||
```
|
|
||||||
* See: https://support.google.com/a/users/answer/7338880#shared_drives_file_folder_limits
|
|
||||||
|
|
||||||
### 6.67.01
|
### 6.67.01
|
||||||
|
|
||||||
Fixed bug in `gam print vaultcounts` that caused a trap.
|
Fixed bug in `gam print vaultcounts` that caused a trap.
|
||||||
|
@ -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$ rm -f /Users/admin/GAMConfig/oauth2.txt
|
||||||
admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version
|
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
|
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
|
||||||
GAMADV-XTD3 6.67.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.67.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.10.8 64-bit final
|
Python 3.10.8 64-bit final
|
||||||
MacOS High Sierra 10.13.6 x86_64
|
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>del C:\GAMConfig\oauth2.txt
|
||||||
C:\GAMADV-XTD3>gam version
|
C:\GAMADV-XTD3>gam version
|
||||||
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
|
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
|
||||||
GAMADV-XTD3 6.67.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.67.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
Windows-10-10.0.17134 AMD64
|
Windows-10-10.0.17134 AMD64
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
* https://developers.google.com/drive/api/v3/reference/teamdrives/list
|
* https://developers.google.com/drive/api/v3/reference/teamdrives/list
|
||||||
* https://support.google.com/a/answer/7374057
|
* https://support.google.com/a/answer/7374057
|
||||||
* https://workspaceupdates.googleblog.com/2022/05/shared-drives-in-organizational-units-open-beta.html
|
* https://workspaceupdates.googleblog.com/2022/05/shared-drives-in-organizational-units-open-beta.html
|
||||||
* https://support.google.com/a/users/answer/7338880
|
|
||||||
|
|
||||||
## Query documentation
|
## Query documentation
|
||||||
* https://developers.google.com/drive/api/v3/search-shareddrives
|
* https://developers.google.com/drive/api/v3/search-shareddrives
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
## API documentation
|
## API documentation
|
||||||
* https://developers.google.com/drive/api/v3/reference/files
|
* https://developers.google.com/drive/api/v3/reference/files
|
||||||
* https://support.google.com/a/answer/7374057
|
* https://support.google.com/a/answer/7374057
|
||||||
* https://support.google.com/a/users/answer/7338880
|
|
||||||
|
|
||||||
## Definitions
|
## Definitions
|
||||||
* [`<DriveFileEntity>`](Drive-File-Selection)
|
* [`<DriveFileEntity>`](Drive-File-Selection)
|
||||||
@ -67,13 +66,12 @@ gam <UserTypeEntity> copy drivefile <DriveFileEntity>
|
|||||||
[summary [<Boolean>]] [showpermissionmessages [<Boolean>]]
|
[summary [<Boolean>]] [showpermissionmessages [<Boolean>]]
|
||||||
[<DriveFileParentAttribute>]
|
[<DriveFileParentAttribute>]
|
||||||
[mergewithparent [<Boolean>]] [recursive [depth <Number>]]
|
[mergewithparent [<Boolean>]] [recursive [depth <Number>]]
|
||||||
<DriveFileCopyAttribute>*
|
|
||||||
[skipids <DriveFileEntity>]
|
|
||||||
[copysubfiles [<Boolean>]] [filenamematchpattern <RegularExpression>]
|
[copysubfiles [<Boolean>]] [filenamematchpattern <RegularExpression>]
|
||||||
[filemimetype [not] <MimeTypeList>]
|
[filemimetype [not] <MimeTypeList>]
|
||||||
[copysubfilesownedby any|me|others]
|
[copysubfilesownedby any|me|others]
|
||||||
[copysubfolders [<Boolean>]] [foldernamematchpattern <RegularExpression>]
|
[copysubfolders [<Boolean>]] [foldernamematchpattern <RegularExpression>]
|
||||||
[copysubshortcuts [<Boolean>]] [shortcutnamematchpattern <RegularExpression>]
|
[copysubshortcuts [<Boolean>]] [shortcutnamematchpattern <RegularExpression>]
|
||||||
|
<DriveFileCopyAttribute>*
|
||||||
[duplicatefiles overwriteolder|overwriteall|duplicatename|uniquename|skip]
|
[duplicatefiles overwriteolder|overwriteall|duplicatename|uniquename|skip]
|
||||||
[duplicatefolders merge|duplicatename|uniquename|skip]
|
[duplicatefolders merge|duplicatename|uniquename|skip]
|
||||||
[copiedshortcutspointtocopiedfiles [<Boolean>]]
|
[copiedshortcutspointtocopiedfiles [<Boolean>]]
|
||||||
@ -127,9 +125,6 @@ The `depth <Number>` argument controls which files or folders within the top fol
|
|||||||
* `depth 0` - the files or folders in the top folder are copied, no descendants of folders are copied.
|
* `depth 0` - the files or folders in the top folder are copied, no descendants of folders are copied.
|
||||||
* `depth N` - the files and folders within the top folder and those files and folders N levels below the top folder are copied.
|
* `depth N` - the files and folders within the top folder and those files and folders N levels below the top folder are copied.
|
||||||
|
|
||||||
### This option handles special cases where you want to prevent selected files/folders from being copied.
|
|
||||||
* `skipids <DriveFileEntity>` - Do not copy files/folders with the specified IDs.
|
|
||||||
|
|
||||||
### By default, when recursively copying a top folder, all sub files, folders and shortcuts are copied, subject to the `depth` option.
|
### By default, when recursively copying a top folder, all sub files, folders and shortcuts are copied, subject to the `depth` option.
|
||||||
You can specify whether sub files, folders and shortcuts are copied. If sub folders are not copied, their contents are not copied.
|
You can specify whether sub files, folders and shortcuts are copied. If sub folders are not copied, their contents are not copied.
|
||||||
* `copysubfiles false` - Sub files are not copied
|
* `copysubfiles false` - Sub files are not copied
|
||||||
@ -208,7 +203,6 @@ In previous versions, copying shortcuts caused an error because shortcuts can't
|
|||||||
|
|
||||||
If a shortcut in the source structure points to a file/folder that is not in the source structure:
|
If a shortcut in the source structure points to a file/folder that is not in the source structure:
|
||||||
* The shortcut is re-created to point to the original file/folder.
|
* The shortcut is re-created to point to the original file/folder.
|
||||||
|
|
||||||
If a shortcut in the source structure points to a file/folder that is in the source structure:
|
If a shortcut in the source structure points to a file/folder that is in the source structure:
|
||||||
* `copiedshortcutspointtocopiedfiles` omitted or `copiedshortcutspointtocopiedfiles true` - The shortcut is re-created to point to the copied file/folder.
|
* `copiedshortcutspointtocopiedfiles` omitted or `copiedshortcutspointtocopiedfiles true` - The shortcut is re-created to point to the copied file/folder.
|
||||||
* `copiedshortcutspointtocopiedfiles false` - The shortcut is re-created to point to the original file/folder.
|
* `copiedshortcutspointtocopiedfiles false` - The shortcut is re-created to point to the original file/folder.
|
||||||
@ -444,7 +438,6 @@ gam <UserTypeEntity> move drivefile <DriveFileEntity> [newfilename <DriveFileNam
|
|||||||
[<DriveFileParentAttribute>]
|
[<DriveFileParentAttribute>]
|
||||||
[mergewithparent|mergewithparentretain [<Boolean>]]
|
[mergewithparent|mergewithparentretain [<Boolean>]]
|
||||||
[createshortcutsfornonmovablefiles [<Boolean>]]
|
[createshortcutsfornonmovablefiles [<Boolean>]]
|
||||||
[skipids <DriveFileEntity>]
|
|
||||||
[duplicatefiles overwriteolder|overwriteall|duplicatename|uniquename|skip]
|
[duplicatefiles overwriteolder|overwriteall|duplicatename|uniquename|skip]
|
||||||
[duplicatefolders merge|duplicatename|uniquename|skip]
|
[duplicatefolders merge|duplicatename|uniquename|skip]
|
||||||
[copymergewithparentfolderpermissions [<Boolean>]]
|
[copymergewithparentfolderpermissions [<Boolean>]]
|
||||||
@ -495,10 +488,6 @@ This is the default mode.
|
|||||||
* `teamdriveparent <SharedDriveName> teamdriveparentname <DriveFolderName>` - A Shared Drive name and a folder name on that Shared Drive.
|
* `teamdriveparent <SharedDriveName> teamdriveparentname <DriveFolderName>` - A Shared Drive name and a folder name on that Shared Drive.
|
||||||
* If none of the parent options are specified, the moved file/folder will be located in the source folder.
|
* If none of the parent options are specified, the moved file/folder will be located in the source folder.
|
||||||
|
|
||||||
### This option handles special cases where you want to prevent selected files/folders from being moved.
|
|
||||||
* `skipids <DriveFileEntity>` - Do not move files/folders with the specified IDs.
|
|
||||||
If any files/folders are skipped, GAM retains the top source folder and its sub folders while moving the sub files to the target folder.
|
|
||||||
|
|
||||||
### Duplicate files
|
### Duplicate files
|
||||||
When moving files, these options control the action GAM takes when a target file has the same name and MIME type as the source file:
|
When moving files, these options control the action GAM takes when a target file has the same name and MIME type as the source file:
|
||||||
* `duplicatefiles overwriteolder` - If the target file has an older `modifiedDate` than the source file, it will be deleted and replaced by the source file; otherwise no move will be made; this is the default action.
|
* `duplicatefiles overwriteolder` - If the target file has an older `modifiedDate` than the source file, it will be deleted and replaced by the source file; otherwise no move will be made; this is the default action.
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
* https://developers.google.com/drive/api/v3/shortcuts
|
* https://developers.google.com/drive/api/v3/shortcuts
|
||||||
* https://support.google.com/a/answer/6105699
|
* https://support.google.com/a/answer/6105699
|
||||||
* https://support.google.com/a/answer/7374057
|
* https://support.google.com/a/answer/7374057
|
||||||
* https://support.google.com/a/users/answer/7338880
|
|
||||||
* https://developers.google.com/docs/api/reference/rest
|
* https://developers.google.com/docs/api/reference/rest
|
||||||
|
|
||||||
## Definitions
|
## Definitions
|
||||||
|
@ -60,7 +60,6 @@ Use [Users - Drive - Transfer](Users-Drive-Transfer) for more complex ownership
|
|||||||
```
|
```
|
||||||
gam <UserTypeEntity> transfer ownership <DriveFileEntity> <UserItem>
|
gam <UserTypeEntity> transfer ownership <DriveFileEntity> <UserItem>
|
||||||
[<DriveFileParentAttribute>] [includetrashed] [norecursion [<Boolean>]]
|
[<DriveFileParentAttribute>] [includetrashed] [norecursion [<Boolean>]]
|
||||||
[skipids <DriveFileEntity>]
|
|
||||||
(orderby <DriveOrderByFieldName> [ascending|descending])*
|
(orderby <DriveOrderByFieldName> [ascending|descending])*
|
||||||
[preview] [filepath] [pathdelimiter <Character>] [buildtree] [todrive <ToDriveAttribute>*]
|
[preview] [filepath] [pathdelimiter <Character>] [buildtree] [todrive <ToDriveAttribute>*]
|
||||||
```
|
```
|
||||||
@ -73,9 +72,6 @@ By default, files in the trash are not transferred.
|
|||||||
By default, ownership transfer of a folder includes all of its sub files and folders.
|
By default, ownership transfer of a folder includes all of its sub files and folders.
|
||||||
* `norecursion` or `norecursion true` - No sub files and folders of the selected folder have their ownership transferred.
|
* `norecursion` or `norecursion true` - No sub files and folders of the selected folder have their ownership transferred.
|
||||||
|
|
||||||
This option handles special cases where you want to prevent selected files/folders ownership from being transferred.
|
|
||||||
* `skipids <DriveFileEntity>` - Do not transfer ownership for files/folders with the specified IDs.
|
|
||||||
|
|
||||||
Specify order of file processing.
|
Specify order of file processing.
|
||||||
* `(orderby <DriveOrderByFieldName> [ascending|descending])*`
|
* `(orderby <DriveOrderByFieldName> [ascending|descending])*`
|
||||||
|
|
||||||
@ -111,9 +107,9 @@ By default, files in the trash are not transferred.
|
|||||||
Specify order of file processing.
|
Specify order of file processing.
|
||||||
* `(orderby <DriveOrderByFieldName> [ascending|descending])*`
|
* `(orderby <DriveOrderByFieldName> [ascending|descending])*`
|
||||||
|
|
||||||
These options handle special cases where you want to prevent ownership from being transferred for selected files/folders.
|
These options handle special cases where you want to prevent ownership from being transferred for selected files.
|
||||||
* `skipids <DriveFileEntity>` - Do not transfer ownership for files/folders with the specified IDs.
|
* `skipids <DriveFileEntity>` - Do not transfer ownership for files with the specified IDs.
|
||||||
* `skipusers <UserTypeEntity>` - Do not transfer ownership for files/folders owned by the specified users.
|
* `skipusers <UserTypeEntity>` - Do not transfer ownership for files owned by the specified users.
|
||||||
|
|
||||||
By default, only files owned by users in the same domain as the claiming user have their ownership transferred.
|
By default, only files owned by users in the same domain as the claiming user have their ownership transferred.
|
||||||
* `subdomains <DomainNameEntity>` - Transfer ownership for files in the selected sub-domains.
|
* `subdomains <DomainNameEntity>` - Transfer ownership for files in the selected sub-domains.
|
||||||
|
@ -37,8 +37,8 @@ gam <UserTypeEntity> transfer drive <UserItem> [select <DriveFileEntity>]
|
|||||||
By default, all of the source users files will be transferred except those in the trash. If you want to transfer a subset of
|
By default, all of the source users files will be transferred except those in the trash. If you want to transfer a subset of
|
||||||
the source users files, use the `select <DriveFileEntity>` option.
|
the source users files, use the `select <DriveFileEntity>` option.
|
||||||
|
|
||||||
This option handles special cases where you want to prevent selected files/folders from being transferred.
|
This option handles special cases where you want to prevent selected files from being transferred.
|
||||||
* `skipids <DriveFileEntity>` - Do not transfer files/folders with the specified IDs.
|
* `skipids <DriveFileEntity>` - Do not transfer files with the specified IDs.
|
||||||
|
|
||||||
You can specify the access that the source user retains to the files that it owns.
|
You can specify the access that the source user retains to the files that it owns.
|
||||||
If no option is specified, the source user retains no access to the transferred files.
|
If no option is specified, the source user retains no access to the transferred files.
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
* https://developers.google.com/drive/v3/web/manage-teamdrives#managing_team_drives_for_domain_administrators
|
* https://developers.google.com/drive/v3/web/manage-teamdrives#managing_team_drives_for_domain_administrators
|
||||||
* https://support.google.com/a/answer/7374057
|
* https://support.google.com/a/answer/7374057
|
||||||
* https://workspaceupdates.googleblog.com/2022/05/shared-drives-in-organizational-units-open-beta.html
|
* https://workspaceupdates.googleblog.com/2022/05/shared-drives-in-organizational-units-open-beta.html
|
||||||
* https://support.google.com/a/users/answer/7338880
|
|
||||||
|
|
||||||
## Query documentation
|
## Query documentation
|
||||||
* https://developers.google.com/drive/api/v3/search-shareddrives
|
* https://developers.google.com/drive/api/v3/search-shareddrives
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
Print the current version of Gam with details
|
Print the current version of Gam with details
|
||||||
```
|
```
|
||||||
gam version
|
gam version
|
||||||
GAMADV-XTD3 6.67.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.67.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
MacOS Monterey 12.7 x86_64
|
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
|
Print the current version of Gam with details and time offset information
|
||||||
```
|
```
|
||||||
gam version timeoffset
|
gam version timeoffset
|
||||||
GAMADV-XTD3 6.67.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.67.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
MacOS Monterey 12.7 x86_64
|
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
|
Print the current version of Gam with extended details and SSL information
|
||||||
```
|
```
|
||||||
gam version extended
|
gam version extended
|
||||||
GAMADV-XTD3 6.67.02 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
GAMADV-XTD3 6.67.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
MacOS Monterey 12.7 x86_64
|
MacOS Monterey 12.7 x86_64
|
||||||
@ -65,7 +65,7 @@ MacOS High Sierra 10.13.6 x86_64
|
|||||||
Path: /Users/Admin/bin/gamadv-xtd3
|
Path: /Users/Admin/bin/gamadv-xtd3
|
||||||
Version Check:
|
Version Check:
|
||||||
Current: 5.35.08
|
Current: 5.35.08
|
||||||
Latest: 6.67.02
|
Latest: 6.67.01
|
||||||
echo $?
|
echo $?
|
||||||
1
|
1
|
||||||
```
|
```
|
||||||
@ -73,7 +73,7 @@ echo $?
|
|||||||
Print the current version number without details
|
Print the current version number without details
|
||||||
```
|
```
|
||||||
gam version simple
|
gam version simple
|
||||||
6.67.02
|
6.67.01
|
||||||
```
|
```
|
||||||
In Linux/MacOS you can do:
|
In Linux/MacOS you can do:
|
||||||
```
|
```
|
||||||
@ -83,7 +83,7 @@ echo $VER
|
|||||||
Print the current version of Gam and address of this Wiki
|
Print the current version of Gam and address of this Wiki
|
||||||
```
|
```
|
||||||
gam help
|
gam help
|
||||||
GAM 6.67.02 - https://github.com/taers232c/GAMADV-XTD3
|
GAM 6.67.01 - https://github.com/taers232c/GAMADV-XTD3
|
||||||
Ross Scroggs <ross.scroggs@gmail.com>
|
Ross Scroggs <ross.scroggs@gmail.com>
|
||||||
Python 3.12.0 64-bit final
|
Python 3.12.0 64-bit final
|
||||||
MacOS Monterey 12.7 x86_64
|
MacOS Monterey 12.7 x86_64
|
||||||
|
@ -6011,13 +6011,12 @@ gam <UserTypeEntity> copy drivefile <DriveFileEntity>
|
|||||||
[summary [<Boolean>]] [showpermissionmessages [<Boolean>]]
|
[summary [<Boolean>]] [showpermissionmessages [<Boolean>]]
|
||||||
[<DriveFileParentAttribute>]
|
[<DriveFileParentAttribute>]
|
||||||
[mergewithparent [<Boolean>]] [recursive [depth <Number>]]
|
[mergewithparent [<Boolean>]] [recursive [depth <Number>]]
|
||||||
<DriveFileCopyAttribute>*
|
|
||||||
[skipids <DriveFileEntity>]
|
|
||||||
[copysubfiles [<Boolean>]] [filenamematchpattern <RegularExpression>]
|
[copysubfiles [<Boolean>]] [filenamematchpattern <RegularExpression>]
|
||||||
[filemimetype [not] <MimeTypeList>]
|
[filemimetype [not] <MimeTypeList>]
|
||||||
[copysubfilesownedby any|me|others]
|
[copysubfilesownedby any|me|others]
|
||||||
[copysubfolders [<Boolean>]] [foldernamematchpattern <RegularExpression>]
|
[copysubfolders [<Boolean>]] [foldernamematchpattern <RegularExpression>]
|
||||||
[copysubshortcuts [<Boolean>]] [shortcutnamematchpattern <RegularExpression>]
|
[copysubshortcuts [<Boolean>]] [shortcutnamematchpattern <RegularExpression>]
|
||||||
|
<DriveFileCopyAttribute>*
|
||||||
[duplicatefiles overwriteolder|overwriteall|duplicatename|uniquename|skip]
|
[duplicatefiles overwriteolder|overwriteall|duplicatename|uniquename|skip]
|
||||||
[duplicatefolders merge|duplicatename|uniquename|skip]
|
[duplicatefolders merge|duplicatename|uniquename|skip]
|
||||||
[copiedshortcutspointtocopiedfiles [<Boolean>]]
|
[copiedshortcutspointtocopiedfiles [<Boolean>]]
|
||||||
@ -6046,7 +6045,6 @@ gam <UserTypeEntity> move drivefile <DriveFileEntity> [newfilename <DriveFileNam
|
|||||||
[summary [<Boolean>]] [showpermissionmessages [<Boolean>]]
|
[summary [<Boolean>]] [showpermissionmessages [<Boolean>]]
|
||||||
[<DriveFileParentAttribute>]
|
[<DriveFileParentAttribute>]
|
||||||
[mergewithparent|mergewithparentretain [<Boolean>]]
|
[mergewithparent|mergewithparentretain [<Boolean>]]
|
||||||
[skipids <DriveFileEntity>]
|
|
||||||
[createshortcutsfornonmovablefiles [<Boolean>]]
|
[createshortcutsfornonmovablefiles [<Boolean>]]
|
||||||
[duplicatefiles overwriteolder|overwriteall|duplicatename|uniquename|skip]
|
[duplicatefiles overwriteolder|overwriteall|duplicatename|uniquename|skip]
|
||||||
[duplicatefolders merge|duplicatename|uniquename|skip]
|
[duplicatefolders merge|duplicatename|uniquename|skip]
|
||||||
@ -6258,7 +6256,6 @@ gam <UserTypeEntity> print filerevisions <DriveFileEntity> [todrive <ToDriveAttr
|
|||||||
|
|
||||||
gam <UserTypeEntity> transfer ownership <DriveFileEntity> <UserItem>
|
gam <UserTypeEntity> transfer ownership <DriveFileEntity> <UserItem>
|
||||||
[<DriveFileParentAttribute>] [includetrashed] [norecursion [<Boolean>]]
|
[<DriveFileParentAttribute>] [includetrashed] [norecursion [<Boolean>]]
|
||||||
[skipids <DriveFileEntity>]
|
|
||||||
(orderby <DriveFileOrderByFieldName> [ascending|descending])*
|
(orderby <DriveFileOrderByFieldName> [ascending|descending])*
|
||||||
[preview] [filepath] [pathdelimiter <Character>] [buildtree]
|
[preview] [filepath] [pathdelimiter <Character>] [buildtree]
|
||||||
[todrive <ToDriveAttribute>*]
|
[todrive <ToDriveAttribute>*]
|
||||||
|
@ -2,25 +2,6 @@
|
|||||||
|
|
||||||
Merged GAM-Team version
|
Merged GAM-Team version
|
||||||
|
|
||||||
6.67.02
|
|
||||||
|
|
||||||
Added option `skipids <DriveFileEntity>` to `gam <UserTypeEntity> transfer drive` that handles special cases
|
|
||||||
where you want to prevent ownership from being transferred for selected files/folders.
|
|
||||||
|
|
||||||
Added option `skipids <DriveFileEntity>` to `gam <UserTypeEntity> copy drivefile` that handles special cases
|
|
||||||
where you want to prevent selected files/folders from being copied.
|
|
||||||
|
|
||||||
Added option `skipids <DriveFileEntity>` to `gam <UserTypeEntity> move drivefile` that handles special cases
|
|
||||||
where you want to prevent selected files/folders from being moved.
|
|
||||||
|
|
||||||
Updated commands that create files/folders on Shared Drives to handle the following errors:
|
|
||||||
```
|
|
||||||
storageQuotaExceeded
|
|
||||||
teamDriveFileLimitExceeded
|
|
||||||
teamDriveHierarchyTooDeep
|
|
||||||
```
|
|
||||||
* See: https://support.google.com/a/users/answer/7338880#shared_drives_file_folder_limits
|
|
||||||
|
|
||||||
6.67.01
|
6.67.01
|
||||||
|
|
||||||
Fixed bug in `gam print vaultcounts` that caused a trap.
|
Fixed bug in `gam print vaultcounts` that caused a trap.
|
||||||
|
@ -8554,7 +8554,7 @@ class CSVPrintFile():
|
|||||||
bailOnInternalError=True,
|
bailOnInternalError=True,
|
||||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
||||||
GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR, GAPI.INTERNAL_ERROR, GAPI.STORAGE_QUOTA_EXCEEDED,
|
GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR, GAPI.INTERNAL_ERROR, GAPI.STORAGE_QUOTA_EXCEEDED,
|
||||||
GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP],
|
GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP],
|
||||||
body=body,
|
body=body,
|
||||||
media_body=googleapiclient.http.MediaIoBaseUpload(io.BytesIO(csvFile.getvalue().encode()), mimetype='text/csv', resumable=True),
|
media_body=googleapiclient.http.MediaIoBaseUpload(io.BytesIO(csvFile.getvalue().encode()), mimetype='text/csv', resumable=True),
|
||||||
fields=fields, supportsAllDrives=True)
|
fields=fields, supportsAllDrives=True)
|
||||||
@ -8633,8 +8633,7 @@ class CSVPrintFile():
|
|||||||
spreadsheetId=spreadsheetId, body=body)
|
spreadsheetId=spreadsheetId, body=body)
|
||||||
except (GAPI.notFound, GAPI.forbidden, GAPI.permissionDenied,
|
except (GAPI.notFound, GAPI.forbidden, GAPI.permissionDenied,
|
||||||
GAPI.internalError, GAPI.insufficientFilePermissions, GAPI.badRequest,
|
GAPI.internalError, GAPI.insufficientFilePermissions, GAPI.badRequest,
|
||||||
GAPI.invalid, GAPI.invalidArgument, GAPI.failedPrecondition,
|
GAPI.invalid, GAPI.invalidArgument, GAPI.failedPrecondition, GAPI.teamDriveHierarchyTooDeep) as e:
|
||||||
GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep) as e:
|
|
||||||
todriveCSVErrorExit([Ent.USER, user, Ent.SPREADSHEET, title], str(e))
|
todriveCSVErrorExit([Ent.USER, user, Ent.SPREADSHEET, title], str(e))
|
||||||
Act.Set(action)
|
Act.Set(action)
|
||||||
file_url = result['webViewLink']
|
file_url = result['webViewLink']
|
||||||
@ -44226,9 +44225,6 @@ class CourseAttributes():
|
|||||||
GAPI.invalid, GAPI.cannotCopyFile, GAPI.badRequest, GAPI.responsePreparationFailure, GAPI.fileNeverWritable, GAPI.fieldNotWritable,
|
GAPI.invalid, GAPI.cannotCopyFile, GAPI.badRequest, GAPI.responsePreparationFailure, GAPI.fileNeverWritable, GAPI.fieldNotWritable,
|
||||||
GAPI.teamDrivesSharingRestrictionNotAllowed, GAPI.rateLimitExceeded, GAPI.userRateLimitExceeded) as e:
|
GAPI.teamDrivesSharingRestrictionNotAllowed, GAPI.rateLimitExceeded, GAPI.userRateLimitExceeded) as e:
|
||||||
_copyMaterialsError(fileId, str(e))
|
_copyMaterialsError(fileId, str(e))
|
||||||
except (GAPI.storageQuotaExceeded, GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep) as e:
|
|
||||||
_copyMaterialsError(fileId, str(e))
|
|
||||||
break
|
|
||||||
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
||||||
_copyMaterialsError(fileId, str(e))
|
_copyMaterialsError(fileId, str(e))
|
||||||
break
|
break
|
||||||
@ -54487,8 +54483,8 @@ def createDriveFile(users):
|
|||||||
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.CANNOT_ADD_PARENT,
|
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.CANNOT_ADD_PARENT,
|
||||||
GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR, GAPI.INTERNAL_ERROR,
|
GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR, GAPI.INTERNAL_ERROR,
|
||||||
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
||||||
GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP,
|
GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP, GAPI.UPLOAD_TOO_LARGE,
|
||||||
GAPI.UPLOAD_TOO_LARGE, GAPI.TEAMDRIVES_SHORTCUT_FILE_NOT_SUPPORTED],
|
GAPI.TEAMDRIVES_SHORTCUT_FILE_NOT_SUPPORTED],
|
||||||
ocrLanguage=parameters[DFA_OCRLANGUAGE],
|
ocrLanguage=parameters[DFA_OCRLANGUAGE],
|
||||||
ignoreDefaultVisibility=parameters[DFA_IGNORE_DEFAULT_VISIBILITY],
|
ignoreDefaultVisibility=parameters[DFA_IGNORE_DEFAULT_VISIBILITY],
|
||||||
keepRevisionForever=parameters[DFA_KEEP_REVISION_FOREVER],
|
keepRevisionForever=parameters[DFA_KEEP_REVISION_FOREVER],
|
||||||
@ -54525,8 +54521,7 @@ def createDriveFile(users):
|
|||||||
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions,
|
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions,
|
||||||
GAPI.invalidQuery, GAPI.invalid, GAPI.badRequest, GAPI.cannotAddParent,
|
GAPI.invalidQuery, GAPI.invalid, GAPI.badRequest, GAPI.cannotAddParent,
|
||||||
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
||||||
GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep,
|
GAPI.teamDriveHierarchyTooDeep, GAPI.uploadTooLarge, GAPI.teamDrivesShortcutFileNotSupported) as e:
|
||||||
GAPI.uploadTooLarge, GAPI.teamDrivesShortcutFileNotSupported) as e:
|
|
||||||
entityActionFailedWarning([Ent.USER, user, entityType, body['name']], str(e), i, count)
|
entityActionFailedWarning([Ent.USER, user, entityType, body['name']], str(e), i, count)
|
||||||
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
||||||
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
||||||
@ -54642,15 +54637,14 @@ def createDriveFolderPath(users):
|
|||||||
op = 'Create Folder'
|
op = 'Create Folder'
|
||||||
result = callGAPI(drive.files(), 'create',
|
result = callGAPI(drive.files(), 'create',
|
||||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
||||||
GAPI.UNKNOWN_ERROR, GAPI.BAD_REQUEST,
|
GAPI.UNKNOWN_ERROR, GAPI.BAD_REQUEST, GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP],
|
||||||
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP],
|
|
||||||
body={'parents': [parentId], 'name': folderName, 'mimeType': MIMETYPE_GA_FOLDER}, fields='id,name', supportsAllDrives=True)
|
body={'parents': [parentId], 'name': folderName, 'mimeType': MIMETYPE_GA_FOLDER}, fields='id,name', supportsAllDrives=True)
|
||||||
parentId = result['id']
|
parentId = result['id']
|
||||||
parentName = result['name']
|
parentName = result['name']
|
||||||
createOnly = True
|
createOnly = True
|
||||||
Act.Set(Act.CREATE)
|
Act.Set(Act.CREATE)
|
||||||
except (GAPI.forbidden, GAPI.insufficientPermissions, GAPI.insufficientParentPermissions,
|
except (GAPI.forbidden, GAPI.insufficientPermissions, GAPI.insufficientParentPermissions,
|
||||||
GAPI.unknownError, GAPI.badRequest, GAPI.storageQuotaExceeded, GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep) as e:
|
GAPI.unknownError, GAPI.badRequest, GAPI.storageQuotaExceeded, GAPI.teamDriveHierarchyTooDeep) as e:
|
||||||
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FOLDER, folderName], f'{op}: {str(e)}', j, jcount)
|
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FOLDER, folderName], f'{op}: {str(e)}', j, jcount)
|
||||||
errors = True
|
errors = True
|
||||||
break
|
break
|
||||||
@ -54790,8 +54784,7 @@ def createDriveFileShortcut(users):
|
|||||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
||||||
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR,
|
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR,
|
||||||
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
||||||
GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP,
|
GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP, GAPI.SHORTCUT_TARGET_INVALID],
|
||||||
GAPI.SHORTCUT_TARGET_INVALID],
|
|
||||||
body=body, fields='id,name', supportsAllDrives=True)
|
body=body, fields='id,name', supportsAllDrives=True)
|
||||||
removeParents.append(parentId)
|
removeParents.append(parentId)
|
||||||
if returnIdOnly:
|
if returnIdOnly:
|
||||||
@ -54803,7 +54796,7 @@ def createDriveFileShortcut(users):
|
|||||||
csvPF.WriteRow({'User': user, 'name': result['name'], 'id': result['id'], 'targetName': targetName, 'targetId': fileId})
|
csvPF.WriteRow({'User': user, 'name': result['name'], 'id': result['id'], 'targetName': targetName, 'targetId': fileId})
|
||||||
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions, GAPI.invalid, GAPI.badRequest,
|
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions, GAPI.invalid, GAPI.badRequest,
|
||||||
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
||||||
GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep, GAPI.shortcutTargetInvalid) as e:
|
GAPI.teamDriveHierarchyTooDeep, GAPI.shortcutTargetInvalid) as e:
|
||||||
entityActionFailedWarning([Ent.USER, user, targetEntityType, targetName, Ent.DRIVE_FILE_SHORTCUT, body['name']], str(e), k, numNewParents)
|
entityActionFailedWarning([Ent.USER, user, targetEntityType, targetName, Ent.DRIVE_FILE_SHORTCUT, body['name']], str(e), k, numNewParents)
|
||||||
Ind.Decrement()
|
Ind.Decrement()
|
||||||
if convertParents and removeParents:
|
if convertParents and removeParents:
|
||||||
@ -55179,9 +55172,6 @@ def updateDriveFile(users):
|
|||||||
GAPI.teamDrivesSharingRestrictionNotAllowed, GAPI.rateLimitExceeded, GAPI.userRateLimitExceeded,
|
GAPI.teamDrivesSharingRestrictionNotAllowed, GAPI.rateLimitExceeded, GAPI.userRateLimitExceeded,
|
||||||
GAPI.cannotModifyViewersCanCopyContent) as e:
|
GAPI.cannotModifyViewersCanCopyContent) as e:
|
||||||
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE, fileId], str(e), j, jcount)
|
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE, fileId], str(e), j, jcount)
|
||||||
except (GAPI.storageQuotaExceeded, GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep,) as e:
|
|
||||||
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE, fileId], str(e), j, jcount)
|
|
||||||
break
|
|
||||||
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
||||||
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
||||||
break
|
break
|
||||||
@ -55203,16 +55193,15 @@ STAT_FILE_SHORTCUT_EXISTS = 12
|
|||||||
STAT_FILE_DUPLICATE = 13
|
STAT_FILE_DUPLICATE = 13
|
||||||
STAT_FILE_FAILED = 14
|
STAT_FILE_FAILED = 14
|
||||||
STAT_FILE_NOT_COPYABLE_MOVABLE = 15
|
STAT_FILE_NOT_COPYABLE_MOVABLE = 15
|
||||||
STAT_FILE_IN_SKIPIDS = 16
|
STAT_FILE_PERMISSIONS_FAILED = 16
|
||||||
STAT_FILE_PERMISSIONS_FAILED = 17
|
STAT_FILE_PROTECTEDRANGES_FAILED = 17
|
||||||
STAT_FILE_PROTECTEDRANGES_FAILED = 18
|
STAT_USER_NOT_ORGANIZER = 18
|
||||||
STAT_USER_NOT_ORGANIZER = 19
|
STAT_LENGTH = 19
|
||||||
STAT_LENGTH = 20
|
|
||||||
|
|
||||||
FOLDER_SUBTOTAL_STATS = [STAT_FOLDER_COPIED_MOVED, STAT_FOLDER_SHORTCUT_CREATED, STAT_FOLDER_SHORTCUT_EXISTS,
|
FOLDER_SUBTOTAL_STATS = [STAT_FOLDER_COPIED_MOVED, STAT_FOLDER_SHORTCUT_CREATED, STAT_FOLDER_SHORTCUT_EXISTS,
|
||||||
STAT_FOLDER_DUPLICATE, STAT_FOLDER_MERGED, STAT_FOLDER_FAILED, STAT_FOLDER_NOT_WRITABLE]
|
STAT_FOLDER_DUPLICATE, STAT_FOLDER_MERGED, STAT_FOLDER_FAILED, STAT_FOLDER_NOT_WRITABLE]
|
||||||
FILE_SUBTOTAL_STATS = [STAT_FILE_COPIED_MOVED, STAT_FILE_SHORTCUT_CREATED, STAT_FILE_SHORTCUT_EXISTS,
|
FILE_SUBTOTAL_STATS = [STAT_FILE_COPIED_MOVED, STAT_FILE_SHORTCUT_CREATED, STAT_FILE_SHORTCUT_EXISTS,
|
||||||
STAT_FILE_DUPLICATE, STAT_FILE_FAILED, STAT_FILE_NOT_COPYABLE_MOVABLE, STAT_FILE_IN_SKIPIDS]
|
STAT_FILE_DUPLICATE, STAT_FILE_FAILED, STAT_FILE_NOT_COPYABLE_MOVABLE]
|
||||||
|
|
||||||
def _initStatistics():
|
def _initStatistics():
|
||||||
return [0] * STAT_LENGTH
|
return [0] * STAT_LENGTH
|
||||||
@ -55262,7 +55251,6 @@ def _printStatistics(user, statistics, i, count, copy):
|
|||||||
statistics[STAT_FILE_DUPLICATE],
|
statistics[STAT_FILE_DUPLICATE],
|
||||||
statistics[STAT_FILE_FAILED],
|
statistics[STAT_FILE_FAILED],
|
||||||
statistics[STAT_FILE_NOT_COPYABLE_MOVABLE],
|
statistics[STAT_FILE_NOT_COPYABLE_MOVABLE],
|
||||||
statistics[STAT_FILE_IN_SKIPIDS],
|
|
||||||
statistics[STAT_FILE_PERMISSIONS_FAILED],
|
statistics[STAT_FILE_PERMISSIONS_FAILED],
|
||||||
statistics[STAT_FILE_PROTECTEDRANGES_FAILED])],
|
statistics[STAT_FILE_PROTECTEDRANGES_FAILED])],
|
||||||
i, count)
|
i, count)
|
||||||
@ -56002,7 +55990,6 @@ copyReturnItemMap = {
|
|||||||
# [<DriveFileParentAttribute>]
|
# [<DriveFileParentAttribute>]
|
||||||
# [mergewithparent [<Boolean>]] [recursive [depth <Number>]]
|
# [mergewithparent [<Boolean>]] [recursive [depth <Number>]]
|
||||||
# <DriveFileCopyAttribute>*
|
# <DriveFileCopyAttribute>*
|
||||||
# [skipids <DriveFileEntity>]
|
|
||||||
# [copysubfiles [<Boolean>]] [filenamematchpattern <RegularExpression>] [filemimetype [not] <MimeTypeList>]
|
# [copysubfiles [<Boolean>]] [filenamematchpattern <RegularExpression>] [filemimetype [not] <MimeTypeList>]
|
||||||
# [copysubfolders [<Boolean>]] [foldernamematchpattern <RegularExpression>]
|
# [copysubfolders [<Boolean>]] [foldernamematchpattern <RegularExpression>]
|
||||||
# [copysubshortcuts [<Boolean>]] [shortcutnamematchpattern <RegularExpression>]
|
# [copysubshortcuts [<Boolean>]] [shortcutnamematchpattern <RegularExpression>]
|
||||||
@ -56124,8 +56111,7 @@ def copyDriveFile(users):
|
|||||||
try:
|
try:
|
||||||
result = callGAPI(drive.files(), 'create',
|
result = callGAPI(drive.files(), 'create',
|
||||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
||||||
GAPI.INTERNAL_ERROR, GAPI.STORAGE_QUOTA_EXCEEDED,
|
GAPI.INTERNAL_ERROR, GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP, GAPI.BAD_REQUEST],
|
||||||
GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP, GAPI.BAD_REQUEST],
|
|
||||||
body=body, fields='id,webViewLink,modifiedTime', supportsAllDrives=True)
|
body=body, fields='id,webViewLink,modifiedTime', supportsAllDrives=True)
|
||||||
newFolderId = result['id']
|
newFolderId = result['id']
|
||||||
if returnIdLink:
|
if returnIdLink:
|
||||||
@ -56146,8 +56132,8 @@ def copyDriveFile(users):
|
|||||||
['copySubFolderNonInheritedPermissions', 'copyTopFolderNonInheritedPermissions'][atTop],
|
['copySubFolderNonInheritedPermissions', 'copyTopFolderNonInheritedPermissions'][atTop],
|
||||||
True)
|
True)
|
||||||
return (newFolderId, newFolderName, False)
|
return (newFolderId, newFolderName, False)
|
||||||
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions, GAPI.internalError,
|
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions,
|
||||||
GAPI.storageQuotaExceeded, GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep, GAPI.badRequest) as e:
|
GAPI.internalError, GAPI.storageQuotaExceeded, GAPI.teamDriveHierarchyTooDeep, GAPI.badRequest) as e:
|
||||||
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FOLDER, newFolderName], str(e), j, jcount)
|
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FOLDER, newFolderName], str(e), j, jcount)
|
||||||
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
||||||
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
||||||
@ -56183,7 +56169,7 @@ def copyDriveFile(users):
|
|||||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
||||||
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR,
|
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR,
|
||||||
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
||||||
GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP, GAPI.SHORTCUT_TARGET_INVALID],
|
GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP, GAPI.SHORTCUT_TARGET_INVALID],
|
||||||
body=body, fields='id', supportsAllDrives=True)
|
body=body, fields='id', supportsAllDrives=True)
|
||||||
Act.Set(Act.CREATE_SHORTCUT)
|
Act.Set(Act.CREATE_SHORTCUT)
|
||||||
entityModifierItemValueListActionPerformed(kvList, Act.MODIFIER_IN,
|
entityModifierItemValueListActionPerformed(kvList, Act.MODIFIER_IN,
|
||||||
@ -56194,7 +56180,7 @@ def copyDriveFile(users):
|
|||||||
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions,
|
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions,
|
||||||
GAPI.invalid, GAPI.badRequest, GAPI.fileNotFound, GAPI.unknownError,
|
GAPI.invalid, GAPI.badRequest, GAPI.fileNotFound, GAPI.unknownError,
|
||||||
GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
||||||
GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep, GAPI.shortcutTargetInvalid) as e:
|
GAPI.teamDriveHierarchyTooDeep, GAPI.shortcutTargetInvalid) as e:
|
||||||
entityActionFailedWarning(kvList+[Ent.DRIVE_FILE_SHORTCUT, childName], str(e), k, kcount)
|
entityActionFailedWarning(kvList+[Ent.DRIVE_FILE_SHORTCUT, childName], str(e), k, kcount)
|
||||||
_incrStatistic(statistics, STAT_FILE_FAILED)
|
_incrStatistic(statistics, STAT_FILE_FAILED)
|
||||||
|
|
||||||
@ -56270,11 +56256,6 @@ def copyDriveFile(users):
|
|||||||
if childId in copiedTargetFiles: # Don't recopy file/folder copied into a sub-folder
|
if childId in copiedTargetFiles: # Don't recopy file/folder copied into a sub-folder
|
||||||
continue
|
continue
|
||||||
kvList = [Ent.USER, user, _getEntityMimeType(child), childNameId]
|
kvList = [Ent.USER, user, _getEntityMimeType(child), childNameId]
|
||||||
if childId in skipFileIdEntity['list']:
|
|
||||||
if not suppressNotSelectedMessages:
|
|
||||||
entityActionNotPerformedWarning(kvList, Msg.IN_SKIPIDS, k, kcount)
|
|
||||||
_incrStatistic(statistics, STAT_FILE_IN_SKIPIDS)
|
|
||||||
continue
|
|
||||||
if not _checkChildCopyAllowed(childMimeType, childName, child):
|
if not _checkChildCopyAllowed(childMimeType, childName, child):
|
||||||
if not suppressNotSelectedMessages:
|
if not suppressNotSelectedMessages:
|
||||||
entityActionNotPerformedWarning(kvList, Msg.NOT_SELECTED, k, kcount)
|
entityActionNotPerformedWarning(kvList, Msg.NOT_SELECTED, k, kcount)
|
||||||
@ -56367,10 +56348,6 @@ def copyDriveFile(users):
|
|||||||
GAPI.internalError, GAPI.teamDrivesShortcutFileNotSupported) as e:
|
GAPI.internalError, GAPI.teamDrivesShortcutFileNotSupported) as e:
|
||||||
entityActionFailedWarning(kvList, str(e), k, kcount)
|
entityActionFailedWarning(kvList, str(e), k, kcount)
|
||||||
_incrStatistic(statistics, STAT_FILE_FAILED)
|
_incrStatistic(statistics, STAT_FILE_FAILED)
|
||||||
except (GAPI.storageQuotaExceeded, GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep) as e:
|
|
||||||
entityActionFailedWarning(kvList, str(e), k, kcount)
|
|
||||||
_incrStatistic(statistics, STAT_FILE_FAILED)
|
|
||||||
break
|
|
||||||
Ind.Decrement()
|
Ind.Decrement()
|
||||||
|
|
||||||
fileIdEntity = getDriveFileEntity()
|
fileIdEntity = getDriveFileEntity()
|
||||||
@ -56385,7 +56362,6 @@ def copyDriveFile(users):
|
|||||||
excludeTrashed = newParentsSpecified = recursive = suppressNotSelectedMessages = False
|
excludeTrashed = newParentsSpecified = recursive = suppressNotSelectedMessages = False
|
||||||
maxdepth = -1
|
maxdepth = -1
|
||||||
verifyOrganizer = True
|
verifyOrganizer = True
|
||||||
skipFileIdEntity = initDriveFileEntity()
|
|
||||||
while Cmd.ArgumentsRemaining():
|
while Cmd.ArgumentsRemaining():
|
||||||
myarg = getArgument()
|
myarg = getArgument()
|
||||||
if getCopyMoveOptions(myarg, copyMoveOptions):
|
if getCopyMoveOptions(myarg, copyMoveOptions):
|
||||||
@ -56400,8 +56376,6 @@ def copyDriveFile(users):
|
|||||||
recursive = getBoolean()
|
recursive = getBoolean()
|
||||||
elif myarg == 'depth':
|
elif myarg == 'depth':
|
||||||
maxdepth = getInteger(minVal=-1)
|
maxdepth = getInteger(minVal=-1)
|
||||||
elif myarg == 'skipids':
|
|
||||||
skipFileIdEntity = getDriveFileEntity()
|
|
||||||
elif myarg == 'convert':
|
elif myarg == 'convert':
|
||||||
deprecatedArgument(myarg)
|
deprecatedArgument(myarg)
|
||||||
elif myarg == 'csv':
|
elif myarg == 'csv':
|
||||||
@ -56428,7 +56402,6 @@ def copyDriveFile(users):
|
|||||||
i, count, users = getEntityArgument(users)
|
i, count, users = getEntityArgument(users)
|
||||||
for user in users:
|
for user in users:
|
||||||
i += 1
|
i += 1
|
||||||
origUser = user
|
|
||||||
user, drive, jcount = _validateUserGetFileIDs(user, i, count, fileIdEntity,
|
user, drive, jcount = _validateUserGetFileIDs(user, i, count, fileIdEntity,
|
||||||
entityType=Ent.DRIVE_FILE_OR_FOLDER if returnIdLink is None else None)
|
entityType=Ent.DRIVE_FILE_OR_FOLDER if returnIdLink is None else None)
|
||||||
if jcount == 0:
|
if jcount == 0:
|
||||||
@ -56444,8 +56417,6 @@ def copyDriveFile(users):
|
|||||||
copiedTargetFiles = set()
|
copiedTargetFiles = set()
|
||||||
shortcutsToCreate = []
|
shortcutsToCreate = []
|
||||||
statistics = _initStatistics()
|
statistics = _initStatistics()
|
||||||
if skipFileIdEntity['query'] or skipFileIdEntity[ROOT]:
|
|
||||||
_validateUserGetFileIDs(origUser, i, count, skipFileIdEntity, drive=drive)
|
|
||||||
Ind.Increment()
|
Ind.Increment()
|
||||||
j = 0
|
j = 0
|
||||||
for fileId in fileIdEntity['list']:
|
for fileId in fileIdEntity['list']:
|
||||||
@ -56457,21 +56428,17 @@ def copyDriveFile(users):
|
|||||||
fields='id,name,parents,appProperties,capabilities,contentHints,copyRequiresWriterPermission,'\
|
fields='id,name,parents,appProperties,capabilities,contentHints,copyRequiresWriterPermission,'\
|
||||||
'description,mimeType,modifiedTime,properties,starred,driveId,trashed,viewedByMeTime,writersCanShare',
|
'description,mimeType,modifiedTime,properties,starred,driveId,trashed,viewedByMeTime,writersCanShare',
|
||||||
supportsAllDrives=True)
|
supportsAllDrives=True)
|
||||||
# Source at root of Shared Drive?
|
# Source at root of My Drive or Shared Drive?
|
||||||
sourceMimeType = source['mimeType']
|
sourceMimeType = source['mimeType']
|
||||||
if sourceMimeType == MIMETYPE_GA_FOLDER and source.get('driveId') and source['name'] == TEAM_DRIVE and not source.get('parents', []):
|
if sourceMimeType == MIMETYPE_GA_FOLDER and source.get('driveId') and source['name'] == TEAM_DRIVE and not source.get('parents', []):
|
||||||
source['name'] = _getSharedDriveNameFromId(drive, source['driveId'])
|
source['name'] = _getSharedDriveNameFromId(drive, source['driveId'])
|
||||||
sourceName = source['name']
|
sourceName = source['name']
|
||||||
sourceNameId = f"{sourceName}({source['id']})"
|
sourceNameId = f"{sourceName}({source['id']})"
|
||||||
copyMoveOptions['sourceDriveId'] = source.get('driveId')
|
copyMoveOptions['sourceDriveId'] = source.get('driveId')
|
||||||
kvList = [Ent.USER, user, _getEntityMimeType(source), sourceNameId]
|
|
||||||
if fileId in skipFileIdEntity['list']:
|
|
||||||
entityActionNotPerformedWarning(kvList, Msg.IN_SKIPIDS, j, jcount)
|
|
||||||
_incrStatistic(statistics, STAT_FILE_IN_SKIPIDS)
|
|
||||||
continue
|
|
||||||
trashed = source.pop('trashed', False)
|
trashed = source.pop('trashed', False)
|
||||||
if excludeTrashed and trashed:
|
if excludeTrashed and trashed:
|
||||||
entityActionNotPerformedWarning(kvList, Msg.IN_TRASH_AND_EXCLUDE_TRASHED, j, jcount)
|
entityActionNotPerformedWarning([Ent.USER, user, _getEntityMimeType(source), sourceNameId],
|
||||||
|
Msg.IN_TRASH_AND_EXCLUDE_TRASHED, j, jcount)
|
||||||
_incrStatistic(statistics, STAT_FILE_NOT_COPYABLE_MOVABLE)
|
_incrStatistic(statistics, STAT_FILE_NOT_COPYABLE_MOVABLE)
|
||||||
continue
|
continue
|
||||||
if copyMoveOptions['sourceDriveId']:
|
if copyMoveOptions['sourceDriveId']:
|
||||||
@ -56487,7 +56454,8 @@ def copyDriveFile(users):
|
|||||||
newParents = parentBody['parents']
|
newParents = parentBody['parents']
|
||||||
numNewParents = len(newParents)
|
numNewParents = len(newParents)
|
||||||
if numNewParents > 1:
|
if numNewParents > 1:
|
||||||
entityActionNotPerformedWarning(kvList, Msg.MULTIPLE_PARENTS_SPECIFIED.format(numNewParents), j, jcount)
|
entityActionNotPerformedWarning([Ent.USER, user, _getEntityMimeType(source), sourceNameId],
|
||||||
|
Msg.MULTIPLE_PARENTS_SPECIFIED.format(numNewParents), j, jcount)
|
||||||
_incrStatistic(statistics, STAT_FILE_FAILED)
|
_incrStatistic(statistics, STAT_FILE_FAILED)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
@ -56532,6 +56500,7 @@ def copyDriveFile(users):
|
|||||||
continue
|
continue
|
||||||
# Copy folder
|
# Copy folder
|
||||||
if sourceMimeType == MIMETYPE_GA_FOLDER:
|
if sourceMimeType == MIMETYPE_GA_FOLDER:
|
||||||
|
kvList = [Ent.USER, user, Ent.DRIVE_FOLDER, sourceNameId]
|
||||||
copiedTargetFiles.add(newParentId) # Don't recopy folder copied into a sub-folder
|
copiedTargetFiles.add(newParentId) # Don't recopy folder copied into a sub-folder
|
||||||
if fileId == newParentId:
|
if fileId == newParentId:
|
||||||
entityActionNotPerformedWarning(kvList, Msg.NOT_COPYABLE_INTO_ITSELF, j, jcount)
|
entityActionNotPerformedWarning(kvList, Msg.NOT_COPYABLE_INTO_ITSELF, j, jcount)
|
||||||
@ -56576,6 +56545,7 @@ def copyDriveFile(users):
|
|||||||
statistics, copyMoveOptions, True)
|
statistics, copyMoveOptions, True)
|
||||||
# Copy file
|
# Copy file
|
||||||
else:
|
else:
|
||||||
|
kvList = [Ent.USER, user, Ent.DRIVE_FILE, sourceNameId]
|
||||||
if not source.pop('capabilities')['canCopy']:
|
if not source.pop('capabilities')['canCopy']:
|
||||||
entityActionFailedWarning(kvList, Msg.NOT_COPYABLE, j, jcount)
|
entityActionFailedWarning(kvList, Msg.NOT_COPYABLE, j, jcount)
|
||||||
_incrStatistic(statistics, STAT_FILE_NOT_COPYABLE_MOVABLE)
|
_incrStatistic(statistics, STAT_FILE_NOT_COPYABLE_MOVABLE)
|
||||||
@ -56636,8 +56606,7 @@ def copyDriveFile(users):
|
|||||||
except (GAPI.fileNotFound, GAPI.forbidden, GAPI.internalError, GAPI.insufficientFilePermissions,
|
except (GAPI.fileNotFound, GAPI.forbidden, GAPI.internalError, GAPI.insufficientFilePermissions,
|
||||||
GAPI.insufficientParentPermissions, GAPI.unknownError,
|
GAPI.insufficientParentPermissions, GAPI.unknownError,
|
||||||
GAPI.invalid, GAPI.badRequest, GAPI.cannotCopyFile, GAPI.responsePreparationFailure, GAPI.fileNeverWritable, GAPI.fieldNotWritable,
|
GAPI.invalid, GAPI.badRequest, GAPI.cannotCopyFile, GAPI.responsePreparationFailure, GAPI.fileNeverWritable, GAPI.fieldNotWritable,
|
||||||
GAPI.teamDrivesSharingRestrictionNotAllowed, GAPI.rateLimitExceeded, GAPI.userRateLimitExceeded,
|
GAPI.teamDrivesSharingRestrictionNotAllowed, GAPI.rateLimitExceeded, GAPI.userRateLimitExceeded) as e:
|
||||||
GAPI.storageQuotaExceeded, GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep) as e:
|
|
||||||
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE_OR_FOLDER_ID, fileId], str(e), j, jcount)
|
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE_OR_FOLDER_ID, fileId], str(e), j, jcount)
|
||||||
_incrStatistic(statistics, STAT_FILE_FAILED)
|
_incrStatistic(statistics, STAT_FILE_FAILED)
|
||||||
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
||||||
@ -56819,7 +56788,6 @@ def _updateMoveFilePermissions(drive, user, i, count,
|
|||||||
# [summary [<Boolean>]] [showpermissionsmessages [<Boolean>]]
|
# [summary [<Boolean>]] [showpermissionsmessages [<Boolean>]]
|
||||||
# [<DriveFileParentAttribute>]
|
# [<DriveFileParentAttribute>]
|
||||||
# [mergewithparent|mergewithparentretain [<Boolean>]]
|
# [mergewithparent|mergewithparentretain [<Boolean>]]
|
||||||
# [skipids <DriveFileEntity>]
|
|
||||||
# [createshortcutsfornonmovablefiles [<Boolean>]]
|
# [createshortcutsfornonmovablefiles [<Boolean>]]
|
||||||
# [duplicatefiles overwriteolder|overwriteall|duplicatename|uniquename|skip]
|
# [duplicatefiles overwriteolder|overwriteall|duplicatename|uniquename|skip]
|
||||||
# [duplicatefolders merge|duplicatename|uniquename|skip]
|
# [duplicatefolders merge|duplicatename|uniquename|skip]
|
||||||
@ -56967,8 +56935,7 @@ def moveDriveFile(users):
|
|||||||
try:
|
try:
|
||||||
result = callGAPI(drive.files(), 'create',
|
result = callGAPI(drive.files(), 'create',
|
||||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
||||||
GAPI.INTERNAL_ERROR, GAPI.STORAGE_QUOTA_EXCEEDED,
|
GAPI.INTERNAL_ERROR, GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP,
|
||||||
GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP,
|
|
||||||
GAPI.BAD_REQUEST, GAPI.TARGET_USER_ROLE_LIMITED_BY_LICENSE_RESTRICTION],
|
GAPI.BAD_REQUEST, GAPI.TARGET_USER_ROLE_LIMITED_BY_LICENSE_RESTRICTION],
|
||||||
body=body, fields='id', supportsAllDrives=True)
|
body=body, fields='id', supportsAllDrives=True)
|
||||||
newFolderId = result['id']
|
newFolderId = result['id']
|
||||||
@ -56989,7 +56956,7 @@ def moveDriveFile(users):
|
|||||||
True)
|
True)
|
||||||
return (newFolderId, newFolderName, False)
|
return (newFolderId, newFolderName, False)
|
||||||
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions,
|
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions,
|
||||||
GAPI.internalError, GAPI.storageQuotaExceeded, GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep,
|
GAPI.internalError, GAPI.storageQuotaExceeded, GAPI.teamDriveHierarchyTooDeep,
|
||||||
GAPI.badRequest, GAPI.targetUserRoleLimitedByLicenseRestriction) as e:
|
GAPI.badRequest, GAPI.targetUserRoleLimitedByLicenseRestriction) as e:
|
||||||
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FOLDER, newFolderName], str(e), j, jcount)
|
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FOLDER, newFolderName], str(e), j, jcount)
|
||||||
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
||||||
@ -57026,7 +56993,7 @@ def moveDriveFile(users):
|
|||||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
||||||
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR,
|
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR,
|
||||||
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
||||||
GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP, GAPI.SHORTCUT_TARGET_INVALID,
|
GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP, GAPI.SHORTCUT_TARGET_INVALID,
|
||||||
GAPI.TARGET_USER_ROLE_LIMITED_BY_LICENSE_RESTRICTION],
|
GAPI.TARGET_USER_ROLE_LIMITED_BY_LICENSE_RESTRICTION],
|
||||||
body=body, fields='id', supportsAllDrives=True)
|
body=body, fields='id', supportsAllDrives=True)
|
||||||
Act.Set(Act.CREATE_SHORTCUT)
|
Act.Set(Act.CREATE_SHORTCUT)
|
||||||
@ -57038,8 +57005,7 @@ def moveDriveFile(users):
|
|||||||
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions,
|
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions,
|
||||||
GAPI.invalid, GAPI.badRequest, GAPI.fileNotFound, GAPI.unknownError,
|
GAPI.invalid, GAPI.badRequest, GAPI.fileNotFound, GAPI.unknownError,
|
||||||
GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
||||||
GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep, GAPI.shortcutTargetInvalid,
|
GAPI.teamDriveHierarchyTooDeep, GAPI.shortcutTargetInvalid, GAPI.targetUserRoleLimitedByLicenseRestriction) as e:
|
||||||
GAPI.targetUserRoleLimitedByLicenseRestriction) as e:
|
|
||||||
entityActionFailedWarning(kvList+[Ent.DRIVE_FILE_SHORTCUT, childName], str(e), k, kcount)
|
entityActionFailedWarning(kvList+[Ent.DRIVE_FILE_SHORTCUT, childName], str(e), k, kcount)
|
||||||
_incrStatistic(statistics, STAT_FILE_FAILED)
|
_incrStatistic(statistics, STAT_FILE_FAILED)
|
||||||
|
|
||||||
@ -57126,11 +57092,6 @@ def moveDriveFile(users):
|
|||||||
if movedFiles.get(childId):
|
if movedFiles.get(childId):
|
||||||
continue
|
continue
|
||||||
kvList = [Ent.USER, user, _getEntityMimeType(child), childNameId]
|
kvList = [Ent.USER, user, _getEntityMimeType(child), childNameId]
|
||||||
if childId in skipFileIdEntity['list']:
|
|
||||||
entityActionNotPerformedWarning(kvList, Msg.IN_SKIPIDS, k, kcount)
|
|
||||||
_incrStatistic(statistics, STAT_FILE_IN_SKIPIDS)
|
|
||||||
copyMoveOptions['retainSourceFolders'] = True
|
|
||||||
continue
|
|
||||||
trashed = child.pop('trashed', False)
|
trashed = child.pop('trashed', False)
|
||||||
if (childId == newFolderId) or (copyMoveOptions['destDriveId'] and trashed):
|
if (childId == newFolderId) or (copyMoveOptions['destDriveId'] and trashed):
|
||||||
entityActionNotPerformedWarning(kvList,
|
entityActionNotPerformedWarning(kvList,
|
||||||
@ -57190,7 +57151,6 @@ def moveDriveFile(users):
|
|||||||
movedFiles = {}
|
movedFiles = {}
|
||||||
updateFilePermissions = False
|
updateFilePermissions = False
|
||||||
verifyOrganizer = True
|
verifyOrganizer = True
|
||||||
skipFileIdEntity = initDriveFileEntity()
|
|
||||||
while Cmd.ArgumentsRemaining():
|
while Cmd.ArgumentsRemaining():
|
||||||
myarg = getArgument()
|
myarg = getArgument()
|
||||||
if getCopyMoveOptions(myarg, copyMoveOptions):
|
if getCopyMoveOptions(myarg, copyMoveOptions):
|
||||||
@ -57201,22 +57161,17 @@ def moveDriveFile(users):
|
|||||||
updateFilePermissions = getBoolean()
|
updateFilePermissions = getBoolean()
|
||||||
elif myarg == 'verifyorganizer':
|
elif myarg == 'verifyorganizer':
|
||||||
verifyOrganizer = getBoolean()
|
verifyOrganizer = getBoolean()
|
||||||
elif myarg == 'skipids':
|
|
||||||
skipFileIdEntity = getDriveFileEntity()
|
|
||||||
else:
|
else:
|
||||||
unknownArgumentExit()
|
unknownArgumentExit()
|
||||||
i, count, users = getEntityArgument(users)
|
i, count, users = getEntityArgument(users)
|
||||||
for user in users:
|
for user in users:
|
||||||
i += 1
|
i += 1
|
||||||
origUser = user
|
|
||||||
user, drive, jcount = _validateUserGetFileIDs(user, i, count, fileIdEntity, entityType=Ent.DRIVE_FILE_OR_FOLDER)
|
user, drive, jcount = _validateUserGetFileIDs(user, i, count, fileIdEntity, entityType=Ent.DRIVE_FILE_OR_FOLDER)
|
||||||
if jcount == 0:
|
if jcount == 0:
|
||||||
continue
|
continue
|
||||||
if not _getDriveFileParentInfo(drive, user, i, count, parentBody, parentParms):
|
if not _getDriveFileParentInfo(drive, user, i, count, parentBody, parentParms):
|
||||||
continue
|
continue
|
||||||
statistics = _initStatistics()
|
statistics = _initStatistics()
|
||||||
if skipFileIdEntity['query'] or skipFileIdEntity[ROOT]:
|
|
||||||
_validateUserGetFileIDs(origUser, i, count, skipFileIdEntity, drive=drive)
|
|
||||||
Ind.Increment()
|
Ind.Increment()
|
||||||
j = 0
|
j = 0
|
||||||
for fileId in fileIdEntity['list']:
|
for fileId in fileIdEntity['list']:
|
||||||
@ -57228,7 +57183,6 @@ def moveDriveFile(users):
|
|||||||
fields='id,name,parents,appProperties,capabilities,contentHints,copyRequiresWriterPermission,'\
|
fields='id,name,parents,appProperties,capabilities,contentHints,copyRequiresWriterPermission,'\
|
||||||
'description,mimeType,modifiedTime,properties,starred,driveId,trashed,viewedByMeTime,writersCanShare',
|
'description,mimeType,modifiedTime,properties,starred,driveId,trashed,viewedByMeTime,writersCanShare',
|
||||||
supportsAllDrives=True)
|
supportsAllDrives=True)
|
||||||
# Source at root of My Drive or Shared Drive?
|
|
||||||
sourceMimeType = source['mimeType']
|
sourceMimeType = source['mimeType']
|
||||||
if sourceMimeType == MIMETYPE_GA_FOLDER and source['name'] in [MY_DRIVE, TEAM_DRIVE] and not source.get('parents', []):
|
if sourceMimeType == MIMETYPE_GA_FOLDER and source['name'] in [MY_DRIVE, TEAM_DRIVE] and not source.get('parents', []):
|
||||||
copyMoveOptions['sourceIsMyDriveSharedDrive'] = True
|
copyMoveOptions['sourceIsMyDriveSharedDrive'] = True
|
||||||
@ -57237,19 +57191,14 @@ def moveDriveFile(users):
|
|||||||
sourceName = source['name']
|
sourceName = source['name']
|
||||||
sourceNameId = f"{sourceName}({source['id']})"
|
sourceNameId = f"{sourceName}({source['id']})"
|
||||||
copyMoveOptions['sourceDriveId'] = source.get('driveId')
|
copyMoveOptions['sourceDriveId'] = source.get('driveId')
|
||||||
kvList = [Ent.USER, user, _getEntityMimeType(source), sourceNameId]
|
|
||||||
if source['id'] in skipFileIdEntity['list']:
|
|
||||||
entityActionNotPerformedWarning(kvList, Msg.IN_SKIPIDS, j, jcount)
|
|
||||||
_incrStatistic(statistics, STAT_FILE_IN_SKIPIDS)
|
|
||||||
copyMoveOptions['retainSourceFolders'] = True
|
|
||||||
continue
|
|
||||||
if copyMoveOptions['sourceDriveId']:
|
if copyMoveOptions['sourceDriveId']:
|
||||||
# If moving from a Shared Drive, user has to be an organizer
|
# If moving from a Shared Drive, user has to be an organizer
|
||||||
if verifyOrganizer and not _verifyUserIsOrganizer(drive, user, i, count, copyMoveOptions['sourceDriveId']):
|
if verifyOrganizer and not _verifyUserIsOrganizer(drive, user, i, count, copyMoveOptions['sourceDriveId']):
|
||||||
_incrStatistic(statistics, STAT_USER_NOT_ORGANIZER)
|
_incrStatistic(statistics, STAT_USER_NOT_ORGANIZER)
|
||||||
continue
|
continue
|
||||||
if source['trashed']:
|
if source['trashed']:
|
||||||
entityActionNotPerformedWarning(kvList, Msg.NOT_MOVABLE_IN_TRASH, j, jcount)
|
entityActionNotPerformedWarning([Ent.USER, user, _getEntityMimeType(source), sourceNameId],
|
||||||
|
Msg.NOT_MOVABLE_IN_TRASH, j, jcount)
|
||||||
_incrStatistic(statistics, STAT_FILE_NOT_COPYABLE_MOVABLE)
|
_incrStatistic(statistics, STAT_FILE_NOT_COPYABLE_MOVABLE)
|
||||||
continue
|
continue
|
||||||
sourceSearchArgs = {'driveId': copyMoveOptions['sourceDriveId'], 'corpora': 'drive', 'includeItemsFromAllDrives': True, 'supportsAllDrives': True}
|
sourceSearchArgs = {'driveId': copyMoveOptions['sourceDriveId'], 'corpora': 'drive', 'includeItemsFromAllDrives': True, 'supportsAllDrives': True}
|
||||||
@ -57260,7 +57209,8 @@ def moveDriveFile(users):
|
|||||||
newParents = parentBody['parents']
|
newParents = parentBody['parents']
|
||||||
numNewParents = len(newParents)
|
numNewParents = len(newParents)
|
||||||
if numNewParents > 1:
|
if numNewParents > 1:
|
||||||
entityActionNotPerformedWarning(kvList, Msg.MULTIPLE_PARENTS_SPECIFIED.format(numNewParents), j, jcount)
|
entityActionNotPerformedWarning([Ent.USER, user, _getEntityMimeType(source), sourceNameId],
|
||||||
|
Msg.MULTIPLE_PARENTS_SPECIFIED.format(numNewParents), j, jcount)
|
||||||
_incrStatistic(statistics, STAT_FILE_FAILED)
|
_incrStatistic(statistics, STAT_FILE_FAILED)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
@ -57298,6 +57248,7 @@ def moveDriveFile(users):
|
|||||||
continue
|
continue
|
||||||
# Move folder
|
# Move folder
|
||||||
if sourceMimeType == MIMETYPE_GA_FOLDER:
|
if sourceMimeType == MIMETYPE_GA_FOLDER:
|
||||||
|
kvList = [Ent.USER, user, Ent.DRIVE_FOLDER, sourceNameId]
|
||||||
if fileId == newParentId:
|
if fileId == newParentId:
|
||||||
entityActionNotPerformedWarning(kvList, Msg.NOT_MOVABLE_INTO_ITSELF, j, jcount)
|
entityActionNotPerformedWarning(kvList, Msg.NOT_MOVABLE_INTO_ITSELF, j, jcount)
|
||||||
_incrStatistic(statistics, STAT_FOLDER_FAILED)
|
_incrStatistic(statistics, STAT_FOLDER_FAILED)
|
||||||
@ -57329,7 +57280,7 @@ def moveDriveFile(users):
|
|||||||
# Move file
|
# Move file
|
||||||
else:
|
else:
|
||||||
if copyMoveOptions['duplicateFiles'] in [DUPLICATE_FILE_OVERWRITE_ALL, DUPLICATE_FILE_OVERWRITE_OLDER] and _identicalSourceTarget(fileId, targetChildren):
|
if copyMoveOptions['duplicateFiles'] in [DUPLICATE_FILE_OVERWRITE_ALL, DUPLICATE_FILE_OVERWRITE_OLDER] and _identicalSourceTarget(fileId, targetChildren):
|
||||||
entityActionNotPerformedWarning(kvList, Msg.NOT_MOVABLE_SAME_NAME_CURRENT_FOLDER_OVERWRITE, j, jcount)
|
entityActionNotPerformedWarning([Ent.USER, user, Ent.DRIVE_FILE, sourceNameId], Msg.NOT_MOVABLE_SAME_NAME_CURRENT_FOLDER_OVERWRITE, j, jcount)
|
||||||
_incrStatistic(statistics, STAT_FILE_FAILED)
|
_incrStatistic(statistics, STAT_FILE_FAILED)
|
||||||
continue
|
continue
|
||||||
if _checkForDuplicateTargetFile(drive, user, j, jcount, source, destName, targetChildren, copyMoveOptions, statistics):
|
if _checkForDuplicateTargetFile(drive, user, j, jcount, source, destName, targetChildren, copyMoveOptions, statistics):
|
||||||
@ -57890,11 +57841,10 @@ def collectOrphans(users):
|
|||||||
try:
|
try:
|
||||||
newParentId = callGAPI(drive.files(), 'create',
|
newParentId = callGAPI(drive.files(), 'create',
|
||||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
||||||
GAPI.UNKNOWN_ERROR, GAPI.STORAGE_QUOTA_EXCEEDED,
|
GAPI.UNKNOWN_ERROR, GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP],
|
||||||
GAPI. TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP],
|
|
||||||
body={'name': trgtUserFolderName, 'mimeType': MIMETYPE_GA_FOLDER}, fields='id')['id']
|
body={'name': trgtUserFolderName, 'mimeType': MIMETYPE_GA_FOLDER}, fields='id')['id']
|
||||||
except (GAPI.forbidden, GAPI.insufficientPermissions, GAPI.insufficientParentPermissions,
|
except (GAPI.forbidden, GAPI.insufficientPermissions, GAPI.insufficientParentPermissions,
|
||||||
GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep) as e:
|
GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDriveHierarchyTooDeep) as e:
|
||||||
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FOLDER, trgtUserFolderName], str(e), i, count)
|
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FOLDER, trgtUserFolderName], str(e), i, count)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
@ -57951,8 +57901,7 @@ def collectOrphans(users):
|
|||||||
result = callGAPI(drive.files(), 'create',
|
result = callGAPI(drive.files(), 'create',
|
||||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.INVALID_QUERY, GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.INVALID_QUERY, GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
||||||
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR,
|
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR,
|
||||||
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP,
|
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP, GAPI.SHORTCUT_TARGET_INVALID],
|
||||||
GAPI.SHORTCUT_TARGET_INVALID],
|
|
||||||
body=body, fields='id,name', supportsAllDrives=True)
|
body=body, fields='id,name', supportsAllDrives=True)
|
||||||
entityModifierNewValueItemValueListActionPerformed([Ent.USER, user, fileType, fileName, Ent.DRIVE_FILE_SHORTCUT, f'{result["name"]}({result["id"]})'],
|
entityModifierNewValueItemValueListActionPerformed([Ent.USER, user, fileType, fileName, Ent.DRIVE_FILE_SHORTCUT, f'{result["name"]}({result["id"]})'],
|
||||||
Act.MODIFIER_INTO, None, [Ent.DRIVE_FOLDER, trgtUserFolderName], j, jcount)
|
Act.MODIFIER_INTO, None, [Ent.DRIVE_FOLDER, trgtUserFolderName], j, jcount)
|
||||||
@ -57960,8 +57909,7 @@ def collectOrphans(users):
|
|||||||
except GAPI.invalidQuery:
|
except GAPI.invalidQuery:
|
||||||
entityActionFailedWarning([Ent.USER, user, fileType, fileName], invalidQuery(query), j, jcount)
|
entityActionFailedWarning([Ent.USER, user, fileType, fileName], invalidQuery(query), j, jcount)
|
||||||
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions, GAPI.invalid, GAPI.badRequest,
|
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions, GAPI.invalid, GAPI.badRequest,
|
||||||
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep,
|
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDriveHierarchyTooDeep, GAPI.shortcutTargetInvalid) as e:
|
||||||
GAPI.shortcutTargetInvalid) as e:
|
|
||||||
entityActionFailedWarning([Ent.USER, user, fileType, fileName, Ent.DRIVE_FILE_SHORTCUT, body['name']], str(e), j, jcount)
|
entityActionFailedWarning([Ent.USER, user, fileType, fileName, Ent.DRIVE_FILE_SHORTCUT, body['name']], str(e), j, jcount)
|
||||||
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
||||||
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
||||||
@ -58033,11 +57981,10 @@ def transferDrive(users):
|
|||||||
op = 'Create Target Folder'
|
op = 'Create Target Folder'
|
||||||
return callGAPI(targetDrive.files(), 'create',
|
return callGAPI(targetDrive.files(), 'create',
|
||||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
||||||
GAPI.UNKNOWN_ERROR, GAPI.BAD_REQUEST, GAPI.STORAGE_QUOTA_EXCEEDED,
|
GAPI.UNKNOWN_ERROR, GAPI.BAD_REQUEST, GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP],
|
||||||
GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP],
|
|
||||||
body={'parents': [folderParentId], 'name': folderName, 'mimeType': MIMETYPE_GA_FOLDER}, fields='id')['id']
|
body={'parents': [folderParentId], 'name': folderName, 'mimeType': MIMETYPE_GA_FOLDER}, fields='id')['id']
|
||||||
except (GAPI.forbidden, GAPI.insufficientPermissions, GAPI.insufficientParentPermissions, GAPI.unknownError, GAPI.badRequest,
|
except (GAPI.forbidden, GAPI.insufficientPermissions, GAPI.storageQuotaExceeded, GAPI.insufficientParentPermissions,
|
||||||
GAPI.storageQuotaExceeded, GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep) as e:
|
GAPI.unknownError, GAPI.badRequest, GAPI.teamDriveHierarchyTooDeep) as e:
|
||||||
entityActionFailedWarning([Ent.USER, targetUser, Ent.DRIVE_FOLDER, folderName], f'{op}: {str(e)}')
|
entityActionFailedWarning([Ent.USER, targetUser, Ent.DRIVE_FOLDER, folderName], f'{op}: {str(e)}')
|
||||||
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
||||||
userSvcNotApplicableOrDriveDisabled(targetUser, str(e))
|
userSvcNotApplicableOrDriveDisabled(targetUser, str(e))
|
||||||
@ -58090,7 +58037,7 @@ def transferDrive(users):
|
|||||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
||||||
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR,
|
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR,
|
||||||
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
||||||
GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP, GAPI.SHORTCUT_TARGET_INVALID],
|
GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP, GAPI.SHORTCUT_TARGET_INVALID],
|
||||||
body=body, fields='id', supportsAllDrives=True)
|
body=body, fields='id', supportsAllDrives=True)
|
||||||
Act.Set(Act.CREATE_SHORTCUT)
|
Act.Set(Act.CREATE_SHORTCUT)
|
||||||
entityModifierItemValueListActionPerformed(kvList, Act.MODIFIER_IN,
|
entityModifierItemValueListActionPerformed(kvList, Act.MODIFIER_IN,
|
||||||
@ -58098,7 +58045,7 @@ def transferDrive(users):
|
|||||||
j, jcount)
|
j, jcount)
|
||||||
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions, GAPI.invalid, GAPI.badRequest,
|
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions, GAPI.invalid, GAPI.badRequest,
|
||||||
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
||||||
GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep, GAPI.shortcutTargetInvalid) as e:
|
GAPI.teamDriveHierarchyTooDeep, GAPI.shortcutTargetInvalid) as e:
|
||||||
entityActionFailedWarning(kvList+[Ent.DRIVE_FILE_SHORTCUT, childName], str(e), j, jcount)
|
entityActionFailedWarning(kvList+[Ent.DRIVE_FILE_SHORTCUT, childName], str(e), j, jcount)
|
||||||
Act.Set(action)
|
Act.Set(action)
|
||||||
|
|
||||||
@ -58115,7 +58062,7 @@ def transferDrive(users):
|
|||||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
||||||
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR,
|
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR,
|
||||||
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
||||||
GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP, GAPI.SHORTCUT_TARGET_INVALID],
|
GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP, GAPI.SHORTCUT_TARGET_INVALID],
|
||||||
body=body, fields='id', supportsAllDrives=True)
|
body=body, fields='id', supportsAllDrives=True)
|
||||||
shortcutId = result['id']
|
shortcutId = result['id']
|
||||||
entityModifierNewValueItemValueListActionPerformed(kvList, Act.MODIFIER_IN, None, [Ent.USER, targetUser,
|
entityModifierNewValueItemValueListActionPerformed(kvList, Act.MODIFIER_IN, None, [Ent.USER, targetUser,
|
||||||
@ -58123,7 +58070,7 @@ def transferDrive(users):
|
|||||||
j, jcount)
|
j, jcount)
|
||||||
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions, GAPI.invalid, GAPI.badRequest,
|
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions, GAPI.invalid, GAPI.badRequest,
|
||||||
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
||||||
GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep, GAPI.shortcutTargetInvalid) as e:
|
GAPI.teamDriveHierarchyTooDeep, GAPI.shortcutTargetInvalid) as e:
|
||||||
entityActionFailedWarning(kvList+[Ent.DRIVE_FILE_SHORTCUT, childName], str(e), j, jcount)
|
entityActionFailedWarning(kvList+[Ent.DRIVE_FILE_SHORTCUT, childName], str(e), j, jcount)
|
||||||
Act.Set(action)
|
Act.Set(action)
|
||||||
return
|
return
|
||||||
@ -58312,11 +58259,11 @@ def transferDrive(users):
|
|||||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.FORBIDDEN, GAPI.INSUFFICIENT_PERMISSIONS, GAPI.INSUFFICIENT_PARENT_PERMISSIONS,
|
||||||
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR,
|
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR,
|
||||||
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
GAPI.STORAGE_QUOTA_EXCEEDED, GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
||||||
GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP],
|
GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP],
|
||||||
body=body, fields='', supportsAllDrives=True)
|
body=body, fields='', supportsAllDrives=True)
|
||||||
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions, GAPI.invalid, GAPI.badRequest,
|
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions, GAPI.invalid, GAPI.badRequest,
|
||||||
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded,
|
||||||
GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep) as e:
|
GAPI.teamDrivesSharingRestrictionNotAllowed, GAPI.teamDriveHierarchyTooDeep) as e:
|
||||||
entityActionFailedWarning([Ent.USER, targetUser, childFileType, childFileName, Ent.DRIVE_FILE_SHORTCUT, body['name']], str(e), j, jcount)
|
entityActionFailedWarning([Ent.USER, targetUser, childFileType, childFileName, Ent.DRIVE_FILE_SHORTCUT, body['name']], str(e), j, jcount)
|
||||||
return
|
return
|
||||||
# Delete existing parents
|
# Delete existing parents
|
||||||
@ -58704,7 +58651,6 @@ def transferDrive(users):
|
|||||||
i, count, users = getEntityArgument(users)
|
i, count, users = getEntityArgument(users)
|
||||||
for user in users:
|
for user in users:
|
||||||
i += 1
|
i += 1
|
||||||
origUser = user
|
|
||||||
if buildTree:
|
if buildTree:
|
||||||
sourceUser, sourceDrive = buildGAPIServiceObject(API.DRIVE3, user, i, count)
|
sourceUser, sourceDrive = buildGAPIServiceObject(API.DRIVE3, user, i, count)
|
||||||
if not sourceDrive:
|
if not sourceDrive:
|
||||||
@ -58737,8 +58683,6 @@ def transferDrive(users):
|
|||||||
if targetIds[TARGET_PARENT_ID] is None:
|
if targetIds[TARGET_PARENT_ID] is None:
|
||||||
return
|
return
|
||||||
Ind.Increment()
|
Ind.Increment()
|
||||||
if skipFileIdEntity['query'] or skipFileIdEntity[ROOT]:
|
|
||||||
_validateUserGetFileIDs(origUser, i, count, skipFileIdEntity, drive=sourceDrive)
|
|
||||||
if buildTree:
|
if buildTree:
|
||||||
topSourceId = sourceRootId
|
topSourceId = sourceRootId
|
||||||
parentIdMap = {sourceRootId: targetIds[TARGET_PARENT_ID]}
|
parentIdMap = {sourceRootId: targetIds[TARGET_PARENT_ID]}
|
||||||
@ -58838,14 +58782,12 @@ def getPermissionIdForEmail(user, i, count, email):
|
|||||||
|
|
||||||
# gam <UserTypeEntity> transfer ownership <DriveFileEntity> <UserItem>
|
# gam <UserTypeEntity> transfer ownership <DriveFileEntity> <UserItem>
|
||||||
# [<DriveFileParentAttribute>] [includetrashed] [norecursion [<Boolean>]]
|
# [<DriveFileParentAttribute>] [includetrashed] [norecursion [<Boolean>]]
|
||||||
# [skipids <DriveFileEntity>]
|
|
||||||
# (orderby <DriveFileOrderByFieldName> [ascending|descending])*
|
# (orderby <DriveFileOrderByFieldName> [ascending|descending])*
|
||||||
# [preview] [filepath] [pathdelimiter <Character>] [buildtree]
|
# [preview] [filepath] [pathdelimiter <Character>] [buildtree] [todrive <ToDriveAttribute>*]
|
||||||
# [todrive <ToDriveAttribute>*]
|
|
||||||
def transferOwnership(users):
|
def transferOwnership(users):
|
||||||
def _identifyFilesToTransfer(fileEntry):
|
def _identifyFilesToTransfer(fileEntry):
|
||||||
for childFileId in fileEntry['children']:
|
for childFileId in fileEntry['children']:
|
||||||
if childFileId in filesTransferred or childFileId in skipFileIdEntity['list']:
|
if childFileId in filesTransferred:
|
||||||
continue
|
continue
|
||||||
filesTransferred.add(childFileId)
|
filesTransferred.add(childFileId)
|
||||||
childEntry = fileTree.get(childFileId)
|
childEntry = fileTree.get(childFileId)
|
||||||
@ -58872,7 +58814,7 @@ def transferOwnership(users):
|
|||||||
childFileId = childEntryInfo['id']
|
childFileId = childEntryInfo['id']
|
||||||
if filepath:
|
if filepath:
|
||||||
fileTree[childFileId] = {'info': childEntryInfo}
|
fileTree[childFileId] = {'info': childEntryInfo}
|
||||||
if childFileId in filesTransferred or childFileId in skipFileIdEntity['list']:
|
if childFileId in filesTransferred:
|
||||||
continue
|
continue
|
||||||
filesTransferred.add(childFileId)
|
filesTransferred.add(childFileId)
|
||||||
if includeTrashed or not childEntryInfo['trashed']:
|
if includeTrashed or not childEntryInfo['trashed']:
|
||||||
@ -58892,7 +58834,6 @@ def transferOwnership(users):
|
|||||||
parentBody = {}
|
parentBody = {}
|
||||||
parentParms = initDriveFileAttributes()
|
parentParms = initDriveFileAttributes()
|
||||||
buildTree = False
|
buildTree = False
|
||||||
skipFileIdEntity = initDriveFileEntity()
|
|
||||||
while Cmd.ArgumentsRemaining():
|
while Cmd.ArgumentsRemaining():
|
||||||
myarg = getArgument()
|
myarg = getArgument()
|
||||||
if myarg == 'includetrashed':
|
if myarg == 'includetrashed':
|
||||||
@ -58907,8 +58848,6 @@ def transferOwnership(users):
|
|||||||
pathDelimiter = getCharacter()
|
pathDelimiter = getCharacter()
|
||||||
elif myarg == 'buildtree':
|
elif myarg == 'buildtree':
|
||||||
buildTree = True
|
buildTree = True
|
||||||
elif myarg == 'skipids':
|
|
||||||
skipFileIdEntity = getDriveFileEntity()
|
|
||||||
elif myarg == 'preview':
|
elif myarg == 'preview':
|
||||||
csvPF = CSVPrintFile(['OldOwner', 'NewOwner', 'type', 'id', 'name'])
|
csvPF = CSVPrintFile(['OldOwner', 'NewOwner', 'type', 'id', 'name'])
|
||||||
elif csvPF and myarg == 'todrive':
|
elif csvPF and myarg == 'todrive':
|
||||||
@ -58935,15 +58874,12 @@ def transferOwnership(users):
|
|||||||
i, count, users = getEntityArgument(users)
|
i, count, users = getEntityArgument(users)
|
||||||
for user in users:
|
for user in users:
|
||||||
i += 1
|
i += 1
|
||||||
origUser = user
|
|
||||||
user, drive, jcount = _validateUserGetFileIDs(user, i, count, fileIdEntity, entityType=Ent.DRIVE_FILE_OR_FOLDER)
|
user, drive, jcount = _validateUserGetFileIDs(user, i, count, fileIdEntity, entityType=Ent.DRIVE_FILE_OR_FOLDER)
|
||||||
if jcount == 0:
|
if jcount == 0:
|
||||||
continue
|
continue
|
||||||
if filepath:
|
if filepath:
|
||||||
filePathInfo = initFilePathInfo(pathDelimiter)
|
filePathInfo = initFilePathInfo(pathDelimiter)
|
||||||
filesTransferred = set()
|
filesTransferred = set()
|
||||||
if skipFileIdEntity['query'] or skipFileIdEntity[ROOT]:
|
|
||||||
_validateUserGetFileIDs(origUser, i, count, skipFileIdEntity, drive=drive)
|
|
||||||
if buildTree:
|
if buildTree:
|
||||||
printGettingAllEntityItemsForWhom(Ent.DRIVE_FILE_OR_FOLDER, user, i, count)
|
printGettingAllEntityItemsForWhom(Ent.DRIVE_FILE_OR_FOLDER, user, i, count)
|
||||||
try:
|
try:
|
||||||
@ -58965,11 +58901,10 @@ def transferOwnership(users):
|
|||||||
j = 0
|
j = 0
|
||||||
for fileId in fileIdEntity['list']:
|
for fileId in fileIdEntity['list']:
|
||||||
j += 1
|
j += 1
|
||||||
kvList = [Ent.USER, user, Ent.DRIVE_FILE_OR_FOLDER, fileId]
|
|
||||||
if buildTree:
|
if buildTree:
|
||||||
fileEntry = fileTree.get(fileId)
|
fileEntry = fileTree.get(fileId)
|
||||||
if not fileEntry:
|
if not fileEntry:
|
||||||
entityActionFailedWarning(kvList, Msg.NOT_FOUND, j, jcount)
|
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE_OR_FOLDER, fileId], Msg.NOT_FOUND, j, jcount)
|
||||||
continue
|
continue
|
||||||
fileEntryInfo = fileEntry['info']
|
fileEntryInfo = fileEntry['info']
|
||||||
else:
|
else:
|
||||||
@ -58978,7 +58913,7 @@ def transferOwnership(users):
|
|||||||
throwReasons=GAPI.DRIVE_GET_THROW_REASONS,
|
throwReasons=GAPI.DRIVE_GET_THROW_REASONS,
|
||||||
fileId=fileId, fields='id,name,parents,mimeType,ownedByMe,trashed')
|
fileId=fileId, fields='id,name,parents,mimeType,ownedByMe,trashed')
|
||||||
except GAPI.fileNotFound:
|
except GAPI.fileNotFound:
|
||||||
entityActionFailedWarning(kvList, Msg.NOT_FOUND, j, jcount)
|
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE_OR_FOLDER, fileId], Msg.NOT_FOUND, j, jcount)
|
||||||
continue
|
continue
|
||||||
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
||||||
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
||||||
@ -58986,10 +58921,6 @@ def transferOwnership(users):
|
|||||||
if filepath:
|
if filepath:
|
||||||
fileTree[fileId] = {'info': fileEntryInfo}
|
fileTree[fileId] = {'info': fileEntryInfo}
|
||||||
entityType = _getEntityMimeType(fileEntryInfo)
|
entityType = _getEntityMimeType(fileEntryInfo)
|
||||||
if fileId in skipFileIdEntity['list']:
|
|
||||||
entityActionNotPerformedWarning([Ent.USER, user, entityType, f'{fileEntryInfo["name"]} ({fileId})'],
|
|
||||||
Msg.IN_SKIPIDS, j, jcount)
|
|
||||||
continue
|
|
||||||
entityPerformActionItemValue([Ent.USER, user], entityType, f'{fileEntryInfo["name"]} ({fileId})', j, jcount)
|
entityPerformActionItemValue([Ent.USER, user], entityType, f'{fileEntryInfo["name"]} ({fileId})', j, jcount)
|
||||||
if fileId in filesTransferred:
|
if fileId in filesTransferred:
|
||||||
continue
|
continue
|
||||||
@ -59102,22 +59033,22 @@ def transferOwnership(users):
|
|||||||
|
|
||||||
# gam <UserTypeEntity> claim ownership <DriveFileEntity>
|
# gam <UserTypeEntity> claim ownership <DriveFileEntity>
|
||||||
# [<DriveFileParentAttribute>] [includetrashed]
|
# [<DriveFileParentAttribute>] [includetrashed]
|
||||||
|
# (orderby <DriveFileOrderByFieldName> [ascending|descending])*
|
||||||
# [skipids <DriveFileEntity>] [skipusers <UserTypeEntity>] [subdomains <DomainNameEntity>]
|
# [skipids <DriveFileEntity>] [skipusers <UserTypeEntity>] [subdomains <DomainNameEntity>]
|
||||||
# [restricted [<Boolean>]] [writerscanshare|writerscantshare [<Boolean>]]
|
# [restricted [<Boolean>]] [writerscanshare|writerscantshare [<Boolean>]]
|
||||||
# [keepuser | (retainrole reader|commenter|writer|editor|none)] [noretentionmessages]
|
# [keepuser | (retainrole reader|commenter|writer|editor|none)] [noretentionmessages]
|
||||||
# (orderby <DriveFileOrderByFieldName> [ascending|descending])*
|
|
||||||
# [preview] [filepath] [pathdelimiter <Character>] [buildtree]
|
# [preview] [filepath] [pathdelimiter <Character>] [buildtree]
|
||||||
# [todrive <ToDriveAttribute>*]
|
# [todrive <ToDriveAttribute>*]
|
||||||
def claimOwnership(users):
|
def claimOwnership(users):
|
||||||
def _identifyFilesToClaim(fileEntry):
|
def _identifyFilesToClaim(fileEntry):
|
||||||
for childFileId in fileEntry['children']:
|
for childFileId in fileEntry['children']:
|
||||||
if childFileId in filesTransferred or childFileId in skipFileIdEntity['list']:
|
if childFileId in filesTransferred:
|
||||||
continue
|
continue
|
||||||
filesTransferred.add(childFileId)
|
filesTransferred.add(childFileId)
|
||||||
childEntry = fileTree.get(childFileId)
|
childEntry = fileTree.get(childFileId)
|
||||||
if childEntry:
|
if childEntry:
|
||||||
childEntryInfo = childEntry['info']
|
childEntryInfo = childEntry['info']
|
||||||
if includeTrashed or not childEntryInfo['trashed']:
|
if childFileId not in skipFileIdEntity['list'] and (includeTrashed or not childEntryInfo['trashed']):
|
||||||
owner = childEntryInfo['owners'][0]['emailAddress']
|
owner = childEntryInfo['owners'][0]['emailAddress']
|
||||||
if not childEntryInfo['ownedByMe'] and owner not in skipusers:
|
if not childEntryInfo['ownedByMe'] and owner not in skipusers:
|
||||||
oldOwnerPermissionIds[owner] = childEntryInfo['owners'][0]['permissionId']
|
oldOwnerPermissionIds[owner] = childEntryInfo['owners'][0]['permissionId']
|
||||||
@ -59140,10 +59071,10 @@ def claimOwnership(users):
|
|||||||
return
|
return
|
||||||
for childEntryInfo in children:
|
for childEntryInfo in children:
|
||||||
childFileId = childEntryInfo['id']
|
childFileId = childEntryInfo['id']
|
||||||
if childFileId in filesTransferred or childFileId in skipFileIdEntity['list']:
|
if childFileId in filesTransferred:
|
||||||
continue
|
continue
|
||||||
filesTransferred.add(childFileId)
|
filesTransferred.add(childFileId)
|
||||||
if includeTrashed or not childEntryInfo['trashed']:
|
if childFileId not in skipFileIdEntity['list'] and (includeTrashed or not childEntryInfo['trashed']):
|
||||||
if filepath:
|
if filepath:
|
||||||
fileTree[childFileId] = {'info': childEntryInfo}
|
fileTree[childFileId] = {'info': childEntryInfo}
|
||||||
owner = childEntryInfo['owners'][0]['emailAddress']
|
owner = childEntryInfo['owners'][0]['emailAddress']
|
||||||
@ -59285,11 +59216,10 @@ def claimOwnership(users):
|
|||||||
for fileId in fileIdEntity['list']:
|
for fileId in fileIdEntity['list']:
|
||||||
j += 1
|
j += 1
|
||||||
filesToClaim = {}
|
filesToClaim = {}
|
||||||
kVlist = [Ent.USER, user, Ent.DRIVE_FILE_OR_FOLDER, fileId]
|
|
||||||
if buildTree:
|
if buildTree:
|
||||||
fileEntry = fileTree.get(fileId)
|
fileEntry = fileTree.get(fileId)
|
||||||
if not fileEntry:
|
if not fileEntry:
|
||||||
entityActionFailedWarning(kvList, Msg.NOT_FOUND, j, jcount)
|
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE_OR_FOLDER, fileId], Msg.NOT_FOUND, j, jcount)
|
||||||
continue
|
continue
|
||||||
fileEntryInfo = fileEntry['info']
|
fileEntryInfo = fileEntry['info']
|
||||||
else:
|
else:
|
||||||
@ -59299,7 +59229,7 @@ def claimOwnership(users):
|
|||||||
fileId=fileId,
|
fileId=fileId,
|
||||||
fields='id,name,parents,mimeType,ownedByMe,trashed,owners(emailAddress,permissionId)')
|
fields='id,name,parents,mimeType,ownedByMe,trashed,owners(emailAddress,permissionId)')
|
||||||
except GAPI.fileNotFound:
|
except GAPI.fileNotFound:
|
||||||
entityActionFailedWarning(kvList, Msg.NOT_FOUND, j, jcount)
|
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE_OR_FOLDER, fileId], Msg.NOT_FOUND, j, jcount)
|
||||||
continue
|
continue
|
||||||
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
||||||
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
||||||
@ -59307,10 +59237,6 @@ def claimOwnership(users):
|
|||||||
if filepath:
|
if filepath:
|
||||||
fileTree[fileId] = {'info': fileEntryInfo}
|
fileTree[fileId] = {'info': fileEntryInfo}
|
||||||
entityType = _getEntityMimeType(fileEntryInfo)
|
entityType = _getEntityMimeType(fileEntryInfo)
|
||||||
if fileId in skipFileIdEntity['list']:
|
|
||||||
entityActionNotPerformedWarning([Ent.USER, user, entityType, f'{fileEntryInfo["name"]} ({fileId})'],
|
|
||||||
Msg.IN_SKIPIDS, j, jcount)
|
|
||||||
continue
|
|
||||||
entityPerformActionItemValue([Ent.USER, user], entityType, f'{fileEntryInfo["name"]} ({fileId})', j, jcount)
|
entityPerformActionItemValue([Ent.USER, user], entityType, f'{fileEntryInfo["name"]} ({fileId})', j, jcount)
|
||||||
if fileId in filesTransferred:
|
if fileId in filesTransferred:
|
||||||
continue
|
continue
|
||||||
@ -67837,7 +67763,7 @@ def createForm(users):
|
|||||||
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.CANNOT_ADD_PARENT,
|
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.CANNOT_ADD_PARENT,
|
||||||
GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR, GAPI.STORAGE_QUOTA_EXCEEDED,
|
GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR, GAPI.STORAGE_QUOTA_EXCEEDED,
|
||||||
GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
||||||
GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP],
|
GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP],
|
||||||
body=body, fields='id,name', supportsAllDrives=True)
|
body=body, fields='id,name', supportsAllDrives=True)
|
||||||
formId = result['id']
|
formId = result['id']
|
||||||
form = callGAPI(gform.forms(), 'batchUpdate',
|
form = callGAPI(gform.forms(), 'batchUpdate',
|
||||||
@ -67855,8 +67781,8 @@ def createForm(users):
|
|||||||
'responderUri': form['form']['responderUri']})
|
'responderUri': form['form']['responderUri']})
|
||||||
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions,
|
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions,
|
||||||
GAPI.invalid, GAPI.badRequest, GAPI.cannotAddParent,
|
GAPI.invalid, GAPI.badRequest, GAPI.cannotAddParent,
|
||||||
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed, GAPI.teamDriveHierarchyTooDeep,
|
||||||
GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep, GAPI.invalidArgument) as e:
|
GAPI.invalidArgument) as e:
|
||||||
entityActionFailedWarning([Ent.USER, user, Ent.FORM, title, Ent.DRIVE_FILE, body['name']], str(e), i, count)
|
entityActionFailedWarning([Ent.USER, user, Ent.FORM, title, Ent.DRIVE_FILE, body['name']], str(e), i, count)
|
||||||
except GAPI.permissionDenied:
|
except GAPI.permissionDenied:
|
||||||
SvcAcctAPIDisabledExit()
|
SvcAcctAPIDisabledExit()
|
||||||
@ -69830,14 +69756,13 @@ def getNoteAttachments(users):
|
|||||||
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.CANNOT_ADD_PARENT,
|
GAPI.INVALID, GAPI.BAD_REQUEST, GAPI.CANNOT_ADD_PARENT,
|
||||||
GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR, GAPI.STORAGE_QUOTA_EXCEEDED,
|
GAPI.FILE_NOT_FOUND, GAPI.UNKNOWN_ERROR, GAPI.STORAGE_QUOTA_EXCEEDED,
|
||||||
GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
GAPI.TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
||||||
GAPI.TEAMDRIVE_FILE_LIMIT_EXCEEDED, GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP],
|
GAPI.TEAMDRIVE_HIERARCHY_TOO_DEEP],
|
||||||
media_body=media_body, body=body, fields='id,name', supportsAllDrives=True)
|
media_body=media_body, body=body, fields='id,name', supportsAllDrives=True)
|
||||||
entityModifierNewValueActionPerformed([Ent.USER, user, Ent.DRIVE_FILE, f'{result["name"]}({result["id"]})'],
|
entityModifierNewValueActionPerformed([Ent.USER, user, Ent.DRIVE_FILE, f'{result["name"]}({result["id"]})'],
|
||||||
Act.MODIFIER_WITH_CONTENT_FROM, localFilename, k, kcount)
|
Act.MODIFIER_WITH_CONTENT_FROM, localFilename, k, kcount)
|
||||||
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions,
|
except (GAPI.forbidden, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions,
|
||||||
GAPI.invalid, GAPI.badRequest, GAPI.cannotAddParent,
|
GAPI.invalid, GAPI.badRequest, GAPI.cannotAddParent,
|
||||||
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed,
|
GAPI.fileNotFound, GAPI.unknownError, GAPI.storageQuotaExceeded, GAPI.teamDrivesSharingRestrictionNotAllowed, GAPI.teamDriveHierarchyTooDeep) as e:
|
||||||
GAPI.teamDriveFileLimitExceeded, GAPI.teamDriveHierarchyTooDeep) as e:
|
|
||||||
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE, body['name']], str(e), k, kcount)
|
entityActionFailedWarning([Ent.USER, user, Ent.DRIVE_FILE, body['name']], str(e), k, kcount)
|
||||||
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
||||||
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
||||||
|
@ -155,7 +155,6 @@ TARGET_USER_ROLE_LIMITED_BY_LICENSE_RESTRICTION = 'targetUserRoleLimitedByLicens
|
|||||||
TEAMDRIVE_ALREADY_EXISTS = 'teamDriveAlreadyExists'
|
TEAMDRIVE_ALREADY_EXISTS = 'teamDriveAlreadyExists'
|
||||||
TEAMDRIVE_DOMAIN_USERS_ONLY_RESTRICTION = 'teamDriveDomainUsersOnlyRestriction'
|
TEAMDRIVE_DOMAIN_USERS_ONLY_RESTRICTION = 'teamDriveDomainUsersOnlyRestriction'
|
||||||
TEAMDRIVE_TEAM_MEMBERS_ONLY_RESTRICTION = 'teamDriveTeamMembersOnlyRestriction'
|
TEAMDRIVE_TEAM_MEMBERS_ONLY_RESTRICTION = 'teamDriveTeamMembersOnlyRestriction'
|
||||||
TEAMDRIVE_FILE_LIMIT_EXCEEDED = 'teamDriveFileLimitExceeded'
|
|
||||||
TEAMDRIVE_HIERARCHY_TOO_DEEP = 'teamDriveHierarchyTooDeep'
|
TEAMDRIVE_HIERARCHY_TOO_DEEP = 'teamDriveHierarchyTooDeep'
|
||||||
TEAMDRIVE_MEMBERSHIP_REQUIRED = 'teamDriveMembershipRequired'
|
TEAMDRIVE_MEMBERSHIP_REQUIRED = 'teamDriveMembershipRequired'
|
||||||
TEAMDRIVES_FOLDER_MOVE_IN_NOT_SUPPORTED = 'teamDrivesFolderMoveInNotSupported'
|
TEAMDRIVES_FOLDER_MOVE_IN_NOT_SUPPORTED = 'teamDrivesFolderMoveInNotSupported'
|
||||||
@ -200,8 +199,7 @@ COURSE_ACCESS_THROW_REASONS = [NOT_FOUND, INSUFFICIENT_PERMISSIONS, PERMISSION_D
|
|||||||
DRIVE_USER_THROW_REASONS = [SERVICE_NOT_AVAILABLE, AUTH_ERROR, DOMAIN_POLICY]
|
DRIVE_USER_THROW_REASONS = [SERVICE_NOT_AVAILABLE, AUTH_ERROR, DOMAIN_POLICY]
|
||||||
DRIVE_ACCESS_THROW_REASONS = DRIVE_USER_THROW_REASONS+[FILE_NOT_FOUND, FORBIDDEN, INTERNAL_ERROR, INSUFFICIENT_FILE_PERMISSIONS, UNKNOWN_ERROR, INVALID]
|
DRIVE_ACCESS_THROW_REASONS = DRIVE_USER_THROW_REASONS+[FILE_NOT_FOUND, FORBIDDEN, INTERNAL_ERROR, INSUFFICIENT_FILE_PERMISSIONS, UNKNOWN_ERROR, INVALID]
|
||||||
DRIVE_COPY_THROW_REASONS = DRIVE_ACCESS_THROW_REASONS+[CANNOT_COPY_FILE, BAD_REQUEST, RESPONSE_PREPARATION_FAILURE, TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
DRIVE_COPY_THROW_REASONS = DRIVE_ACCESS_THROW_REASONS+[CANNOT_COPY_FILE, BAD_REQUEST, RESPONSE_PREPARATION_FAILURE, TEAMDRIVES_SHARING_RESTRICTION_NOT_ALLOWED,
|
||||||
FIELD_NOT_WRITABLE, RATE_LIMIT_EXCEEDED, USER_RATE_LIMIT_EXCEEDED,
|
FIELD_NOT_WRITABLE, RATE_LIMIT_EXCEEDED, USER_RATE_LIMIT_EXCEEDED]
|
||||||
STORAGE_QUOTA_EXCEEDED, TEAMDRIVE_FILE_LIMIT_EXCEEDED, TEAMDRIVE_HIERARCHY_TOO_DEEP]
|
|
||||||
DRIVE_GET_THROW_REASONS = DRIVE_USER_THROW_REASONS+[FILE_NOT_FOUND]
|
DRIVE_GET_THROW_REASONS = DRIVE_USER_THROW_REASONS+[FILE_NOT_FOUND]
|
||||||
DRIVE3_CREATE_ACL_THROW_REASONS = [BAD_REQUEST, INVALID, INVALID_SHARING_REQUEST, OWNERSHIP_CHANGE_ACROSS_DOMAIN_NOT_PERMITTED, CANNOT_SET_EXPIRATION,
|
DRIVE3_CREATE_ACL_THROW_REASONS = [BAD_REQUEST, INVALID, INVALID_SHARING_REQUEST, OWNERSHIP_CHANGE_ACROSS_DOMAIN_NOT_PERMITTED, CANNOT_SET_EXPIRATION,
|
||||||
NOT_FOUND, TEAMDRIVE_DOMAIN_USERS_ONLY_RESTRICTION, TEAMDRIVE_TEAM_MEMBERS_ONLY_RESTRICTION,
|
NOT_FOUND, TEAMDRIVE_DOMAIN_USERS_ONLY_RESTRICTION, TEAMDRIVE_TEAM_MEMBERS_ONLY_RESTRICTION,
|
||||||
@ -600,8 +598,6 @@ class teamDriveDomainUsersOnlyRestriction(Exception):
|
|||||||
pass
|
pass
|
||||||
class teamDriveTeamMembersOnlyRestriction(Exception):
|
class teamDriveTeamMembersOnlyRestriction(Exception):
|
||||||
pass
|
pass
|
||||||
class teamDriveFileLimitExceeded(Exception):
|
|
||||||
pass
|
|
||||||
class teamDriveHierarchyTooDeep(Exception):
|
class teamDriveHierarchyTooDeep(Exception):
|
||||||
pass
|
pass
|
||||||
class teamDriveMembershipRequired(Exception):
|
class teamDriveMembershipRequired(Exception):
|
||||||
@ -770,7 +766,6 @@ REASON_EXCEPTION_MAP = {
|
|||||||
TEAMDRIVE_ALREADY_EXISTS: teamDriveAlreadyExists,
|
TEAMDRIVE_ALREADY_EXISTS: teamDriveAlreadyExists,
|
||||||
TEAMDRIVE_DOMAIN_USERS_ONLY_RESTRICTION: teamDriveDomainUsersOnlyRestriction,
|
TEAMDRIVE_DOMAIN_USERS_ONLY_RESTRICTION: teamDriveDomainUsersOnlyRestriction,
|
||||||
TEAMDRIVE_TEAM_MEMBERS_ONLY_RESTRICTION: teamDriveTeamMembersOnlyRestriction,
|
TEAMDRIVE_TEAM_MEMBERS_ONLY_RESTRICTION: teamDriveTeamMembersOnlyRestriction,
|
||||||
TEAMDRIVE_FILE_LIMIT_EXCEEDED: teamDriveFileLimitExceeded,
|
|
||||||
TEAMDRIVE_HIERARCHY_TOO_DEEP: teamDriveHierarchyTooDeep,
|
TEAMDRIVE_HIERARCHY_TOO_DEEP: teamDriveHierarchyTooDeep,
|
||||||
TEAMDRIVE_MEMBERSHIP_REQUIRED: teamDriveMembershipRequired,
|
TEAMDRIVE_MEMBERSHIP_REQUIRED: teamDriveMembershipRequired,
|
||||||
TEAMDRIVES_FOLDER_MOVE_IN_NOT_SUPPORTED: teamDrivesFolderMoveInNotSupported,
|
TEAMDRIVES_FOLDER_MOVE_IN_NOT_SUPPORTED: teamDrivesFolderMoveInNotSupported,
|
||||||
|
@ -431,7 +431,7 @@ SELECTED = 'Selected'
|
|||||||
SERVICE_NOT_APPLICABLE = 'Service not applicable/Does not exist'
|
SERVICE_NOT_APPLICABLE = 'Service not applicable/Does not exist'
|
||||||
SERVICE_NOT_APPLICABLE_THIS_ADDRESS = 'Service not applicable for this address: {0}'
|
SERVICE_NOT_APPLICABLE_THIS_ADDRESS = 'Service not applicable for this address: {0}'
|
||||||
STARTING_THREAD = 'Starting thread'
|
STARTING_THREAD = 'Starting thread'
|
||||||
STATISTICS_COPY_FILE = 'Total: {0}, Copied: {1}, Shortcut created {2}, Shortcut exists {3}, Duplicate: {4}, Copy Failed: {5}, Not copyable: {6}, In skipids: {7}, Permissions Failed: {8}, Protected Ranges Failed: {9}'
|
STATISTICS_COPY_FILE = 'Total: {0}, Copied: {1}, Shortcut created {2}, Shortcut exists {3}, Duplicate: {4}, Copy Failed: {5}, Not copyable: {6}, Permissions Failed: {7}, Protected Ranges Failed: {8}'
|
||||||
STATISTICS_COPY_FOLDER = 'Total: {0}, Copied: {1}, Shortcut created {2}, Shortcut exists {3}, Duplicate: {4}, Merged: {5}, Copy Failed: {6}, Not writable: {7}, Permissions Failed: {8}'
|
STATISTICS_COPY_FOLDER = 'Total: {0}, Copied: {1}, Shortcut created {2}, Shortcut exists {3}, Duplicate: {4}, Merged: {5}, Copy Failed: {6}, Not writable: {7}, Permissions Failed: {8}'
|
||||||
STATISTICS_MOVE_FILE = 'Total: {0}, Moved: {1}, Shortcut created {2}, Shortcut exists {3}, Duplicate: {4}, Move Failed: {5}, Not movable: {6}'
|
STATISTICS_MOVE_FILE = 'Total: {0}, Moved: {1}, Shortcut created {2}, Shortcut exists {3}, Duplicate: {4}, Move Failed: {5}, Not movable: {6}'
|
||||||
STATISTICS_MOVE_FOLDER = 'Total: {0}, Moved: {1}, Shortcut created {2}, Shortcut exists {3}, Duplicate: {4}, Merged: {5}, Move Failed: {6}, Not writable: {7}'
|
STATISTICS_MOVE_FOLDER = 'Total: {0}, Moved: {1}, Shortcut created {2}, Shortcut exists {3}, Duplicate: {4}, Merged: {5}, Move Failed: {6}, Not writable: {7}'
|
||||||
|
Reference in New Issue
Block a user