gam7 7.4.4__py3-none-any.whl → 7.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gam7 might be problematic. Click here for more details.
- gam/__init__.py +121 -51
- gam/gamlib/glapi.py +2 -0
- gam/gamlib/glcfg.py +4 -0
- gam/meet-v2beta.json +1152 -0
- {gam7-7.4.4.dist-info → gam7-7.5.0.dist-info}/METADATA +1 -1
- {gam7-7.4.4.dist-info → gam7-7.5.0.dist-info}/RECORD +9 -8
- {gam7-7.4.4.dist-info → gam7-7.5.0.dist-info}/WHEEL +0 -0
- {gam7-7.4.4.dist-info → gam7-7.5.0.dist-info}/entry_points.txt +0 -0
- {gam7-7.4.4.dist-info → gam7-7.5.0.dist-info}/licenses/LICENSE +0 -0
gam/__init__.py
CHANGED
|
@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
|
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
|
28
|
-
__version__ = '7.
|
|
28
|
+
__version__ = '7.05.00'
|
|
29
29
|
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
|
30
30
|
|
|
31
31
|
#pylint: disable=wrong-import-position
|
|
@@ -4710,7 +4710,7 @@ def getAPIService(api, httpObj):
|
|
|
4710
4710
|
|
|
4711
4711
|
def getService(api, httpObj):
|
|
4712
4712
|
### Drive v3beta
|
|
4713
|
-
mapDriveURL = api == API.DRIVE3 and GC.Values[GC.DRIVE_V3_BETA]
|
|
4713
|
+
# mapDriveURL = api == API.DRIVE3 and GC.Values[GC.DRIVE_V3_BETA]
|
|
4714
4714
|
hasLocalJSON = API.hasLocalJSON(api)
|
|
4715
4715
|
api, version, v2discovery = API.getVersion(api)
|
|
4716
4716
|
if api in GM.Globals[GM.CURRENT_API_SERVICES] and version in GM.Globals[GM.CURRENT_API_SERVICES][api]:
|
|
@@ -4727,8 +4727,8 @@ def getService(api, httpObj):
|
|
|
4727
4727
|
GM.Globals[GM.CURRENT_API_SERVICES].setdefault(api, {})
|
|
4728
4728
|
GM.Globals[GM.CURRENT_API_SERVICES][api][version] = service._rootDesc.copy()
|
|
4729
4729
|
### Drive v3beta
|
|
4730
|
-
if mapDriveURL:
|
|
4731
|
-
setattr(service, '_baseUrl', getattr(service, '_baseUrl').replace('/v3/', '/v3beta/'))
|
|
4730
|
+
# if mapDriveURL:
|
|
4731
|
+
# setattr(service, '_baseUrl', getattr(service, '_baseUrl').replace('/v3/', '/v3beta/'))
|
|
4732
4732
|
if GM.Globals[GM.CACHE_DISCOVERY_ONLY]:
|
|
4733
4733
|
clearServiceCache(service)
|
|
4734
4734
|
return service
|
|
@@ -5571,6 +5571,8 @@ def buildGAPIServiceObject(api, user, i=0, count=0, displayError=True):
|
|
|
5571
5571
|
userEmail = getSaUser(user)
|
|
5572
5572
|
httpObj = getHttpObj(cache=GM.Globals[GM.CACHE_DIR])
|
|
5573
5573
|
service = getService(api, httpObj)
|
|
5574
|
+
if api == API.MEET_BETA:
|
|
5575
|
+
api = API.MEET
|
|
5574
5576
|
credentials = getSvcAcctCredentials(api, userEmail)
|
|
5575
5577
|
request = transportCreateRequest(httpObj)
|
|
5576
5578
|
triesLimit = 3
|
|
@@ -9840,7 +9842,7 @@ def MultiprocessGAMCommands(items, showCmds):
|
|
|
9840
9842
|
if GM.Globals[GM.MULTIPROCESS_EXIT_CONDITION] is not None and checkChildProcessRC(result[1]):
|
|
9841
9843
|
GM.Globals[GM.MULTIPROCESS_EXIT_PROCESSING] = True
|
|
9842
9844
|
|
|
9843
|
-
def signal_handler(
|
|
9845
|
+
def signal_handler(*_):
|
|
9844
9846
|
nonlocal controlC
|
|
9845
9847
|
controlC = True
|
|
9846
9848
|
|
|
@@ -17254,7 +17256,7 @@ def checkOrgUnitPathExists(cd, orgUnitPath, i=0, count=0, showError=False):
|
|
|
17254
17256
|
return (False, orgUnitPath, orgUnitPath)
|
|
17255
17257
|
|
|
17256
17258
|
def _batchMoveCrOSesToOrgUnit(cd, orgUnitPath, orgUnitId, i, count, items, quickCrOSMove, fromOrgUnitPath=None):
|
|
17257
|
-
def _callbackMoveCrOSesToOrgUnit(request_id,
|
|
17259
|
+
def _callbackMoveCrOSesToOrgUnit(request_id, _, exception):
|
|
17258
17260
|
ri = request_id.splitlines()
|
|
17259
17261
|
if exception is None:
|
|
17260
17262
|
if not fromOrgUnitPath:
|
|
@@ -17335,7 +17337,7 @@ def _batchMoveCrOSesToOrgUnit(cd, orgUnitPath, orgUnitId, i, count, items, quick
|
|
|
17335
17337
|
|
|
17336
17338
|
def _batchMoveUsersToOrgUnit(cd, orgUnitPath, i, count, items, fromOrgUnitPath=None):
|
|
17337
17339
|
_MOVE_USER_REASON_TO_MESSAGE_MAP = {GAPI.USER_NOT_FOUND: Msg.DOES_NOT_EXIST, GAPI.DOMAIN_NOT_FOUND: Msg.SERVICE_NOT_APPLICABLE, GAPI.FORBIDDEN: Msg.SERVICE_NOT_APPLICABLE}
|
|
17338
|
-
def _callbackMoveUsersToOrgUnit(request_id,
|
|
17340
|
+
def _callbackMoveUsersToOrgUnit(request_id, _, exception):
|
|
17339
17341
|
ri = request_id.splitlines()
|
|
17340
17342
|
if exception is None:
|
|
17341
17343
|
if not fromOrgUnitPath:
|
|
@@ -27488,6 +27490,8 @@ def printShowChatEvents(users):
|
|
|
27488
27490
|
csvPF.writeCSVfile('Chat Events')
|
|
27489
27491
|
|
|
27490
27492
|
def buildMeetServiceObject(api=API.MEET, user=None, i=0, count=0, entityTypeList=None):
|
|
27493
|
+
if GC.Values[GC.MEET_V2_BETA]:
|
|
27494
|
+
api = API.MEET_BETA
|
|
27491
27495
|
user, meet = buildGAPIServiceObject(api, user, i, count)
|
|
27492
27496
|
kvList = [Ent.USER, user]
|
|
27493
27497
|
if entityTypeList is not None:
|
|
@@ -27511,7 +27515,10 @@ MEET_SPACE_OPTIONS_MAP = {
|
|
|
27511
27515
|
'reactionrestriction': 'reactionRestriction',
|
|
27512
27516
|
'presentrestriction': 'presentRestriction',
|
|
27513
27517
|
'defaultjoinasviewer': 'defaultJoinAsViewerType',
|
|
27514
|
-
'firstjoiner': 'firstJoinerType'
|
|
27518
|
+
'firstjoiner': 'firstJoinerType',
|
|
27519
|
+
'autorecording': 'recordingConfig',
|
|
27520
|
+
'autosmartnotes': 'smartNotesConfig',
|
|
27521
|
+
'autotranscription': 'transcriptionConfig',
|
|
27515
27522
|
}
|
|
27516
27523
|
|
|
27517
27524
|
MEET_SPACE_ACCESSTYPE_CHOICES = {'open', 'trusted', 'restricted'}
|
|
@@ -27525,9 +27532,15 @@ MEET_SPACE_RESTRICTIONS_CHOICES_MAP = {
|
|
|
27525
27532
|
'norestriction': 'NO_RESTRICTION'
|
|
27526
27533
|
}
|
|
27527
27534
|
|
|
27528
|
-
MEET_SPACE_FIRSTJOINERTYPE_CHOICES_MAP = {
|
|
27529
|
-
'hostsonly': 'HOSTS_ONLY',
|
|
27530
|
-
'anyone': 'ANYONE'
|
|
27535
|
+
#MEET_SPACE_FIRSTJOINERTYPE_CHOICES_MAP = {
|
|
27536
|
+
# 'hostsonly': 'HOSTS_ONLY',
|
|
27537
|
+
# 'anyone': 'ANYONE'
|
|
27538
|
+
# }
|
|
27539
|
+
|
|
27540
|
+
MEET_SPACE_ARTIFACT_SUB_OPTIONS = {
|
|
27541
|
+
'recordingConfig': 'autoRecordingGeneration',
|
|
27542
|
+
'smartNotesConfig': 'autoSmartNotesGeneration',
|
|
27543
|
+
'transcriptionConfig': 'autoTranscriptionGeneration'
|
|
27531
27544
|
}
|
|
27532
27545
|
|
|
27533
27546
|
# [accesstype open|trusted|restricted]
|
|
@@ -27538,7 +27551,10 @@ MEET_SPACE_FIRSTJOINERTYPE_CHOICES_MAP = {
|
|
|
27538
27551
|
# [presentrestriction hostsonly|norestriction]
|
|
27539
27552
|
# [defaultjoinasviewer <Boolean>]
|
|
27540
27553
|
# [firstjoiner hostsonly|anyone]
|
|
27541
|
-
|
|
27554
|
+
# [autorecording <Boolean>]
|
|
27555
|
+
# [autosmartnotes <Boolean>]
|
|
27556
|
+
# [autotranscription <Boolean>]
|
|
27557
|
+
def _getMeetSpaceParameters(myarg, body):
|
|
27542
27558
|
option = MEET_SPACE_OPTIONS_MAP.get(myarg, None)
|
|
27543
27559
|
if option is None:
|
|
27544
27560
|
return False
|
|
@@ -27548,15 +27564,17 @@ def _getMeetSpaceParameters(myarg, body, updateMask):
|
|
|
27548
27564
|
body['config'][option] = getChoice(MEET_SPACE_ENTRYPOINTACCESS_CHOICES_MAP, mapChoice=True)
|
|
27549
27565
|
elif option == 'moderation':
|
|
27550
27566
|
body['config'][option] = 'ON' if getBoolean() else 'OFF'
|
|
27551
|
-
elif option in {'
|
|
27552
|
-
body['config'].setdefault('
|
|
27567
|
+
elif option in {'chatRestriction', 'reactionRestriction', 'presentRestriction'}:
|
|
27568
|
+
body['config'].setdefault('moderationRestrictions', {})
|
|
27553
27569
|
body['config']['moderationRestrictions'][option] = getChoice(MEET_SPACE_RESTRICTIONS_CHOICES_MAP, mapChoice=True)
|
|
27554
|
-
option = f'moderationRestrictions.{option}'
|
|
27555
27570
|
elif option == 'defaultJoinAsViewerType':
|
|
27556
27571
|
body['config'][option] = 'ON' if getBoolean() else 'OFF'
|
|
27557
|
-
elif option == 'firstJoinerType':
|
|
27558
|
-
body['config'][option] = getChoice(MEET_SPACE_FIRSTJOINERTYPE_CHOICES_MAP, mapChoice=True)
|
|
27559
|
-
|
|
27572
|
+
# elif option == 'firstJoinerType':
|
|
27573
|
+
# body['config'][option] = getChoice(MEET_SPACE_FIRSTJOINERTYPE_CHOICES_MAP, mapChoice=True)
|
|
27574
|
+
elif option in {'recordingConfig', 'transcriptionConfig', 'smartNotesConfig'}:
|
|
27575
|
+
body['config'].setdefault('artifactConfig', {})
|
|
27576
|
+
body['config']['artifactConfig'].setdefault(option, {})
|
|
27577
|
+
body['config']['artifactConfig'][option][MEET_SPACE_ARTIFACT_SUB_OPTIONS[option]] = 'ON' if getBoolean() else 'OFF'
|
|
27560
27578
|
return True
|
|
27561
27579
|
|
|
27562
27580
|
# gam <UserTypeEntity> create meetspace
|
|
@@ -27571,10 +27589,9 @@ def createMeetSpace(users):
|
|
|
27571
27589
|
# 'firstJoinerType': 'ANYONE',
|
|
27572
27590
|
}}
|
|
27573
27591
|
returnIdOnly = False
|
|
27574
|
-
updateMask = []
|
|
27575
27592
|
while Cmd.ArgumentsRemaining():
|
|
27576
27593
|
myarg = getArgument()
|
|
27577
|
-
if _getMeetSpaceParameters(myarg, body
|
|
27594
|
+
if _getMeetSpaceParameters(myarg, body):
|
|
27578
27595
|
pass
|
|
27579
27596
|
elif myarg == 'returnidonly':
|
|
27580
27597
|
returnIdOnly = True
|
|
@@ -27609,12 +27626,11 @@ def updateMeetSpace(users):
|
|
|
27609
27626
|
FJQC = FormatJSONQuoteChar()
|
|
27610
27627
|
name = None
|
|
27611
27628
|
body = {'config': {}}
|
|
27612
|
-
updateMask = []
|
|
27613
27629
|
while Cmd.ArgumentsRemaining():
|
|
27614
27630
|
myarg = getArgument()
|
|
27615
27631
|
if (myarg == 'space' or myarg.startswith('spaces/') or myarg.startswith('space/')):
|
|
27616
27632
|
name = getSpaceName(myarg)
|
|
27617
|
-
elif _getMeetSpaceParameters(myarg, body
|
|
27633
|
+
elif _getMeetSpaceParameters(myarg, body):
|
|
27618
27634
|
pass
|
|
27619
27635
|
else:
|
|
27620
27636
|
FJQC.GetFormatJSON(myarg)
|
|
@@ -27629,7 +27645,7 @@ def updateMeetSpace(users):
|
|
|
27629
27645
|
try:
|
|
27630
27646
|
space = callGAPI(meet.spaces(), 'patch',
|
|
27631
27647
|
throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.PERMISSION_DENIED],
|
|
27632
|
-
name=name, updateMask='
|
|
27648
|
+
name=name, updateMask='', body=body)
|
|
27633
27649
|
if not FJQC.formatJSON:
|
|
27634
27650
|
entityActionPerformed(kvList, i, count)
|
|
27635
27651
|
Ind.Increment()
|
|
@@ -32007,7 +32023,7 @@ def doUpdateGroups():
|
|
|
32007
32023
|
GAPI.INVALID_MEMBER: Msg.INVALID_MEMBER,
|
|
32008
32024
|
GAPI.CYCLIC_MEMBERSHIPS_NOT_ALLOWED: Msg.WOULD_MAKE_MEMBERSHIP_CYCLE}
|
|
32009
32025
|
|
|
32010
|
-
def _callbackAddGroupMembers(request_id,
|
|
32026
|
+
def _callbackAddGroupMembers(request_id, _, exception):
|
|
32011
32027
|
ri = request_id.splitlines()
|
|
32012
32028
|
if exception is None:
|
|
32013
32029
|
_showSuccess(ri[RI_ENTITY], ri[RI_ITEM], ri[RI_ROLE], ri[RI_OPTION], int(ri[RI_J]), int(ri[RI_JCOUNT]))
|
|
@@ -32096,7 +32112,7 @@ def doUpdateGroups():
|
|
|
32096
32112
|
GAPI.CONDITION_NOT_MET: f'{Msg.NOT_A} {Ent.Singular(Ent.MEMBER)}',
|
|
32097
32113
|
GAPI.INVALID_MEMBER: Msg.DOES_NOT_EXIST}
|
|
32098
32114
|
|
|
32099
|
-
def _callbackRemoveGroupMembers(request_id,
|
|
32115
|
+
def _callbackRemoveGroupMembers(request_id, _, exception):
|
|
32100
32116
|
ri = request_id.splitlines()
|
|
32101
32117
|
if exception is None:
|
|
32102
32118
|
_showSuccess(ri[RI_ENTITY], ri[RI_ITEM], ri[RI_ROLE], DELIVERY_SETTINGS_UNDEFINED, int(ri[RI_J]), int(ri[RI_JCOUNT]))
|
|
@@ -32195,7 +32211,7 @@ def doUpdateGroups():
|
|
|
32195
32211
|
except (GAPI.invalidMember, GAPI.resourceNotFound, GAPI.serviceNotAvailable) as e:
|
|
32196
32212
|
_showFailure(group, member, role, str(e), j, jcount)
|
|
32197
32213
|
|
|
32198
|
-
def _callbackUpdateGroupMembers(request_id,
|
|
32214
|
+
def _callbackUpdateGroupMembers(request_id, _, exception):
|
|
32199
32215
|
ri = request_id.splitlines()
|
|
32200
32216
|
if exception is None:
|
|
32201
32217
|
_showSuccess(ri[RI_ENTITY], ri[RI_ITEM], ri[RI_ROLE], ri[RI_OPTION], int(ri[RI_J]), int(ri[RI_JCOUNT]))
|
|
@@ -33432,6 +33448,7 @@ PRINT_GROUPS_JSON_TITLES = ['email', 'JSON']
|
|
|
33432
33448
|
|
|
33433
33449
|
# gam print groups [todrive <ToDriveAttribute>*]
|
|
33434
33450
|
# [([domain|domains <DomainNameEntity>] ([member|showownedby <EmailItem>]|[(query <QueryGroup>)|(queries <QueryUserList>)]))|
|
|
33451
|
+
# (group|group_ns|group_susp <GroupItem>)|
|
|
33435
33452
|
# (select <GroupEntity>)]
|
|
33436
33453
|
# [emailmatchpattern [not] <RegularExpression>] [namematchpattern [not] <RegularExpression>]
|
|
33437
33454
|
# [descriptionmatchpattern [not] <RegularExpression>] (matchsetting [not] <GroupAttribute>)*
|
|
@@ -33644,6 +33661,12 @@ def doPrintGroups():
|
|
|
33644
33661
|
pass
|
|
33645
33662
|
elif getGroupMatchPatterns(myarg, matchPatterns, False):
|
|
33646
33663
|
pass
|
|
33664
|
+
elif myarg in {'group', 'groupns', 'groupsusp'}:
|
|
33665
|
+
entitySelection = [getString(Cmd.OB_EMAIL_ADDRESS)]
|
|
33666
|
+
if myarg == 'groupns':
|
|
33667
|
+
isSuspended = False
|
|
33668
|
+
elif myarg == 'groupsusp':
|
|
33669
|
+
isSuspended = True
|
|
33647
33670
|
elif myarg == 'select':
|
|
33648
33671
|
entitySelection = getEntityList(Cmd.OB_GROUP_ENTITY)
|
|
33649
33672
|
elif myarg in SUSPENDED_ARGUMENTS:
|
|
@@ -42331,7 +42354,7 @@ def doPrintVaultCounts():
|
|
|
42331
42354
|
# gam [<UserTypeEntity>] print siteacls <SiteEntity> [todrive <ToDriveAttribute>*]
|
|
42332
42355
|
# gam [<UserTypeEntity>] print siteactivity <SiteEntity> [todrive <ToDriveAttribute>*]
|
|
42333
42356
|
# [startindex <Number>] [maxresults <Number>] [updated_min <Date>] [updated_max <Date>]
|
|
42334
|
-
def deprecatedUserSites(
|
|
42357
|
+
def deprecatedUserSites(_):
|
|
42335
42358
|
deprecatedCommandExit()
|
|
42336
42359
|
|
|
42337
42360
|
def deprecatedDomainSites():
|
|
@@ -43653,7 +43676,7 @@ def waitForMailbox(entityList):
|
|
|
43653
43676
|
Ind.Decrement()
|
|
43654
43677
|
|
|
43655
43678
|
def getUserLicenses(lic, user, skus):
|
|
43656
|
-
def _callbackGetLicense(
|
|
43679
|
+
def _callbackGetLicense(_, response, exception):
|
|
43657
43680
|
if exception is None:
|
|
43658
43681
|
if response and 'skuId' in response:
|
|
43659
43682
|
licenses.append(response['skuId'])
|
|
@@ -48159,7 +48182,7 @@ def _batchAddItemsToCourse(croom, courseId, i, count, addParticipants, role):
|
|
|
48159
48182
|
_ADD_PART_REASON_TO_MESSAGE_MAP = {GAPI.NOT_FOUND: Msg.DOES_NOT_EXIST,
|
|
48160
48183
|
GAPI.ALREADY_EXISTS: Msg.DUPLICATE,
|
|
48161
48184
|
GAPI.FAILED_PRECONDITION: Msg.NOT_ALLOWED}
|
|
48162
|
-
def _callbackAddItemsToCourse(request_id,
|
|
48185
|
+
def _callbackAddItemsToCourse(request_id, _, exception):
|
|
48163
48186
|
ri = request_id.splitlines()
|
|
48164
48187
|
if exception is None:
|
|
48165
48188
|
entityActionPerformed([Ent.COURSE, ri[RI_ENTITY], ri[RI_ROLE], ri[RI_ITEM]], int(ri[RI_J]), int(ri[RI_JCOUNT]))
|
|
@@ -48239,7 +48262,7 @@ def _batchRemoveItemsFromCourse(croom, courseId, i, count, removeParticipants, r
|
|
|
48239
48262
|
_REMOVE_PART_REASON_TO_MESSAGE_MAP = {GAPI.NOT_FOUND: Msg.DOES_NOT_EXIST,
|
|
48240
48263
|
GAPI.FORBIDDEN: Msg.FORBIDDEN,
|
|
48241
48264
|
GAPI.PERMISSION_DENIED: Msg.PERMISSION_DENIED}
|
|
48242
|
-
def _callbackRemoveItemsFromCourse(request_id,
|
|
48265
|
+
def _callbackRemoveItemsFromCourse(request_id, _, exception):
|
|
48243
48266
|
ri = request_id.splitlines()
|
|
48244
48267
|
if exception is None:
|
|
48245
48268
|
entityActionPerformed([Ent.COURSE, ri[RI_ENTITY], ri[RI_ROLE], ri[RI_ITEM]], int(ri[RI_J]), int(ri[RI_JCOUNT]))
|
|
@@ -48451,7 +48474,7 @@ def doCourseRemoveItems(courseIdList, getEntityListArg):
|
|
|
48451
48474
|
|
|
48452
48475
|
# gam courses <CourseEntity> clear teachers|students
|
|
48453
48476
|
# gam course <CourseID> clear teacher|student
|
|
48454
|
-
def doCourseClearParticipants(courseIdList,
|
|
48477
|
+
def doCourseClearParticipants(courseIdList, _):
|
|
48455
48478
|
croom = buildGAPIObject(API.CLASSROOM)
|
|
48456
48479
|
role = getChoice(CLEAR_SYNC_PARTICIPANT_TYPES_MAP, mapChoice=True)
|
|
48457
48480
|
checkForExtraneousArguments()
|
|
@@ -48467,7 +48490,7 @@ def doCourseClearParticipants(courseIdList, getEntityListArg):
|
|
|
48467
48490
|
# gam course <CourseID> sync students [addonly|removeonly] <UserTypeEntity>
|
|
48468
48491
|
# gam courses <CourseEntity> sync teachers [addonly|removeonly] [makefirstteacherowner] <UserTypeEntity>
|
|
48469
48492
|
# gam course <CourseID> sync teachers [addonly|removeonly] [makefirstteacherowner] <UserTypeEntity>
|
|
48470
|
-
def doCourseSyncParticipants(courseIdList,
|
|
48493
|
+
def doCourseSyncParticipants(courseIdList, _):
|
|
48471
48494
|
croom = buildGAPIObject(API.CLASSROOM)
|
|
48472
48495
|
role = getChoice(CLEAR_SYNC_PARTICIPANT_TYPES_MAP, mapChoice=True)
|
|
48473
48496
|
if role == Ent.TEACHER:
|
|
@@ -58203,6 +58226,7 @@ def initCopyMoveOptions(copyCmd):
|
|
|
58203
58226
|
'showPermissionMessages': False,
|
|
58204
58227
|
'sendEmailIfRequired': False,
|
|
58205
58228
|
'useDomainAdminAccess': False,
|
|
58229
|
+
'enforceExpansiveAccess': False,
|
|
58206
58230
|
'copiedShortcutsPointToCopiedFiles': True,
|
|
58207
58231
|
'createShortcutsForNonmovableFiles': False,
|
|
58208
58232
|
'duplicateFiles': DUPLICATE_FILE_OVERWRITE_OLDER,
|
|
@@ -58301,6 +58325,8 @@ def getCopyMoveOptions(myarg, copyMoveOptions):
|
|
|
58301
58325
|
elif myarg == 'mappermissionsdomain':
|
|
58302
58326
|
oldDomain = getString(Cmd.OB_DOMAIN_NAME).lower()
|
|
58303
58327
|
copyMoveOptions['mapPermissionsDomains'][oldDomain] = getString(Cmd.OB_DOMAIN_NAME).lower()
|
|
58328
|
+
elif myarg == 'enforceexpansiveaccess':
|
|
58329
|
+
copyMoveOptions['enforceExpansiveAccess'] = getBoolean()
|
|
58304
58330
|
else:
|
|
58305
58331
|
# Move arguments
|
|
58306
58332
|
if not copyMoveOptions['copyCmd']:
|
|
@@ -58572,6 +58598,9 @@ def _copyPermissions(drive, user, i, count, j, jcount,
|
|
|
58572
58598
|
updateTargetPerms[permissionId].update(updatePerm)
|
|
58573
58599
|
updateTargetPerms[permissionId]['updates'] = updatePerm
|
|
58574
58600
|
copySourcePerms.pop(permissionId)
|
|
58601
|
+
deleteUpdateKwargs = {'useDomainAdminAccess': copyMoveOptions['useDomainAdminAccess']}
|
|
58602
|
+
if entityType != Ent.SHAREDDRIVE:
|
|
58603
|
+
deleteUpdateKwargs['enforceExpansiveAccess'] = copyMoveOptions['enforceExpansiveAccess']
|
|
58575
58604
|
Ind.Increment()
|
|
58576
58605
|
action = Act.Get()
|
|
58577
58606
|
Act.Set(Act.COPY)
|
|
@@ -58590,8 +58619,9 @@ def _copyPermissions(drive, user, i, count, j, jcount,
|
|
|
58590
58619
|
callGAPI(drive.permissions(), 'create',
|
|
58591
58620
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_CREATE_ACL_THROW_REASONS,
|
|
58592
58621
|
# retryReasons=[GAPI.INVALID_SHARING_REQUEST],
|
|
58622
|
+
useDomainAdminAccess=copyMoveOptions['useDomainAdminAccess'],
|
|
58593
58623
|
fileId=newFileId, sendNotificationEmail=sendNotificationEmail, emailMessage=None,
|
|
58594
|
-
body=permission, fields='',
|
|
58624
|
+
body=permission, fields='', supportsAllDrives=True)
|
|
58595
58625
|
if copyMoveOptions['showPermissionMessages']:
|
|
58596
58626
|
entityActionPerformed(kvList, k, kcount)
|
|
58597
58627
|
break
|
|
@@ -58629,7 +58659,8 @@ def _copyPermissions(drive, user, i, count, j, jcount,
|
|
|
58629
58659
|
try:
|
|
58630
58660
|
callGAPI(drive.permissions(), 'delete',
|
|
58631
58661
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_DELETE_ACL_THROW_REASONS+[GAPI.FILE_NEVER_WRITABLE],
|
|
58632
|
-
|
|
58662
|
+
**deleteUpdateKwargs,
|
|
58663
|
+
fileId=newFileId, permissionId=permissionId, supportsAllDrives=True)
|
|
58633
58664
|
if copyMoveOptions['showPermissionMessages']:
|
|
58634
58665
|
entityActionPerformed(kvList, k, kcount)
|
|
58635
58666
|
except (GAPI.notFound, GAPI.permissionNotFound,
|
|
@@ -58654,8 +58685,9 @@ def _copyPermissions(drive, user, i, count, j, jcount,
|
|
|
58654
58685
|
callGAPI(drive.permissions(), 'update',
|
|
58655
58686
|
bailOnInternalError=True,
|
|
58656
58687
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_UPDATE_ACL_THROW_REASONS+[GAPI.FILE_NEVER_WRITABLE],
|
|
58657
|
-
|
|
58658
|
-
|
|
58688
|
+
removeExpiration=removeExpiration,
|
|
58689
|
+
**deleteUpdateKwargs,
|
|
58690
|
+
fileId=newFileId, permissionId=permissionId, body=permission['updates'], supportsAllDrives=True)
|
|
58659
58691
|
if copyMoveOptions['showPermissionMessages']:
|
|
58660
58692
|
entityActionPerformed(kvList, k, kcount)
|
|
58661
58693
|
except (GAPI.notFound, GAPI.permissionNotFound,
|
|
@@ -58929,6 +58961,7 @@ copyReturnItemMap = {
|
|
|
58929
58961
|
# [sendemailifrequired [<Boolean>]]
|
|
58930
58962
|
# [suppressnotselectedmessages [<Boolean>]]
|
|
58931
58963
|
# [verifyorganizer [<Boolean>]]
|
|
58964
|
+
# [enforceexpansiveaccess [<Boolean>]]
|
|
58932
58965
|
def copyDriveFile(users):
|
|
58933
58966
|
def _writeCSVData(user, oldName, oldId, newName, newId, mimeType):
|
|
58934
58967
|
row = {'User': user, fileNameTitle: oldName, 'id': oldId,
|
|
@@ -59656,7 +59689,9 @@ def _updateMoveFilePermissions(drive, user, i, count,
|
|
|
59656
59689
|
try:
|
|
59657
59690
|
callGAPI(drive.permissions(), 'delete',
|
|
59658
59691
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_DELETE_ACL_THROW_REASONS+[GAPI.FILE_NEVER_WRITABLE],
|
|
59659
|
-
|
|
59692
|
+
useDomainAdminAccess=copyMoveOptions['useDomainAdminAccess'],
|
|
59693
|
+
enforceExpansiveAccess=copyMoveOptions['enforceExpansiveAccess'],
|
|
59694
|
+
fileId=fileId, permissionId=permissionId, supportsAllDrives=True)
|
|
59660
59695
|
if copyMoveOptions['showPermissionMessages']:
|
|
59661
59696
|
entityActionPerformed(kvList, k, kcount)
|
|
59662
59697
|
except (GAPI.notFound, GAPI.permissionNotFound,
|
|
@@ -59744,6 +59779,7 @@ def _updateMoveFilePermissions(drive, user, i, count,
|
|
|
59744
59779
|
# [retainsourcefolders [<Boolean>]]
|
|
59745
59780
|
# [sendemailifrequired [<Boolean>]]
|
|
59746
59781
|
# [verifyorganizer [<Boolean>]]
|
|
59782
|
+
# [enforceexpansiveaccess [<Boolean>]]
|
|
59747
59783
|
def moveDriveFile(users):
|
|
59748
59784
|
def _cloneFolderMove(drive, user, i, count, j, jcount,
|
|
59749
59785
|
source, targetChildren, newFolderName, newParentId, newParentName, mergeParentModifiedTime,
|
|
@@ -60087,9 +60123,8 @@ def moveDriveFile(users):
|
|
|
60087
60123
|
parentBody = {}
|
|
60088
60124
|
parentParms = initDriveFileAttributes()
|
|
60089
60125
|
copyMoveOptions = initCopyMoveOptions(False)
|
|
60090
|
-
newParentsSpecified = False
|
|
60126
|
+
newParentsSpecified = updateFilePermissions = False
|
|
60091
60127
|
movedFiles = {}
|
|
60092
|
-
updateFilePermissions = False
|
|
60093
60128
|
verifyOrganizer = True
|
|
60094
60129
|
while Cmd.ArgumentsRemaining():
|
|
60095
60130
|
myarg = getArgument()
|
|
@@ -60978,6 +61013,7 @@ TRANSFER_DRIVEFILE_ACL_ROLES_MAP = {
|
|
|
60978
61013
|
# [nonowner_retainrole reader|commenter|writer|editor|fileorganizer|current|none]
|
|
60979
61014
|
# [nonowner_targetrole reader|commenter|writer|editor|fileorganizer|current|none|source]
|
|
60980
61015
|
# (orderby <DriveFileOrderByFieldName> [ascending|descending])*
|
|
61016
|
+
# [enforceexpansiveaccess [<Boolean>]]
|
|
60981
61017
|
# [preview] [todrive <ToDriveAttribute>*]
|
|
60982
61018
|
def transferDrive(users):
|
|
60983
61019
|
|
|
@@ -61164,6 +61200,7 @@ def transferDrive(users):
|
|
|
61164
61200
|
callGAPI(sourceDrive.permissions(), 'update',
|
|
61165
61201
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.BAD_REQUEST, GAPI.INVALID_OWNERSHIP_TRANSFER,
|
|
61166
61202
|
GAPI.PERMISSION_NOT_FOUND, GAPI.SHARING_RATE_LIMIT_EXCEEDED],
|
|
61203
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
61167
61204
|
fileId=childFileId, permissionId=targetPermissionId,
|
|
61168
61205
|
transferOwnership=True, body={'role': 'owner'}, fields='')
|
|
61169
61206
|
if removeSourceParents:
|
|
@@ -61352,6 +61389,7 @@ def transferDrive(users):
|
|
|
61352
61389
|
if ownerRetainRoleBody['role'] != 'writer':
|
|
61353
61390
|
callGAPI(targetDrive.permissions(), 'update',
|
|
61354
61391
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.PERMISSION_NOT_FOUND, GAPI.BAD_REQUEST, GAPI.SHARING_RATE_LIMIT_EXCEEDED],
|
|
61392
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
61355
61393
|
fileId=childFileId, permissionId=sourcePermissionId, body=ownerRetainRoleBody, fields='')
|
|
61356
61394
|
else:
|
|
61357
61395
|
callGAPI(targetDrive.permissions(), 'delete',
|
|
@@ -61401,6 +61439,7 @@ def transferDrive(users):
|
|
|
61401
61439
|
if nonOwnerRetainRoleBody['role'] != 'current':
|
|
61402
61440
|
callGAPI(ownerDrive.permissions(), 'update',
|
|
61403
61441
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.PERMISSION_NOT_FOUND, GAPI.BAD_REQUEST, GAPI.SHARING_RATE_LIMIT_EXCEEDED],
|
|
61442
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
61404
61443
|
fileId=childFileId, permissionId=sourcePermissionId, body=sourceUpdateRole, fields='')
|
|
61405
61444
|
else:
|
|
61406
61445
|
try:
|
|
@@ -61561,7 +61600,7 @@ def transferDrive(users):
|
|
|
61561
61600
|
targetUserFolderPattern = '#user# old files'
|
|
61562
61601
|
targetUserOrphansFolderPattern = '#user# orphaned files'
|
|
61563
61602
|
targetIds = [None, None]
|
|
61564
|
-
createShortcutsForNonmovableFiles = False
|
|
61603
|
+
createShortcutsForNonmovableFiles = enforceExpansiveAccess = False
|
|
61565
61604
|
mergeWithTarget = False
|
|
61566
61605
|
thirdPartyOwners = {}
|
|
61567
61606
|
skipFileIdEntity = initDriveFileEntity()
|
|
@@ -61579,6 +61618,8 @@ def transferDrive(users):
|
|
|
61579
61618
|
nonOwnerRetainRoleBody['role'] = 'current'
|
|
61580
61619
|
elif myarg == 'nonownertargetrole':
|
|
61581
61620
|
nonOwnerTargetRoleBody['role'] = getChoice(TRANSFER_DRIVEFILE_ACL_ROLES_MAP, mapChoice=True)
|
|
61621
|
+
elif myarg == 'enforceexpansiveaccess':
|
|
61622
|
+
enforceExpansiveAccess = getBoolean()
|
|
61582
61623
|
elif myarg == 'noretentionmessages':
|
|
61583
61624
|
showRetentionMessages = False
|
|
61584
61625
|
elif myarg == 'orderby':
|
|
@@ -61816,6 +61857,7 @@ def getPermissionIdForEmail(user, i, count, email):
|
|
|
61816
61857
|
# [<DriveFileParentAttribute>] [includetrashed] [norecursion [<Boolean>]]
|
|
61817
61858
|
# (orderby <DriveFileOrderByFieldName> [ascending|descending])*
|
|
61818
61859
|
# [preview] [filepath] [pathdelimiter <Character>] [buildtree]
|
|
61860
|
+
# [enforceexpansiveaccess [<Boolean>]]
|
|
61819
61861
|
# [todrive <ToDriveAttribute>*]
|
|
61820
61862
|
def transferOwnership(users):
|
|
61821
61863
|
def _identifyFilesToTransfer(fileEntry):
|
|
@@ -61864,7 +61906,7 @@ def transferOwnership(users):
|
|
|
61864
61906
|
body = {}
|
|
61865
61907
|
newOwner = getEmailAddress()
|
|
61866
61908
|
OBY = OrderBy(DRIVEFILE_ORDERBY_CHOICE_MAP)
|
|
61867
|
-
changeParents = filepath = includeTrashed = noRecursion = False
|
|
61909
|
+
changeParents = enforceExpansiveAccess = filepath = includeTrashed = noRecursion = False
|
|
61868
61910
|
pathDelimiter = '/'
|
|
61869
61911
|
csvPF = fileTree = None
|
|
61870
61912
|
addParents = ''
|
|
@@ -61891,6 +61933,8 @@ def transferOwnership(users):
|
|
|
61891
61933
|
csvPF.GetTodriveParameters()
|
|
61892
61934
|
elif getDriveFileParentAttribute(myarg, parentParms):
|
|
61893
61935
|
changeParents = True
|
|
61936
|
+
elif myarg == 'enforceexpansiveaccess':
|
|
61937
|
+
enforceExpansiveAccess = getBoolean()
|
|
61894
61938
|
else:
|
|
61895
61939
|
unknownArgumentExit()
|
|
61896
61940
|
Act.Set(Act.TRANSFER_OWNERSHIP)
|
|
@@ -62008,6 +62052,7 @@ def transferOwnership(users):
|
|
|
62008
62052
|
Act.Set(action)
|
|
62009
62053
|
callGAPI(drive.permissions(), 'update',
|
|
62010
62054
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.PERMISSION_NOT_FOUND],
|
|
62055
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
62011
62056
|
fileId=xferFileId, permissionId=permissionId, transferOwnership=True, body=body, fields='')
|
|
62012
62057
|
entityModifierNewValueItemValueListActionPerformed(kvList, Act.MODIFIER_TO, None, [Ent.USER, newOwner], k, kcount)
|
|
62013
62058
|
else:
|
|
@@ -62029,6 +62074,7 @@ def transferOwnership(users):
|
|
|
62029
62074
|
fileId=xferFileId, sendNotificationEmail=False, body=bodyAdd, fields='')
|
|
62030
62075
|
callGAPI(drive.permissions(), 'update',
|
|
62031
62076
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.PERMISSION_NOT_FOUND],
|
|
62077
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
62032
62078
|
fileId=xferFileId, permissionId=permissionId, transferOwnership=True, body=body, fields='')
|
|
62033
62079
|
entityModifierNewValueItemValueListActionPerformed(kvList, Act.MODIFIER_TO, None, [Ent.USER, newOwner], k, kcount)
|
|
62034
62080
|
except GAPI.invalidSharingRequest as e:
|
|
@@ -62101,6 +62147,7 @@ def transferOwnership(users):
|
|
|
62101
62147
|
# [keepuser | (retainrole reader|commenter|writer|editor|none)] [noretentionmessages]
|
|
62102
62148
|
# (orderby <DriveFileOrderByFieldName> [ascending|descending])*
|
|
62103
62149
|
# [preview] [filepath] [pathdelimiter <Character>] [buildtree]
|
|
62150
|
+
# [enforceexpansiveaccess [<Boolean>]]
|
|
62104
62151
|
# [todrive <ToDriveAttribute>*]
|
|
62105
62152
|
def claimOwnership(users):
|
|
62106
62153
|
def _identifyFilesToClaim(fileEntry):
|
|
@@ -62161,6 +62208,7 @@ def claimOwnership(users):
|
|
|
62161
62208
|
if sourceRetainRoleBody['role'] != 'writer':
|
|
62162
62209
|
callGAPI(sourceDrive.permissions(), 'update',
|
|
62163
62210
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.PERMISSION_NOT_FOUND, GAPI.BAD_REQUEST],
|
|
62211
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
62164
62212
|
fileId=ofileId, permissionId=oldOwnerPermissionId, body=sourceRetainRoleBody, fields='')
|
|
62165
62213
|
else:
|
|
62166
62214
|
callGAPI(sourceDrive.permissions(), 'delete',
|
|
@@ -62184,7 +62232,7 @@ def claimOwnership(users):
|
|
|
62184
62232
|
onlyOwners = set()
|
|
62185
62233
|
skipOwners = set()
|
|
62186
62234
|
subdomains = []
|
|
62187
|
-
filepath = includeTrashed = False
|
|
62235
|
+
enforceExpansiveAccess = filepath = includeTrashed = False
|
|
62188
62236
|
pathDelimiter = '/'
|
|
62189
62237
|
addParents = ''
|
|
62190
62238
|
parentBody = {}
|
|
@@ -62219,6 +62267,8 @@ def claimOwnership(users):
|
|
|
62219
62267
|
includeTrashed = True
|
|
62220
62268
|
elif myarg == 'orderby':
|
|
62221
62269
|
OBY.GetChoice()
|
|
62270
|
+
elif myarg == 'enforceexpansiveaccess':
|
|
62271
|
+
enforceExpansiveAccess = getBoolean()
|
|
62222
62272
|
elif myarg == 'restricted':
|
|
62223
62273
|
bodyShare['copyRequiresWriterPermission'] = getBoolean()
|
|
62224
62274
|
elif myarg == 'writerscanshare':
|
|
@@ -62389,6 +62439,7 @@ def claimOwnership(users):
|
|
|
62389
62439
|
Act.Set(action)
|
|
62390
62440
|
callGAPI(sourceDrive.permissions(), 'update',
|
|
62391
62441
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.PERMISSION_NOT_FOUND],
|
|
62442
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
62392
62443
|
fileId=xferFileId, permissionId=permissionId, transferOwnership=True, body=body, fields='')
|
|
62393
62444
|
kvList = [Ent.USER, user, entityType, fileDesc]
|
|
62394
62445
|
entityModifierNewValueItemValueListActionPerformed(kvList, Act.MODIFIER_FROM, None, [Ent.USER, oldOwner], l, lcount)
|
|
@@ -62413,6 +62464,7 @@ def claimOwnership(users):
|
|
|
62413
62464
|
fileId=xferFileId, sendNotificationEmail=False, body=bodyAdd, fields='')
|
|
62414
62465
|
callGAPI(sourceDrive.permissions(), 'update',
|
|
62415
62466
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.PERMISSION_NOT_FOUND],
|
|
62467
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
62416
62468
|
fileId=xferFileId, permissionId=permissionId, transferOwnership=True, body=body, fields='')
|
|
62417
62469
|
entityModifierNewValueItemValueListActionPerformed(kvList, Act.MODIFIER_FROM, None, [Ent.USER, oldOwner], l, lcount)
|
|
62418
62470
|
_processRetainedRole(user, i, count, oldOwner, entityType, xferFileId, fileDesc, l, lcount)
|
|
@@ -62949,11 +63001,12 @@ def doCreateDriveFileACL():
|
|
|
62949
63001
|
|
|
62950
63002
|
# gam [<UserTypeEntity>] update drivefileacl <DriveFileEntity> <DriveFilePermissionIDorEmail> [asadmin]
|
|
62951
63003
|
# (role <DriveFileACLRole>) [expiration <Time>] [removeexpiration [<Boolean>]]
|
|
62952
|
-
# [updatesheetprotectedranges
|
|
63004
|
+
# [updatesheetprotectedranges [<Boolean>]] [enforceexpansiveaccess [<Boolean>]]
|
|
62953
63005
|
# [showtitles] [nodetails|(csv [todrive <ToDriveAttribute>*] [formatjson [quotechar <Character>]])]
|
|
62954
63006
|
def updateDriveFileACLs(users, useDomainAdminAccess=False):
|
|
62955
63007
|
fileIdEntity = getDriveFileEntity()
|
|
62956
63008
|
isEmail, permissionId = getPermissionId()
|
|
63009
|
+
enforceExpansiveAccess = None
|
|
62957
63010
|
removeExpiration = showTitles = updateSheetProtectedRanges = False
|
|
62958
63011
|
showDetails = True
|
|
62959
63012
|
csvPF = None
|
|
@@ -62972,6 +63025,8 @@ def updateDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
62972
63025
|
showTitles = True
|
|
62973
63026
|
elif myarg == 'updatesheetprotectedranges':
|
|
62974
63027
|
updateSheetProtectedRanges = getBoolean()
|
|
63028
|
+
elif myarg == 'enforceexpansiveaccess':
|
|
63029
|
+
enforceExpansiveAccess = getBoolean()
|
|
62975
63030
|
elif myarg == 'nodetails':
|
|
62976
63031
|
showDetails = False
|
|
62977
63032
|
elif myarg == 'csv':
|
|
@@ -62989,6 +63044,9 @@ def updateDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
62989
63044
|
_checkFileIdEntityDomainAccess(fileIdEntity, useDomainAdminAccess)
|
|
62990
63045
|
if 'role' not in body:
|
|
62991
63046
|
missingArgumentExit(f'role {formatChoiceList(DRIVEFILE_ACL_ROLES_MAP)}')
|
|
63047
|
+
updateKwargs = {'useDomainAdminAccess': useDomainAdminAccess}
|
|
63048
|
+
if enforceExpansiveAccess is not None:
|
|
63049
|
+
updateKwargs['enforceExpansiveAccess'] = enforceExpansiveAccess
|
|
62992
63050
|
printKeys, timeObjects = _getDriveFileACLPrintKeysTimeObjects()
|
|
62993
63051
|
if csvPF and showTitles:
|
|
62994
63052
|
csvPF.AddTitles(fileNameTitle)
|
|
@@ -63026,7 +63084,7 @@ def updateDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
63026
63084
|
permission = callGAPI(drive.permissions(), 'update',
|
|
63027
63085
|
bailOnInternalError=True,
|
|
63028
63086
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_UPDATE_ACL_THROW_REASONS+[GAPI.FILE_NEVER_WRITABLE],
|
|
63029
|
-
|
|
63087
|
+
**updateKwargs,
|
|
63030
63088
|
fileId=fileId, permissionId=permissionId, removeExpiration=removeExpiration,
|
|
63031
63089
|
transferOwnership=body.get('role', '') == 'owner', body=body, fields='*', supportsAllDrives=True)
|
|
63032
63090
|
if updateSheetProtectedRanges and mimeType == MIMETYPE_GA_SPREADSHEET:
|
|
@@ -63122,7 +63180,7 @@ def createDriveFilePermissions(users, useDomainAdminAccess=False):
|
|
|
63122
63180
|
except ValueError:
|
|
63123
63181
|
return None
|
|
63124
63182
|
|
|
63125
|
-
def _callbackCreatePermission(request_id,
|
|
63183
|
+
def _callbackCreatePermission(request_id, _, exception):
|
|
63126
63184
|
ri = request_id.splitlines()
|
|
63127
63185
|
if int(ri[RI_J]) == 1:
|
|
63128
63186
|
entityPerformActionNumItems([Ent.DRIVE_FILE_OR_FOLDER_ID, ri[RI_ENTITY]], int(ri[RI_JCOUNT]), Ent.PERMITTEE, int(ri[RI_I]), int(ri[RI_COUNT]))
|
|
@@ -63270,11 +63328,12 @@ def doCreatePermissions():
|
|
|
63270
63328
|
createDriveFilePermissions([_getAdminEmail()], True)
|
|
63271
63329
|
|
|
63272
63330
|
# gam [<UserTypeEntity>] delete drivefileacl <DriveFileEntity> <DriveFilePermissionIDorEmail> [asadmin]
|
|
63273
|
-
# [updatesheetprotectedranges [<Boolean>]]
|
|
63331
|
+
# [updatesheetprotectedranges [<Boolean>]] [enforceexpansiveaccess [<Boolean>]]
|
|
63274
63332
|
# [showtitles]
|
|
63275
63333
|
def deleteDriveFileACLs(users, useDomainAdminAccess=False):
|
|
63276
63334
|
fileIdEntity = getDriveFileEntity()
|
|
63277
63335
|
isEmail, permissionId = getPermissionId()
|
|
63336
|
+
enforceExpansiveAccess = None
|
|
63278
63337
|
showTitles = updateSheetProtectedRanges = False
|
|
63279
63338
|
while Cmd.ArgumentsRemaining():
|
|
63280
63339
|
myarg = getArgument()
|
|
@@ -63282,11 +63341,16 @@ def deleteDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
63282
63341
|
showTitles = getBoolean()
|
|
63283
63342
|
elif myarg == 'updatesheetprotectedranges':
|
|
63284
63343
|
updateSheetProtectedRanges = getBoolean()
|
|
63344
|
+
elif myarg == 'enforceexpansiveaccess':
|
|
63345
|
+
enforceExpansiveAccess = getBoolean()
|
|
63285
63346
|
elif myarg in ADMIN_ACCESS_OPTIONS:
|
|
63286
63347
|
useDomainAdminAccess = True
|
|
63287
63348
|
else:
|
|
63288
63349
|
unknownArgumentExit()
|
|
63289
63350
|
_checkFileIdEntityDomainAccess(fileIdEntity, useDomainAdminAccess)
|
|
63351
|
+
deleteKwargs = {'useDomainAdminAccess': useDomainAdminAccess}
|
|
63352
|
+
if enforceExpansiveAccess is not None:
|
|
63353
|
+
deleteKwargs['enforceExpansiveAccess'] = enforceExpansiveAccess
|
|
63290
63354
|
i, count, users = getEntityArgument(users)
|
|
63291
63355
|
for user in users:
|
|
63292
63356
|
i += 1
|
|
@@ -63319,7 +63383,8 @@ def deleteDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
63319
63383
|
break
|
|
63320
63384
|
callGAPI(drive.permissions(), 'delete',
|
|
63321
63385
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_DELETE_ACL_THROW_REASONS+[GAPI.FILE_NEVER_WRITABLE],
|
|
63322
|
-
|
|
63386
|
+
**deleteKwargs,
|
|
63387
|
+
fileId=fileId, permissionId=permissionId, supportsAllDrives=True)
|
|
63323
63388
|
entityActionPerformed([Ent.USER, user, entityType, fileName, Ent.PERMISSION_ID, permissionId], j, jcount)
|
|
63324
63389
|
if updateSheetProtectedRanges and mimeType == MIMETYPE_GA_SPREADSHEET:
|
|
63325
63390
|
_updateSheetProtectedRangesACLchange(sheet, user, i, count, j, jcount, fileId, fileName, False, permission)
|
|
@@ -63341,6 +63406,7 @@ def doDeleteDriveFileACLs():
|
|
|
63341
63406
|
|
|
63342
63407
|
# gam [<UserTypeEntity>] delete permissions <DriveFileEntity> <DriveFilePermissionIDEntity> [asadmin]
|
|
63343
63408
|
# <PermissionMatch>* [<PermissionMatchAction>]
|
|
63409
|
+
# [enforceexpansiveaccess [<Boolean>]]
|
|
63344
63410
|
def deletePermissions(users, useDomainAdminAccess=False):
|
|
63345
63411
|
def convertJSONPermissions(jsonPermissions):
|
|
63346
63412
|
permissionIds = []
|
|
@@ -63350,7 +63416,7 @@ def deletePermissions(users, useDomainAdminAccess=False):
|
|
|
63350
63416
|
permissionIds.append(permission['id'])
|
|
63351
63417
|
return permissionIds
|
|
63352
63418
|
|
|
63353
|
-
def _callbackDeletePermissionId(request_id,
|
|
63419
|
+
def _callbackDeletePermissionId(request_id, _, exception):
|
|
63354
63420
|
ri = request_id.splitlines()
|
|
63355
63421
|
if int(ri[RI_J]) == 1:
|
|
63356
63422
|
entityPerformActionNumItems([Ent.DRIVE_FILE_OR_FOLDER_ID, ri[RI_ENTITY]], int(ri[RI_JCOUNT]), Ent.PERMISSION_ID, int(ri[RI_I]), int(ri[RI_COUNT]))
|
|
@@ -63375,7 +63441,8 @@ def deletePermissions(users, useDomainAdminAccess=False):
|
|
|
63375
63441
|
callGAPI(drive.permissions(), 'delete',
|
|
63376
63442
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_DELETE_ACL_THROW_REASONS,
|
|
63377
63443
|
retryReasons=[GAPI.SERVICE_LIMIT],
|
|
63378
|
-
useDomainAdminAccess=useDomainAdminAccess,
|
|
63444
|
+
useDomainAdminAccess=useDomainAdminAccess, enforceExpansiveAccess=enforceExpansiveAccess,
|
|
63445
|
+
fileId=ri[RI_ENTITY], permissionId=ri[RI_ITEM], supportsAllDrives=True)
|
|
63379
63446
|
entityActionPerformed([Ent.DRIVE_FILE_OR_FOLDER_ID, ri[RI_ENTITY], Ent.PERMISSION_ID, ri[RI_ITEM]], int(ri[RI_J]), int(ri[RI_JCOUNT]))
|
|
63380
63447
|
except (GAPI.fileNotFound, GAPI.forbidden, GAPI.internalError, GAPI.insufficientFilePermissions, GAPI.unknownError,
|
|
63381
63448
|
GAPI.badRequest, GAPI.cannotRemoveOwner, GAPI.cannotModifyInheritedTeamDrivePermission,
|
|
@@ -63395,12 +63462,15 @@ def deletePermissions(users, useDomainAdminAccess=False):
|
|
|
63395
63462
|
jsonData = getJSON([])
|
|
63396
63463
|
PM = PermissionMatch()
|
|
63397
63464
|
PM.SetDefaultMatch(False, {'role': 'owner'})
|
|
63465
|
+
enforceExpansiveAccess = False
|
|
63398
63466
|
while Cmd.ArgumentsRemaining():
|
|
63399
63467
|
myarg = getArgument()
|
|
63400
63468
|
if myarg in ADMIN_ACCESS_OPTIONS:
|
|
63401
63469
|
useDomainAdminAccess = True
|
|
63402
63470
|
elif PM and PM.ProcessArgument(myarg):
|
|
63403
63471
|
pass
|
|
63472
|
+
elif myarg == 'enforceexpansiveaccess':
|
|
63473
|
+
enforceExpansiveAccess = getBoolean()
|
|
63404
63474
|
else:
|
|
63405
63475
|
unknownArgumentExit()
|
|
63406
63476
|
_checkFileIdEntityDomainAccess(fileIdEntity, useDomainAdminAccess)
|
|
@@ -68631,7 +68701,7 @@ def deleteLabels(users, labelEntity):
|
|
|
68631
68701
|
http_status, reason, message = checkGAPIError(exception)
|
|
68632
68702
|
entityActionFailedWarning([Ent.USER, ri[RI_ENTITY], Ent.LABEL, labelIdToNameMap[ri[RI_ITEM]]], formatHTTPError(http_status, reason, message), int(ri[RI_J]), int(ri[RI_JCOUNT]))
|
|
68633
68703
|
|
|
68634
|
-
def _callbackDeleteLabel(request_id,
|
|
68704
|
+
def _callbackDeleteLabel(request_id, _, exception):
|
|
68635
68705
|
ri = request_id.splitlines()
|
|
68636
68706
|
if exception is None:
|
|
68637
68707
|
entityActionPerformed([Ent.USER, ri[RI_ENTITY], Ent.LABEL, labelIdToNameMap[ri[RI_ITEM]]], int(ri[RI_J]), int(ri[RI_JCOUNT]))
|
|
@@ -69232,7 +69302,7 @@ def _processMessagesThreads(users, entityType):
|
|
|
69232
69302
|
GAPI.INVALID_MESSAGE_ID: Msg.INVALID_MESSAGE_ID,
|
|
69233
69303
|
GAPI.FAILED_PRECONDITION: Msg.FAILED_PRECONDITION}
|
|
69234
69304
|
|
|
69235
|
-
def _callbackProcessMessage(request_id,
|
|
69305
|
+
def _callbackProcessMessage(request_id, _, exception):
|
|
69236
69306
|
ri = request_id.splitlines()
|
|
69237
69307
|
if exception is None:
|
|
69238
69308
|
if not csvPF:
|