mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-25 16:41:35 +00:00
Updated <ToDriveAttribute> to allow multiple tdshare <EmailAddress> commenter|reader|writer options.
This commit is contained in:
@@ -611,7 +611,7 @@ If an item contains spaces, it should be surrounded by ".
|
||||
(tdnoescapechar [<Boolean>])|
|
||||
(tdparent (id:<DriveFolderID>)|<DriveFolderName>)|
|
||||
(tdretaintitle [<Boolean>])|
|
||||
(tdshare <EmailAddress> commenter|reader|writer)|
|
||||
(tdshare <EmailAddress> commenter|reader|writer)*|
|
||||
(tdsheet (id:<Number>)|<String>)|
|
||||
(tdsheettimestamp [<Boolean>] [tdsheettimeformat <String>])
|
||||
(tdsheettitle <String>)|
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
Merged GAM-Team version
|
||||
|
||||
6.67.32
|
||||
|
||||
Updated `<ToDriveAttribute>` to allow multiple `tdshare <EmailAddress> commenter|reader|writer` options.
|
||||
|
||||
6.67.31
|
||||
|
||||
Updated `gam <UserTypeEntity> claim|transfer ownership <DriveFileEntity>` to properly
|
||||
|
||||
@@ -7845,7 +7845,7 @@ class CSVPrintFile():
|
||||
'fileId': None, 'parentId': None, 'parent': GC.Values[GC.TODRIVE_PARENT], 'retaintitle': False,
|
||||
'localcopy': GC.Values[GC.TODRIVE_LOCALCOPY], 'uploadnodata': GC.Values[GC.TODRIVE_UPLOAD_NODATA],
|
||||
'nobrowser': GC.Values[GC.TODRIVE_NOBROWSER], 'noemail': GC.Values[GC.TODRIVE_NOEMAIL],
|
||||
'share': {}}
|
||||
'share': []}
|
||||
while Cmd.ArgumentsRemaining():
|
||||
myarg = getArgument()
|
||||
if myarg == 'tduser':
|
||||
@@ -7918,9 +7918,9 @@ class CSVPrintFile():
|
||||
elif myarg == 'tdnoescapechar':
|
||||
self.todrive['noescapechar'] = getBoolean()
|
||||
elif myarg == 'tdshare':
|
||||
self.todrive['share']['emailAddress'] = normalizeEmailAddressOrUID(getString(Cmd.OB_EMAIL_ADDRESS))
|
||||
self.todrive['share']['type'] = 'user'
|
||||
self.todrive['share']['role'] = getChoice(self.TDSHARE_ACL_ROLES_MAP, mapChoice=True)
|
||||
self.todrive['share'].append({'emailAddress': normalizeEmailAddressOrUID(getString(Cmd.OB_EMAIL_ADDRESS)),
|
||||
'type': 'user',
|
||||
'role': getChoice(self.TDSHARE_ACL_ROLES_MAP, mapChoice=True)})
|
||||
else:
|
||||
Cmd.Backup()
|
||||
break
|
||||
@@ -8581,31 +8581,33 @@ class CSVPrintFile():
|
||||
closeFile(csvFile)
|
||||
return
|
||||
closeFile(csvFile)
|
||||
if not self.todrive['fileId'] and self.todrive['share'] and self.todrive['share']['emailAddress'] != user:
|
||||
if not self.todrive['fileId'] and self.todrive['share']:
|
||||
Act.Set(Act.SHARE)
|
||||
try:
|
||||
callGAPI(drive.permissions(), 'create',
|
||||
bailOnInternalError=True,
|
||||
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_CREATE_ACL_THROW_REASONS,
|
||||
fileId=spreadsheetId, sendNotificationEmail=False, body=self.todrive['share'], fields='', supportsAllDrives=True)
|
||||
entityActionPerformed([Ent.USER, user, Ent.SPREADSHEET, title,
|
||||
Ent.TARGET_USER, self.todrive['share']['emailAddress'], Ent.ROLE, self.todrive['share']['role']])
|
||||
except (GAPI.badRequest, GAPI.invalid, GAPI.fileNotFound, GAPI.forbidden, GAPI.internalError,
|
||||
GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions, GAPI.unknownError, GAPI.ownershipChangeAcrossDomainNotPermitted,
|
||||
GAPI.teamDriveDomainUsersOnlyRestriction, GAPI.teamDriveTeamMembersOnlyRestriction,
|
||||
GAPI.targetUserRoleLimitedByLicenseRestriction, GAPI.insufficientAdministratorPrivileges, GAPI.sharingRateLimitExceeded,
|
||||
GAPI.publishOutNotPermitted, GAPI.shareInNotPermitted, GAPI.shareOutNotPermitted, GAPI.shareOutNotPermittedToUser,
|
||||
GAPI.cannotShareTeamDriveTopFolderWithAnyoneOrDomains, GAPI.cannotShareTeamDriveWithNonGoogleAccounts,
|
||||
GAPI.ownerOnTeamDriveItemNotSupported,
|
||||
GAPI.organizerOnNonTeamDriveNotSupported, GAPI.organizerOnNonTeamDriveItemNotSupported,
|
||||
GAPI.fileOrganizerNotYetEnabledForThisTeamDrive,
|
||||
GAPI.fileOrganizerOnFoldersInSharedDriveOnly,
|
||||
GAPI.fileOrganizerOnNonTeamDriveNotSupported,
|
||||
GAPI.teamDrivesFolderSharingNotSupported, GAPI.invalidLinkVisibility,
|
||||
GAPI.invalidSharingRequest, GAPI.fileNeverWritable, GAPI.abusiveContentRestriction) as e:
|
||||
entityActionFailedWarning([Ent.USER, user, Ent.SPREADSHEET, title,
|
||||
Ent.TARGET_USER, self.todrive['share']['emailAddress'], Ent.ROLE, self.todrive['share']['role']],
|
||||
str(e))
|
||||
for share in self.todrive['share']:
|
||||
if share['emailAddress'] != user:
|
||||
try:
|
||||
callGAPI(drive.permissions(), 'create',
|
||||
bailOnInternalError=True,
|
||||
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_CREATE_ACL_THROW_REASONS,
|
||||
fileId=spreadsheetId, sendNotificationEmail=False, body=share, fields='', supportsAllDrives=True)
|
||||
entityActionPerformed([Ent.USER, user, Ent.SPREADSHEET, title,
|
||||
Ent.TARGET_USER, share['emailAddress'], Ent.ROLE, share['role']])
|
||||
except (GAPI.badRequest, GAPI.invalid, GAPI.fileNotFound, GAPI.forbidden, GAPI.internalError,
|
||||
GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions, GAPI.unknownError, GAPI.ownershipChangeAcrossDomainNotPermitted,
|
||||
GAPI.teamDriveDomainUsersOnlyRestriction, GAPI.teamDriveTeamMembersOnlyRestriction,
|
||||
GAPI.targetUserRoleLimitedByLicenseRestriction, GAPI.insufficientAdministratorPrivileges, GAPI.sharingRateLimitExceeded,
|
||||
GAPI.publishOutNotPermitted, GAPI.shareInNotPermitted, GAPI.shareOutNotPermitted, GAPI.shareOutNotPermittedToUser,
|
||||
GAPI.cannotShareTeamDriveTopFolderWithAnyoneOrDomains, GAPI.cannotShareTeamDriveWithNonGoogleAccounts,
|
||||
GAPI.ownerOnTeamDriveItemNotSupported,
|
||||
GAPI.organizerOnNonTeamDriveNotSupported, GAPI.organizerOnNonTeamDriveItemNotSupported,
|
||||
GAPI.fileOrganizerNotYetEnabledForThisTeamDrive,
|
||||
GAPI.fileOrganizerOnFoldersInSharedDriveOnly,
|
||||
GAPI.fileOrganizerOnNonTeamDriveNotSupported,
|
||||
GAPI.teamDrivesFolderSharingNotSupported, GAPI.invalidLinkVisibility,
|
||||
GAPI.invalidSharingRequest, GAPI.fileNeverWritable, GAPI.abusiveContentRestriction) as e:
|
||||
entityActionFailedWarning([Ent.USER, user, Ent.SPREADSHEET, title,
|
||||
Ent.TARGET_USER, share['emailAddress'], Ent.ROLE, share['role']],
|
||||
str(e))
|
||||
if ((result['mimeType'] == MIMETYPE_GA_SPREADSHEET) and
|
||||
(self.todrive['sheetEntity'] or self.todrive['locale'] or self.todrive['timeZone'] or
|
||||
self.todrive['sheettitle'] or self.todrive['cellwrap'] or self.todrive['cellnumberformat'])):
|
||||
|
||||
Reference in New Issue
Block a user