mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-07 21:23:34 +00:00
Option to force shared drive deletion
This commit is contained in:
@ -8227,6 +8227,23 @@ def printShowSharedDrives(users, csvFormat):
|
|||||||
|
|
||||||
def doDeleteSharedDrive(users):
|
def doDeleteSharedDrive(users):
|
||||||
_, driveId = getSharedDriveId(5)
|
_, driveId = getSharedDriveId(5)
|
||||||
|
allowItemDeletion = False
|
||||||
|
useDomainAdminAccess = False
|
||||||
|
i = 6
|
||||||
|
if driveId.lower().startswith('name'):
|
||||||
|
driveId = gapi_drive_drives.drive_name_to_id(sys.argv[i])
|
||||||
|
i += 1
|
||||||
|
while i < len(sys.argv):
|
||||||
|
myarg = sys.argv[i].lower().replace('_', '')
|
||||||
|
if myarg in ['nukefromorbit', 'allowitemdeletion']:
|
||||||
|
print("I say we take off and nuke the entire site from orbit. It's the only way to be sure...")
|
||||||
|
print('(deleting the shared drive and all files on it...)')
|
||||||
|
allowItemDeletion = True
|
||||||
|
useDomainAdminAccess = True
|
||||||
|
i += 1
|
||||||
|
else:
|
||||||
|
controlflow.invalid_argument_exit(
|
||||||
|
myarg, 'gam delete shareddrive')
|
||||||
for user in users:
|
for user in users:
|
||||||
user, drive = buildDrive3GAPIObject(user)
|
user, drive = buildDrive3GAPIObject(user)
|
||||||
if not drive:
|
if not drive:
|
||||||
@ -8235,6 +8252,8 @@ def doDeleteSharedDrive(users):
|
|||||||
gapi.call(drive.drives(),
|
gapi.call(drive.drives(),
|
||||||
'delete',
|
'delete',
|
||||||
driveId=driveId,
|
driveId=driveId,
|
||||||
|
allowItemDeletion=allowItemDeletion,
|
||||||
|
useDomainAdminAccess=useDomainAdminAccess,
|
||||||
soft_errors=True)
|
soft_errors=True)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user