Added option copyfolderpermissions [<Boolean>] to gam <UserTypeEntity> copy|move drivefile

This commit is contained in:
Ross Scroggs
2026-02-20 13:54:14 -08:00
parent 3b9a9ba224
commit b9a489251b
4 changed files with 51 additions and 8 deletions

View File

@@ -6907,6 +6907,7 @@ gam <UserTypeEntity> copy drivefile <DriveFileEntity>
[copyfilepermissions [<Boolean>]]
[copyfileinheritedpermissions [<Boolean>]
[copyfilenoninheritedpermissions [<Boolean>]
[copyfolderpermissions [<Boolean>]]
[copymergewithparentfolderpermissions [<Boolean>]]
[copymergedtopfolderpermissions [<Boolean>]]
[copytopfolderpermissions [<Boolean>]]
@@ -6936,6 +6937,7 @@ gam <UserTypeEntity> move drivefile <DriveFileEntity> [newfilename <DriveFileNam
[createshortcutsfornonmovablefiles [<Boolean>]]
[duplicatefiles overwriteolder|overwriteall|duplicatename|uniquename|skip]
[duplicatefolders merge|duplicatename|uniquename|skip]
[copyfolderpermissions [<Boolean>]]
[copymergewithparentfolderpermissions [<Boolean>]]
[copymergedtopfolderpermissions [<Boolean>]]
[copytopfolderpermissions [<Boolean>]]

View File

@@ -1,3 +1,23 @@
7.34.06
Added option `copyfolderpermissions [<Boolean>]` to `gam <UserTypeEntity> copy|move drivefile`.
When `copyfolderpermissions false` is specified, no folder permissions are copied; this simplifies
disabling all folder permission copying.
When not specified or `copyfolderpermissions [true]` is specified, folder permissions are copied based on the following options:
```
copymergewithparentfolderpermissions [<Boolean>]
copymergedtopfolderpermissions [<Boolean>]
copytopfolderpermissions [<Boolean>]
copytopfolderiheritedpermissions [<Boolean>]
copytopfoldernoniheritedpermissions never|always|syncallfolders|syncupdatedfolders
copymergedsubfolderpermissions [<Boolean>]
copysubfolderpermissions [<Boolean>]
copysubfolderinheritedpermissions [<Boolean>]
copysubfoldernoniheritedpermissions never|always|syncallfolders|syncupdatedfolders
```
7.34.05
Updated `gam report <ActivityApplictionName>` to perform a reverse chronological sort

View File

@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
"""
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
__version__ = '7.34.05'
__version__ = '7.34.06'
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
# pylint: disable=wrong-import-position
@@ -37831,7 +37831,7 @@ def doCreateUpdateCIPolicy():
updateCmd = Act.Get() == Act.UPDATE
groupEmail = orgUnit = None
checkArgumentPresent('json', True)
jsonData = getJSON(['type'])
jsonData = getJSON(['customer', 'type'])
if updateCmd:
pname = jsonData.pop('name', None)
else:
@@ -62065,6 +62065,7 @@ def initCopyMoveOptions(copyCmd):
'copyFilePermissions': False,
'copyFileInheritedPermissions': True,
'copyFileNonInheritedPermissions': COPY_NONINHERITED_PERMISSIONS_ALWAYS,
'copyFolderPermissions': True,
'copyMergeWithParentFolderPermissions': False,
'copyMergedTopFolderPermissions': copyCmd,
'copyMergedSubFolderPermissions': copyCmd,
@@ -62142,6 +62143,8 @@ def getCopyMoveOptions(myarg, copyMoveOptions):
copyMoveOptions['duplicateFiles'] = getChoice(DUPLICATE_FILE_CHOICES, mapChoice=True)
elif myarg == 'duplicatefolders':
copyMoveOptions['duplicateFolders'] = getChoice(DUPLICATE_FOLDER_CHOICES, mapChoice=True)
elif myarg == 'copyfolderpermissions':
copyMoveOptions['copyFolderPermissions'] = getBoolean()
elif myarg == 'copymergewithparentfolderpermissions':
copyMoveOptions['copyMergeWithParentFolderPermissions'] = getBoolean()
elif myarg == 'copymergedtopfolderpermissions':
@@ -62820,6 +62823,7 @@ copyReturnItemMap = {
# [copyfilepermissions [<Boolean>]]
# [copyfileinheritedpermissions [<Boolean>]
# [copyfilenoninheritedpermissions [<Boolean>]
# [copyfolderpermissions [<Boolean>]]
# [copymergewithparentfolderpermissions [<Boolean>]]
# [copymergedtopfolderpermissions [<Boolean>]]
# [copytopfolderpermissions [<Boolean>]]
@@ -62867,7 +62871,8 @@ def copyDriveFile(users):
_writeCSVData(user, folderName, folderId, newParentName, newParentId, MIMETYPE_GA_FOLDER)
Act.Set(action)
_incrStatistic(statistics, STAT_FOLDER_MERGED)
if (copyMoveOptions['copyMergeWithParentFolderPermissions'] and
if (copyMoveOptions['copyFolderPermissions'] and
copyMoveOptions['copyMergeWithParentFolderPermissions'] and
copyMoveOptions['destParentType'] != DEST_PARENT_MYDRIVE_ROOT):
copyFolderNonInheritedPermissions =\
_getCopyFolderNonInheritedPermissions(copyMoveOptions,
@@ -62897,7 +62902,8 @@ def copyDriveFile(users):
_writeCSVData(user, folderName, folderId, newFolderName, newFolderId, MIMETYPE_GA_FOLDER)
Act.Set(action)
_incrStatistic(statistics, STAT_FOLDER_MERGED)
if (copyMoveOptions[['copyMergedSubFolderPermissions', 'copyMergedTopFolderPermissions'][atTop]] and
if (copyMoveOptions['copyFolderPermissions'] and
copyMoveOptions[['copyMergedSubFolderPermissions', 'copyMergedTopFolderPermissions'][atTop]] and
(not atTop or copyMoveOptions['destParentType'] != DEST_PARENT_MYDRIVE_ROOT)):
copyFolderNonInheritedPermissions =\
_getCopyFolderNonInheritedPermissions(copyMoveOptions,
@@ -62949,7 +62955,8 @@ def copyDriveFile(users):
else:
_writeCSVData(user, folderName, folderId, newFolderName, newFolderId, body['mimeType'])
_incrStatistic(statistics, STAT_FOLDER_COPIED_MOVED)
if copyMoveOptions[['copySubFolderPermissions', 'copyTopFolderPermissions'][atTop]]:
if (copyMoveOptions['copyFolderPermissions'] and
copyMoveOptions[['copySubFolderPermissions', 'copyTopFolderPermissions'][atTop]]):
_copyPermissions(drive, user, i, count, j, jcount,
Ent.DRIVE_FOLDER, folderId, folderName, newFolderId, newFolderName,
statistics, STAT_FOLDER_PERMISSIONS_FAILED,
@@ -63704,6 +63711,7 @@ def _recursiveUpdateMovePermissions(drive, user, i, count,
# [createshortcutsfornonmovablefiles [<Boolean>]]
# [duplicatefiles overwriteolder|overwriteall|duplicatename|uniquename|skip]
# [duplicatefolders merge|duplicatename|uniquename|skip]
# [copyfolderpermissions [<Boolean>]]
# [copymergewithparentfolderpermissions [<Boolean>]]
# [copymergedtopfolderpermissions [<Boolean>]]
# [copytopfolderpermissions [<Boolean>]]
@@ -63740,7 +63748,8 @@ def moveDriveFile(users):
entityPerformActionModifierItemValueList(kvList, Act.MODIFIER_CONTENTS_WITH, [Ent.DRIVE_FOLDER, newParentNameId], j, jcount)
Act.Set(action)
_incrStatistic(statistics, STAT_FOLDER_MERGED)
if (copyMoveOptions['copyMergeWithParentFolderPermissions'] and
if (copyMoveOptions['copyFolderPermissions'] and
copyMoveOptions['copyMergeWithParentFolderPermissions'] and
copyMoveOptions['destParentType'] != DEST_PARENT_MYDRIVE_ROOT):
copyFolderNonInheritedPermissions =\
_getCopyFolderNonInheritedPermissions(copyMoveOptions,
@@ -63770,7 +63779,8 @@ def moveDriveFile(users):
entityModifierItemValueListActionPerformed(kvList, Act.MODIFIER_CONTENTS_WITH, [Ent.DRIVE_FOLDER, f'{newFolderName}({newFolderId})'], j, jcount)
Act.Set(action)
_incrStatistic(statistics, STAT_FOLDER_MERGED)
if (copyMoveOptions[['copyMergedSubFolderPermissions', 'copyMergedTopFolderPermissions'][atTop]] and
if (copyMoveOptions['copyFolderPermissions'] and
copyMoveOptions[['copyMergedSubFolderPermissions', 'copyMergedTopFolderPermissions'][atTop]] and
(not atTop or copyMoveOptions['destParentType'] != DEST_PARENT_MYDRIVE_ROOT)):
copyFolderNonInheritedPermissions =\
_getCopyFolderNonInheritedPermissions(copyMoveOptions,
@@ -63864,7 +63874,8 @@ def moveDriveFile(users):
j, jcount)
Act.Set(action)
_incrStatistic(statistics, STAT_FOLDER_COPIED_MOVED)
if copyMoveOptions[['copySubFolderPermissions', 'copyTopFolderPermissions'][atTop]]:
if (copyMoveOptions['copyFolderPermissions'] and
copyMoveOptions[['copySubFolderPermissions', 'copyTopFolderPermissions'][atTop]]):
_copyPermissions(drive, user, i, count, j, jcount,
Ent.DRIVE_FOLDER, folderId, folderName, newFolderId, newFolderName,
statistics, STAT_FOLDER_PERMISSIONS_FAILED,

View File

@@ -649,6 +649,16 @@ _SVCACCT_SCOPES = [
'api': CLOUDIDENTITY_DEVICES,
'subscopes': READONLY,
'scope': 'https://www.googleapis.com/auth/cloud-identity.devices'},
# {'name': 'Cloud Identity API - Policy',
# 'api': CLOUDIDENTITY_POLICY,
# 'subscopes': READONLY,
# 'roByDefault': True,
# 'scope': 'https://www.googleapis.com/auth/cloud-identity.policies'},
# {'name': 'Cloud Identity API - Policy Beta',
# 'api': CLOUDIDENTITY_POLICY_BETA,
# 'subscopes': [],
# 'offByDefault': True,
# 'scope': 'https://www.googleapis.com/auth/cloud-identity.policies'},
# {'name': 'Cloud Identity User Invitations API',
# 'api': CLOUDIDENTITY_USERINVITATIONS,
# 'subscopes': READONLY,