gam7 7.4.4__py3-none-any.whl → 7.5.1__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 +122 -51
- gam/gamlib/glapi.py +3 -1
- gam/gamlib/glcfg.py +4 -0
- gam/meet-v2beta.json +1152 -0
- {gam7-7.4.4.dist-info → gam7-7.5.1.dist-info}/METADATA +1 -1
- {gam7-7.4.4.dist-info → gam7-7.5.1.dist-info}/RECORD +9 -8
- {gam7-7.4.4.dist-info → gam7-7.5.1.dist-info}/WHEEL +0 -0
- {gam7-7.4.4.dist-info → gam7-7.5.1.dist-info}/entry_points.txt +0 -0
- {gam7-7.4.4.dist-info → gam7-7.5.1.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.01'
|
|
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()
|
|
@@ -29235,6 +29251,7 @@ DEVICE_FIELDS_CHOICE_MAP = {
|
|
|
29235
29251
|
'releaseversion': 'releaseVersion',
|
|
29236
29252
|
'securitypatchtime': 'securityPatchTime',
|
|
29237
29253
|
'serialnumber': 'serialNumber',
|
|
29254
|
+
'unifieddeviceid': 'unifiedDeviceId',
|
|
29238
29255
|
'wifimacaddresses': 'wifiMacAddresses'
|
|
29239
29256
|
}
|
|
29240
29257
|
|
|
@@ -32007,7 +32024,7 @@ def doUpdateGroups():
|
|
|
32007
32024
|
GAPI.INVALID_MEMBER: Msg.INVALID_MEMBER,
|
|
32008
32025
|
GAPI.CYCLIC_MEMBERSHIPS_NOT_ALLOWED: Msg.WOULD_MAKE_MEMBERSHIP_CYCLE}
|
|
32009
32026
|
|
|
32010
|
-
def _callbackAddGroupMembers(request_id,
|
|
32027
|
+
def _callbackAddGroupMembers(request_id, _, exception):
|
|
32011
32028
|
ri = request_id.splitlines()
|
|
32012
32029
|
if exception is None:
|
|
32013
32030
|
_showSuccess(ri[RI_ENTITY], ri[RI_ITEM], ri[RI_ROLE], ri[RI_OPTION], int(ri[RI_J]), int(ri[RI_JCOUNT]))
|
|
@@ -32096,7 +32113,7 @@ def doUpdateGroups():
|
|
|
32096
32113
|
GAPI.CONDITION_NOT_MET: f'{Msg.NOT_A} {Ent.Singular(Ent.MEMBER)}',
|
|
32097
32114
|
GAPI.INVALID_MEMBER: Msg.DOES_NOT_EXIST}
|
|
32098
32115
|
|
|
32099
|
-
def _callbackRemoveGroupMembers(request_id,
|
|
32116
|
+
def _callbackRemoveGroupMembers(request_id, _, exception):
|
|
32100
32117
|
ri = request_id.splitlines()
|
|
32101
32118
|
if exception is None:
|
|
32102
32119
|
_showSuccess(ri[RI_ENTITY], ri[RI_ITEM], ri[RI_ROLE], DELIVERY_SETTINGS_UNDEFINED, int(ri[RI_J]), int(ri[RI_JCOUNT]))
|
|
@@ -32195,7 +32212,7 @@ def doUpdateGroups():
|
|
|
32195
32212
|
except (GAPI.invalidMember, GAPI.resourceNotFound, GAPI.serviceNotAvailable) as e:
|
|
32196
32213
|
_showFailure(group, member, role, str(e), j, jcount)
|
|
32197
32214
|
|
|
32198
|
-
def _callbackUpdateGroupMembers(request_id,
|
|
32215
|
+
def _callbackUpdateGroupMembers(request_id, _, exception):
|
|
32199
32216
|
ri = request_id.splitlines()
|
|
32200
32217
|
if exception is None:
|
|
32201
32218
|
_showSuccess(ri[RI_ENTITY], ri[RI_ITEM], ri[RI_ROLE], ri[RI_OPTION], int(ri[RI_J]), int(ri[RI_JCOUNT]))
|
|
@@ -33432,6 +33449,7 @@ PRINT_GROUPS_JSON_TITLES = ['email', 'JSON']
|
|
|
33432
33449
|
|
|
33433
33450
|
# gam print groups [todrive <ToDriveAttribute>*]
|
|
33434
33451
|
# [([domain|domains <DomainNameEntity>] ([member|showownedby <EmailItem>]|[(query <QueryGroup>)|(queries <QueryUserList>)]))|
|
|
33452
|
+
# (group|group_ns|group_susp <GroupItem>)|
|
|
33435
33453
|
# (select <GroupEntity>)]
|
|
33436
33454
|
# [emailmatchpattern [not] <RegularExpression>] [namematchpattern [not] <RegularExpression>]
|
|
33437
33455
|
# [descriptionmatchpattern [not] <RegularExpression>] (matchsetting [not] <GroupAttribute>)*
|
|
@@ -33644,6 +33662,12 @@ def doPrintGroups():
|
|
|
33644
33662
|
pass
|
|
33645
33663
|
elif getGroupMatchPatterns(myarg, matchPatterns, False):
|
|
33646
33664
|
pass
|
|
33665
|
+
elif myarg in {'group', 'groupns', 'groupsusp'}:
|
|
33666
|
+
entitySelection = [getString(Cmd.OB_EMAIL_ADDRESS)]
|
|
33667
|
+
if myarg == 'groupns':
|
|
33668
|
+
isSuspended = False
|
|
33669
|
+
elif myarg == 'groupsusp':
|
|
33670
|
+
isSuspended = True
|
|
33647
33671
|
elif myarg == 'select':
|
|
33648
33672
|
entitySelection = getEntityList(Cmd.OB_GROUP_ENTITY)
|
|
33649
33673
|
elif myarg in SUSPENDED_ARGUMENTS:
|
|
@@ -42331,7 +42355,7 @@ def doPrintVaultCounts():
|
|
|
42331
42355
|
# gam [<UserTypeEntity>] print siteacls <SiteEntity> [todrive <ToDriveAttribute>*]
|
|
42332
42356
|
# gam [<UserTypeEntity>] print siteactivity <SiteEntity> [todrive <ToDriveAttribute>*]
|
|
42333
42357
|
# [startindex <Number>] [maxresults <Number>] [updated_min <Date>] [updated_max <Date>]
|
|
42334
|
-
def deprecatedUserSites(
|
|
42358
|
+
def deprecatedUserSites(_):
|
|
42335
42359
|
deprecatedCommandExit()
|
|
42336
42360
|
|
|
42337
42361
|
def deprecatedDomainSites():
|
|
@@ -43653,7 +43677,7 @@ def waitForMailbox(entityList):
|
|
|
43653
43677
|
Ind.Decrement()
|
|
43654
43678
|
|
|
43655
43679
|
def getUserLicenses(lic, user, skus):
|
|
43656
|
-
def _callbackGetLicense(
|
|
43680
|
+
def _callbackGetLicense(_, response, exception):
|
|
43657
43681
|
if exception is None:
|
|
43658
43682
|
if response and 'skuId' in response:
|
|
43659
43683
|
licenses.append(response['skuId'])
|
|
@@ -48159,7 +48183,7 @@ def _batchAddItemsToCourse(croom, courseId, i, count, addParticipants, role):
|
|
|
48159
48183
|
_ADD_PART_REASON_TO_MESSAGE_MAP = {GAPI.NOT_FOUND: Msg.DOES_NOT_EXIST,
|
|
48160
48184
|
GAPI.ALREADY_EXISTS: Msg.DUPLICATE,
|
|
48161
48185
|
GAPI.FAILED_PRECONDITION: Msg.NOT_ALLOWED}
|
|
48162
|
-
def _callbackAddItemsToCourse(request_id,
|
|
48186
|
+
def _callbackAddItemsToCourse(request_id, _, exception):
|
|
48163
48187
|
ri = request_id.splitlines()
|
|
48164
48188
|
if exception is None:
|
|
48165
48189
|
entityActionPerformed([Ent.COURSE, ri[RI_ENTITY], ri[RI_ROLE], ri[RI_ITEM]], int(ri[RI_J]), int(ri[RI_JCOUNT]))
|
|
@@ -48239,7 +48263,7 @@ def _batchRemoveItemsFromCourse(croom, courseId, i, count, removeParticipants, r
|
|
|
48239
48263
|
_REMOVE_PART_REASON_TO_MESSAGE_MAP = {GAPI.NOT_FOUND: Msg.DOES_NOT_EXIST,
|
|
48240
48264
|
GAPI.FORBIDDEN: Msg.FORBIDDEN,
|
|
48241
48265
|
GAPI.PERMISSION_DENIED: Msg.PERMISSION_DENIED}
|
|
48242
|
-
def _callbackRemoveItemsFromCourse(request_id,
|
|
48266
|
+
def _callbackRemoveItemsFromCourse(request_id, _, exception):
|
|
48243
48267
|
ri = request_id.splitlines()
|
|
48244
48268
|
if exception is None:
|
|
48245
48269
|
entityActionPerformed([Ent.COURSE, ri[RI_ENTITY], ri[RI_ROLE], ri[RI_ITEM]], int(ri[RI_J]), int(ri[RI_JCOUNT]))
|
|
@@ -48451,7 +48475,7 @@ def doCourseRemoveItems(courseIdList, getEntityListArg):
|
|
|
48451
48475
|
|
|
48452
48476
|
# gam courses <CourseEntity> clear teachers|students
|
|
48453
48477
|
# gam course <CourseID> clear teacher|student
|
|
48454
|
-
def doCourseClearParticipants(courseIdList,
|
|
48478
|
+
def doCourseClearParticipants(courseIdList, _):
|
|
48455
48479
|
croom = buildGAPIObject(API.CLASSROOM)
|
|
48456
48480
|
role = getChoice(CLEAR_SYNC_PARTICIPANT_TYPES_MAP, mapChoice=True)
|
|
48457
48481
|
checkForExtraneousArguments()
|
|
@@ -48467,7 +48491,7 @@ def doCourseClearParticipants(courseIdList, getEntityListArg):
|
|
|
48467
48491
|
# gam course <CourseID> sync students [addonly|removeonly] <UserTypeEntity>
|
|
48468
48492
|
# gam courses <CourseEntity> sync teachers [addonly|removeonly] [makefirstteacherowner] <UserTypeEntity>
|
|
48469
48493
|
# gam course <CourseID> sync teachers [addonly|removeonly] [makefirstteacherowner] <UserTypeEntity>
|
|
48470
|
-
def doCourseSyncParticipants(courseIdList,
|
|
48494
|
+
def doCourseSyncParticipants(courseIdList, _):
|
|
48471
48495
|
croom = buildGAPIObject(API.CLASSROOM)
|
|
48472
48496
|
role = getChoice(CLEAR_SYNC_PARTICIPANT_TYPES_MAP, mapChoice=True)
|
|
48473
48497
|
if role == Ent.TEACHER:
|
|
@@ -58203,6 +58227,7 @@ def initCopyMoveOptions(copyCmd):
|
|
|
58203
58227
|
'showPermissionMessages': False,
|
|
58204
58228
|
'sendEmailIfRequired': False,
|
|
58205
58229
|
'useDomainAdminAccess': False,
|
|
58230
|
+
'enforceExpansiveAccess': False,
|
|
58206
58231
|
'copiedShortcutsPointToCopiedFiles': True,
|
|
58207
58232
|
'createShortcutsForNonmovableFiles': False,
|
|
58208
58233
|
'duplicateFiles': DUPLICATE_FILE_OVERWRITE_OLDER,
|
|
@@ -58301,6 +58326,8 @@ def getCopyMoveOptions(myarg, copyMoveOptions):
|
|
|
58301
58326
|
elif myarg == 'mappermissionsdomain':
|
|
58302
58327
|
oldDomain = getString(Cmd.OB_DOMAIN_NAME).lower()
|
|
58303
58328
|
copyMoveOptions['mapPermissionsDomains'][oldDomain] = getString(Cmd.OB_DOMAIN_NAME).lower()
|
|
58329
|
+
elif myarg == 'enforceexpansiveaccess':
|
|
58330
|
+
copyMoveOptions['enforceExpansiveAccess'] = getBoolean()
|
|
58304
58331
|
else:
|
|
58305
58332
|
# Move arguments
|
|
58306
58333
|
if not copyMoveOptions['copyCmd']:
|
|
@@ -58572,6 +58599,9 @@ def _copyPermissions(drive, user, i, count, j, jcount,
|
|
|
58572
58599
|
updateTargetPerms[permissionId].update(updatePerm)
|
|
58573
58600
|
updateTargetPerms[permissionId]['updates'] = updatePerm
|
|
58574
58601
|
copySourcePerms.pop(permissionId)
|
|
58602
|
+
deleteUpdateKwargs = {'useDomainAdminAccess': copyMoveOptions['useDomainAdminAccess']}
|
|
58603
|
+
if entityType != Ent.SHAREDDRIVE:
|
|
58604
|
+
deleteUpdateKwargs['enforceExpansiveAccess'] = copyMoveOptions['enforceExpansiveAccess']
|
|
58575
58605
|
Ind.Increment()
|
|
58576
58606
|
action = Act.Get()
|
|
58577
58607
|
Act.Set(Act.COPY)
|
|
@@ -58590,8 +58620,9 @@ def _copyPermissions(drive, user, i, count, j, jcount,
|
|
|
58590
58620
|
callGAPI(drive.permissions(), 'create',
|
|
58591
58621
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_CREATE_ACL_THROW_REASONS,
|
|
58592
58622
|
# retryReasons=[GAPI.INVALID_SHARING_REQUEST],
|
|
58623
|
+
useDomainAdminAccess=copyMoveOptions['useDomainAdminAccess'],
|
|
58593
58624
|
fileId=newFileId, sendNotificationEmail=sendNotificationEmail, emailMessage=None,
|
|
58594
|
-
body=permission, fields='',
|
|
58625
|
+
body=permission, fields='', supportsAllDrives=True)
|
|
58595
58626
|
if copyMoveOptions['showPermissionMessages']:
|
|
58596
58627
|
entityActionPerformed(kvList, k, kcount)
|
|
58597
58628
|
break
|
|
@@ -58629,7 +58660,8 @@ def _copyPermissions(drive, user, i, count, j, jcount,
|
|
|
58629
58660
|
try:
|
|
58630
58661
|
callGAPI(drive.permissions(), 'delete',
|
|
58631
58662
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_DELETE_ACL_THROW_REASONS+[GAPI.FILE_NEVER_WRITABLE],
|
|
58632
|
-
|
|
58663
|
+
**deleteUpdateKwargs,
|
|
58664
|
+
fileId=newFileId, permissionId=permissionId, supportsAllDrives=True)
|
|
58633
58665
|
if copyMoveOptions['showPermissionMessages']:
|
|
58634
58666
|
entityActionPerformed(kvList, k, kcount)
|
|
58635
58667
|
except (GAPI.notFound, GAPI.permissionNotFound,
|
|
@@ -58654,8 +58686,9 @@ def _copyPermissions(drive, user, i, count, j, jcount,
|
|
|
58654
58686
|
callGAPI(drive.permissions(), 'update',
|
|
58655
58687
|
bailOnInternalError=True,
|
|
58656
58688
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_UPDATE_ACL_THROW_REASONS+[GAPI.FILE_NEVER_WRITABLE],
|
|
58657
|
-
|
|
58658
|
-
|
|
58689
|
+
removeExpiration=removeExpiration,
|
|
58690
|
+
**deleteUpdateKwargs,
|
|
58691
|
+
fileId=newFileId, permissionId=permissionId, body=permission['updates'], supportsAllDrives=True)
|
|
58659
58692
|
if copyMoveOptions['showPermissionMessages']:
|
|
58660
58693
|
entityActionPerformed(kvList, k, kcount)
|
|
58661
58694
|
except (GAPI.notFound, GAPI.permissionNotFound,
|
|
@@ -58929,6 +58962,7 @@ copyReturnItemMap = {
|
|
|
58929
58962
|
# [sendemailifrequired [<Boolean>]]
|
|
58930
58963
|
# [suppressnotselectedmessages [<Boolean>]]
|
|
58931
58964
|
# [verifyorganizer [<Boolean>]]
|
|
58965
|
+
# [enforceexpansiveaccess [<Boolean>]]
|
|
58932
58966
|
def copyDriveFile(users):
|
|
58933
58967
|
def _writeCSVData(user, oldName, oldId, newName, newId, mimeType):
|
|
58934
58968
|
row = {'User': user, fileNameTitle: oldName, 'id': oldId,
|
|
@@ -59656,7 +59690,9 @@ def _updateMoveFilePermissions(drive, user, i, count,
|
|
|
59656
59690
|
try:
|
|
59657
59691
|
callGAPI(drive.permissions(), 'delete',
|
|
59658
59692
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_DELETE_ACL_THROW_REASONS+[GAPI.FILE_NEVER_WRITABLE],
|
|
59659
|
-
|
|
59693
|
+
useDomainAdminAccess=copyMoveOptions['useDomainAdminAccess'],
|
|
59694
|
+
enforceExpansiveAccess=copyMoveOptions['enforceExpansiveAccess'],
|
|
59695
|
+
fileId=fileId, permissionId=permissionId, supportsAllDrives=True)
|
|
59660
59696
|
if copyMoveOptions['showPermissionMessages']:
|
|
59661
59697
|
entityActionPerformed(kvList, k, kcount)
|
|
59662
59698
|
except (GAPI.notFound, GAPI.permissionNotFound,
|
|
@@ -59744,6 +59780,7 @@ def _updateMoveFilePermissions(drive, user, i, count,
|
|
|
59744
59780
|
# [retainsourcefolders [<Boolean>]]
|
|
59745
59781
|
# [sendemailifrequired [<Boolean>]]
|
|
59746
59782
|
# [verifyorganizer [<Boolean>]]
|
|
59783
|
+
# [enforceexpansiveaccess [<Boolean>]]
|
|
59747
59784
|
def moveDriveFile(users):
|
|
59748
59785
|
def _cloneFolderMove(drive, user, i, count, j, jcount,
|
|
59749
59786
|
source, targetChildren, newFolderName, newParentId, newParentName, mergeParentModifiedTime,
|
|
@@ -60087,9 +60124,8 @@ def moveDriveFile(users):
|
|
|
60087
60124
|
parentBody = {}
|
|
60088
60125
|
parentParms = initDriveFileAttributes()
|
|
60089
60126
|
copyMoveOptions = initCopyMoveOptions(False)
|
|
60090
|
-
newParentsSpecified = False
|
|
60127
|
+
newParentsSpecified = updateFilePermissions = False
|
|
60091
60128
|
movedFiles = {}
|
|
60092
|
-
updateFilePermissions = False
|
|
60093
60129
|
verifyOrganizer = True
|
|
60094
60130
|
while Cmd.ArgumentsRemaining():
|
|
60095
60131
|
myarg = getArgument()
|
|
@@ -60978,6 +61014,7 @@ TRANSFER_DRIVEFILE_ACL_ROLES_MAP = {
|
|
|
60978
61014
|
# [nonowner_retainrole reader|commenter|writer|editor|fileorganizer|current|none]
|
|
60979
61015
|
# [nonowner_targetrole reader|commenter|writer|editor|fileorganizer|current|none|source]
|
|
60980
61016
|
# (orderby <DriveFileOrderByFieldName> [ascending|descending])*
|
|
61017
|
+
# [enforceexpansiveaccess [<Boolean>]]
|
|
60981
61018
|
# [preview] [todrive <ToDriveAttribute>*]
|
|
60982
61019
|
def transferDrive(users):
|
|
60983
61020
|
|
|
@@ -61164,6 +61201,7 @@ def transferDrive(users):
|
|
|
61164
61201
|
callGAPI(sourceDrive.permissions(), 'update',
|
|
61165
61202
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.BAD_REQUEST, GAPI.INVALID_OWNERSHIP_TRANSFER,
|
|
61166
61203
|
GAPI.PERMISSION_NOT_FOUND, GAPI.SHARING_RATE_LIMIT_EXCEEDED],
|
|
61204
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
61167
61205
|
fileId=childFileId, permissionId=targetPermissionId,
|
|
61168
61206
|
transferOwnership=True, body={'role': 'owner'}, fields='')
|
|
61169
61207
|
if removeSourceParents:
|
|
@@ -61352,6 +61390,7 @@ def transferDrive(users):
|
|
|
61352
61390
|
if ownerRetainRoleBody['role'] != 'writer':
|
|
61353
61391
|
callGAPI(targetDrive.permissions(), 'update',
|
|
61354
61392
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.PERMISSION_NOT_FOUND, GAPI.BAD_REQUEST, GAPI.SHARING_RATE_LIMIT_EXCEEDED],
|
|
61393
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
61355
61394
|
fileId=childFileId, permissionId=sourcePermissionId, body=ownerRetainRoleBody, fields='')
|
|
61356
61395
|
else:
|
|
61357
61396
|
callGAPI(targetDrive.permissions(), 'delete',
|
|
@@ -61401,6 +61440,7 @@ def transferDrive(users):
|
|
|
61401
61440
|
if nonOwnerRetainRoleBody['role'] != 'current':
|
|
61402
61441
|
callGAPI(ownerDrive.permissions(), 'update',
|
|
61403
61442
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.PERMISSION_NOT_FOUND, GAPI.BAD_REQUEST, GAPI.SHARING_RATE_LIMIT_EXCEEDED],
|
|
61443
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
61404
61444
|
fileId=childFileId, permissionId=sourcePermissionId, body=sourceUpdateRole, fields='')
|
|
61405
61445
|
else:
|
|
61406
61446
|
try:
|
|
@@ -61561,7 +61601,7 @@ def transferDrive(users):
|
|
|
61561
61601
|
targetUserFolderPattern = '#user# old files'
|
|
61562
61602
|
targetUserOrphansFolderPattern = '#user# orphaned files'
|
|
61563
61603
|
targetIds = [None, None]
|
|
61564
|
-
createShortcutsForNonmovableFiles = False
|
|
61604
|
+
createShortcutsForNonmovableFiles = enforceExpansiveAccess = False
|
|
61565
61605
|
mergeWithTarget = False
|
|
61566
61606
|
thirdPartyOwners = {}
|
|
61567
61607
|
skipFileIdEntity = initDriveFileEntity()
|
|
@@ -61579,6 +61619,8 @@ def transferDrive(users):
|
|
|
61579
61619
|
nonOwnerRetainRoleBody['role'] = 'current'
|
|
61580
61620
|
elif myarg == 'nonownertargetrole':
|
|
61581
61621
|
nonOwnerTargetRoleBody['role'] = getChoice(TRANSFER_DRIVEFILE_ACL_ROLES_MAP, mapChoice=True)
|
|
61622
|
+
elif myarg == 'enforceexpansiveaccess':
|
|
61623
|
+
enforceExpansiveAccess = getBoolean()
|
|
61582
61624
|
elif myarg == 'noretentionmessages':
|
|
61583
61625
|
showRetentionMessages = False
|
|
61584
61626
|
elif myarg == 'orderby':
|
|
@@ -61816,6 +61858,7 @@ def getPermissionIdForEmail(user, i, count, email):
|
|
|
61816
61858
|
# [<DriveFileParentAttribute>] [includetrashed] [norecursion [<Boolean>]]
|
|
61817
61859
|
# (orderby <DriveFileOrderByFieldName> [ascending|descending])*
|
|
61818
61860
|
# [preview] [filepath] [pathdelimiter <Character>] [buildtree]
|
|
61861
|
+
# [enforceexpansiveaccess [<Boolean>]]
|
|
61819
61862
|
# [todrive <ToDriveAttribute>*]
|
|
61820
61863
|
def transferOwnership(users):
|
|
61821
61864
|
def _identifyFilesToTransfer(fileEntry):
|
|
@@ -61864,7 +61907,7 @@ def transferOwnership(users):
|
|
|
61864
61907
|
body = {}
|
|
61865
61908
|
newOwner = getEmailAddress()
|
|
61866
61909
|
OBY = OrderBy(DRIVEFILE_ORDERBY_CHOICE_MAP)
|
|
61867
|
-
changeParents = filepath = includeTrashed = noRecursion = False
|
|
61910
|
+
changeParents = enforceExpansiveAccess = filepath = includeTrashed = noRecursion = False
|
|
61868
61911
|
pathDelimiter = '/'
|
|
61869
61912
|
csvPF = fileTree = None
|
|
61870
61913
|
addParents = ''
|
|
@@ -61891,6 +61934,8 @@ def transferOwnership(users):
|
|
|
61891
61934
|
csvPF.GetTodriveParameters()
|
|
61892
61935
|
elif getDriveFileParentAttribute(myarg, parentParms):
|
|
61893
61936
|
changeParents = True
|
|
61937
|
+
elif myarg == 'enforceexpansiveaccess':
|
|
61938
|
+
enforceExpansiveAccess = getBoolean()
|
|
61894
61939
|
else:
|
|
61895
61940
|
unknownArgumentExit()
|
|
61896
61941
|
Act.Set(Act.TRANSFER_OWNERSHIP)
|
|
@@ -62008,6 +62053,7 @@ def transferOwnership(users):
|
|
|
62008
62053
|
Act.Set(action)
|
|
62009
62054
|
callGAPI(drive.permissions(), 'update',
|
|
62010
62055
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.PERMISSION_NOT_FOUND],
|
|
62056
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
62011
62057
|
fileId=xferFileId, permissionId=permissionId, transferOwnership=True, body=body, fields='')
|
|
62012
62058
|
entityModifierNewValueItemValueListActionPerformed(kvList, Act.MODIFIER_TO, None, [Ent.USER, newOwner], k, kcount)
|
|
62013
62059
|
else:
|
|
@@ -62029,6 +62075,7 @@ def transferOwnership(users):
|
|
|
62029
62075
|
fileId=xferFileId, sendNotificationEmail=False, body=bodyAdd, fields='')
|
|
62030
62076
|
callGAPI(drive.permissions(), 'update',
|
|
62031
62077
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.PERMISSION_NOT_FOUND],
|
|
62078
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
62032
62079
|
fileId=xferFileId, permissionId=permissionId, transferOwnership=True, body=body, fields='')
|
|
62033
62080
|
entityModifierNewValueItemValueListActionPerformed(kvList, Act.MODIFIER_TO, None, [Ent.USER, newOwner], k, kcount)
|
|
62034
62081
|
except GAPI.invalidSharingRequest as e:
|
|
@@ -62101,6 +62148,7 @@ def transferOwnership(users):
|
|
|
62101
62148
|
# [keepuser | (retainrole reader|commenter|writer|editor|none)] [noretentionmessages]
|
|
62102
62149
|
# (orderby <DriveFileOrderByFieldName> [ascending|descending])*
|
|
62103
62150
|
# [preview] [filepath] [pathdelimiter <Character>] [buildtree]
|
|
62151
|
+
# [enforceexpansiveaccess [<Boolean>]]
|
|
62104
62152
|
# [todrive <ToDriveAttribute>*]
|
|
62105
62153
|
def claimOwnership(users):
|
|
62106
62154
|
def _identifyFilesToClaim(fileEntry):
|
|
@@ -62161,6 +62209,7 @@ def claimOwnership(users):
|
|
|
62161
62209
|
if sourceRetainRoleBody['role'] != 'writer':
|
|
62162
62210
|
callGAPI(sourceDrive.permissions(), 'update',
|
|
62163
62211
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.PERMISSION_NOT_FOUND, GAPI.BAD_REQUEST],
|
|
62212
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
62164
62213
|
fileId=ofileId, permissionId=oldOwnerPermissionId, body=sourceRetainRoleBody, fields='')
|
|
62165
62214
|
else:
|
|
62166
62215
|
callGAPI(sourceDrive.permissions(), 'delete',
|
|
@@ -62184,7 +62233,7 @@ def claimOwnership(users):
|
|
|
62184
62233
|
onlyOwners = set()
|
|
62185
62234
|
skipOwners = set()
|
|
62186
62235
|
subdomains = []
|
|
62187
|
-
filepath = includeTrashed = False
|
|
62236
|
+
enforceExpansiveAccess = filepath = includeTrashed = False
|
|
62188
62237
|
pathDelimiter = '/'
|
|
62189
62238
|
addParents = ''
|
|
62190
62239
|
parentBody = {}
|
|
@@ -62219,6 +62268,8 @@ def claimOwnership(users):
|
|
|
62219
62268
|
includeTrashed = True
|
|
62220
62269
|
elif myarg == 'orderby':
|
|
62221
62270
|
OBY.GetChoice()
|
|
62271
|
+
elif myarg == 'enforceexpansiveaccess':
|
|
62272
|
+
enforceExpansiveAccess = getBoolean()
|
|
62222
62273
|
elif myarg == 'restricted':
|
|
62223
62274
|
bodyShare['copyRequiresWriterPermission'] = getBoolean()
|
|
62224
62275
|
elif myarg == 'writerscanshare':
|
|
@@ -62389,6 +62440,7 @@ def claimOwnership(users):
|
|
|
62389
62440
|
Act.Set(action)
|
|
62390
62441
|
callGAPI(sourceDrive.permissions(), 'update',
|
|
62391
62442
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.PERMISSION_NOT_FOUND],
|
|
62443
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
62392
62444
|
fileId=xferFileId, permissionId=permissionId, transferOwnership=True, body=body, fields='')
|
|
62393
62445
|
kvList = [Ent.USER, user, entityType, fileDesc]
|
|
62394
62446
|
entityModifierNewValueItemValueListActionPerformed(kvList, Act.MODIFIER_FROM, None, [Ent.USER, oldOwner], l, lcount)
|
|
@@ -62413,6 +62465,7 @@ def claimOwnership(users):
|
|
|
62413
62465
|
fileId=xferFileId, sendNotificationEmail=False, body=bodyAdd, fields='')
|
|
62414
62466
|
callGAPI(sourceDrive.permissions(), 'update',
|
|
62415
62467
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+[GAPI.PERMISSION_NOT_FOUND],
|
|
62468
|
+
enforceExpansiveAccess=enforceExpansiveAccess,
|
|
62416
62469
|
fileId=xferFileId, permissionId=permissionId, transferOwnership=True, body=body, fields='')
|
|
62417
62470
|
entityModifierNewValueItemValueListActionPerformed(kvList, Act.MODIFIER_FROM, None, [Ent.USER, oldOwner], l, lcount)
|
|
62418
62471
|
_processRetainedRole(user, i, count, oldOwner, entityType, xferFileId, fileDesc, l, lcount)
|
|
@@ -62949,11 +63002,12 @@ def doCreateDriveFileACL():
|
|
|
62949
63002
|
|
|
62950
63003
|
# gam [<UserTypeEntity>] update drivefileacl <DriveFileEntity> <DriveFilePermissionIDorEmail> [asadmin]
|
|
62951
63004
|
# (role <DriveFileACLRole>) [expiration <Time>] [removeexpiration [<Boolean>]]
|
|
62952
|
-
# [updatesheetprotectedranges
|
|
63005
|
+
# [updatesheetprotectedranges [<Boolean>]] [enforceexpansiveaccess [<Boolean>]]
|
|
62953
63006
|
# [showtitles] [nodetails|(csv [todrive <ToDriveAttribute>*] [formatjson [quotechar <Character>]])]
|
|
62954
63007
|
def updateDriveFileACLs(users, useDomainAdminAccess=False):
|
|
62955
63008
|
fileIdEntity = getDriveFileEntity()
|
|
62956
63009
|
isEmail, permissionId = getPermissionId()
|
|
63010
|
+
enforceExpansiveAccess = None
|
|
62957
63011
|
removeExpiration = showTitles = updateSheetProtectedRanges = False
|
|
62958
63012
|
showDetails = True
|
|
62959
63013
|
csvPF = None
|
|
@@ -62972,6 +63026,8 @@ def updateDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
62972
63026
|
showTitles = True
|
|
62973
63027
|
elif myarg == 'updatesheetprotectedranges':
|
|
62974
63028
|
updateSheetProtectedRanges = getBoolean()
|
|
63029
|
+
elif myarg == 'enforceexpansiveaccess':
|
|
63030
|
+
enforceExpansiveAccess = getBoolean()
|
|
62975
63031
|
elif myarg == 'nodetails':
|
|
62976
63032
|
showDetails = False
|
|
62977
63033
|
elif myarg == 'csv':
|
|
@@ -62989,6 +63045,9 @@ def updateDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
62989
63045
|
_checkFileIdEntityDomainAccess(fileIdEntity, useDomainAdminAccess)
|
|
62990
63046
|
if 'role' not in body:
|
|
62991
63047
|
missingArgumentExit(f'role {formatChoiceList(DRIVEFILE_ACL_ROLES_MAP)}')
|
|
63048
|
+
updateKwargs = {'useDomainAdminAccess': useDomainAdminAccess}
|
|
63049
|
+
if enforceExpansiveAccess is not None:
|
|
63050
|
+
updateKwargs['enforceExpansiveAccess'] = enforceExpansiveAccess
|
|
62992
63051
|
printKeys, timeObjects = _getDriveFileACLPrintKeysTimeObjects()
|
|
62993
63052
|
if csvPF and showTitles:
|
|
62994
63053
|
csvPF.AddTitles(fileNameTitle)
|
|
@@ -63026,7 +63085,7 @@ def updateDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
63026
63085
|
permission = callGAPI(drive.permissions(), 'update',
|
|
63027
63086
|
bailOnInternalError=True,
|
|
63028
63087
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_UPDATE_ACL_THROW_REASONS+[GAPI.FILE_NEVER_WRITABLE],
|
|
63029
|
-
|
|
63088
|
+
**updateKwargs,
|
|
63030
63089
|
fileId=fileId, permissionId=permissionId, removeExpiration=removeExpiration,
|
|
63031
63090
|
transferOwnership=body.get('role', '') == 'owner', body=body, fields='*', supportsAllDrives=True)
|
|
63032
63091
|
if updateSheetProtectedRanges and mimeType == MIMETYPE_GA_SPREADSHEET:
|
|
@@ -63122,7 +63181,7 @@ def createDriveFilePermissions(users, useDomainAdminAccess=False):
|
|
|
63122
63181
|
except ValueError:
|
|
63123
63182
|
return None
|
|
63124
63183
|
|
|
63125
|
-
def _callbackCreatePermission(request_id,
|
|
63184
|
+
def _callbackCreatePermission(request_id, _, exception):
|
|
63126
63185
|
ri = request_id.splitlines()
|
|
63127
63186
|
if int(ri[RI_J]) == 1:
|
|
63128
63187
|
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 +63329,12 @@ def doCreatePermissions():
|
|
|
63270
63329
|
createDriveFilePermissions([_getAdminEmail()], True)
|
|
63271
63330
|
|
|
63272
63331
|
# gam [<UserTypeEntity>] delete drivefileacl <DriveFileEntity> <DriveFilePermissionIDorEmail> [asadmin]
|
|
63273
|
-
# [updatesheetprotectedranges [<Boolean>]]
|
|
63332
|
+
# [updatesheetprotectedranges [<Boolean>]] [enforceexpansiveaccess [<Boolean>]]
|
|
63274
63333
|
# [showtitles]
|
|
63275
63334
|
def deleteDriveFileACLs(users, useDomainAdminAccess=False):
|
|
63276
63335
|
fileIdEntity = getDriveFileEntity()
|
|
63277
63336
|
isEmail, permissionId = getPermissionId()
|
|
63337
|
+
enforceExpansiveAccess = None
|
|
63278
63338
|
showTitles = updateSheetProtectedRanges = False
|
|
63279
63339
|
while Cmd.ArgumentsRemaining():
|
|
63280
63340
|
myarg = getArgument()
|
|
@@ -63282,11 +63342,16 @@ def deleteDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
63282
63342
|
showTitles = getBoolean()
|
|
63283
63343
|
elif myarg == 'updatesheetprotectedranges':
|
|
63284
63344
|
updateSheetProtectedRanges = getBoolean()
|
|
63345
|
+
elif myarg == 'enforceexpansiveaccess':
|
|
63346
|
+
enforceExpansiveAccess = getBoolean()
|
|
63285
63347
|
elif myarg in ADMIN_ACCESS_OPTIONS:
|
|
63286
63348
|
useDomainAdminAccess = True
|
|
63287
63349
|
else:
|
|
63288
63350
|
unknownArgumentExit()
|
|
63289
63351
|
_checkFileIdEntityDomainAccess(fileIdEntity, useDomainAdminAccess)
|
|
63352
|
+
deleteKwargs = {'useDomainAdminAccess': useDomainAdminAccess}
|
|
63353
|
+
if enforceExpansiveAccess is not None:
|
|
63354
|
+
deleteKwargs['enforceExpansiveAccess'] = enforceExpansiveAccess
|
|
63290
63355
|
i, count, users = getEntityArgument(users)
|
|
63291
63356
|
for user in users:
|
|
63292
63357
|
i += 1
|
|
@@ -63319,7 +63384,8 @@ def deleteDriveFileACLs(users, useDomainAdminAccess=False):
|
|
|
63319
63384
|
break
|
|
63320
63385
|
callGAPI(drive.permissions(), 'delete',
|
|
63321
63386
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_DELETE_ACL_THROW_REASONS+[GAPI.FILE_NEVER_WRITABLE],
|
|
63322
|
-
|
|
63387
|
+
**deleteKwargs,
|
|
63388
|
+
fileId=fileId, permissionId=permissionId, supportsAllDrives=True)
|
|
63323
63389
|
entityActionPerformed([Ent.USER, user, entityType, fileName, Ent.PERMISSION_ID, permissionId], j, jcount)
|
|
63324
63390
|
if updateSheetProtectedRanges and mimeType == MIMETYPE_GA_SPREADSHEET:
|
|
63325
63391
|
_updateSheetProtectedRangesACLchange(sheet, user, i, count, j, jcount, fileId, fileName, False, permission)
|
|
@@ -63341,6 +63407,7 @@ def doDeleteDriveFileACLs():
|
|
|
63341
63407
|
|
|
63342
63408
|
# gam [<UserTypeEntity>] delete permissions <DriveFileEntity> <DriveFilePermissionIDEntity> [asadmin]
|
|
63343
63409
|
# <PermissionMatch>* [<PermissionMatchAction>]
|
|
63410
|
+
# [enforceexpansiveaccess [<Boolean>]]
|
|
63344
63411
|
def deletePermissions(users, useDomainAdminAccess=False):
|
|
63345
63412
|
def convertJSONPermissions(jsonPermissions):
|
|
63346
63413
|
permissionIds = []
|
|
@@ -63350,7 +63417,7 @@ def deletePermissions(users, useDomainAdminAccess=False):
|
|
|
63350
63417
|
permissionIds.append(permission['id'])
|
|
63351
63418
|
return permissionIds
|
|
63352
63419
|
|
|
63353
|
-
def _callbackDeletePermissionId(request_id,
|
|
63420
|
+
def _callbackDeletePermissionId(request_id, _, exception):
|
|
63354
63421
|
ri = request_id.splitlines()
|
|
63355
63422
|
if int(ri[RI_J]) == 1:
|
|
63356
63423
|
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 +63442,8 @@ def deletePermissions(users, useDomainAdminAccess=False):
|
|
|
63375
63442
|
callGAPI(drive.permissions(), 'delete',
|
|
63376
63443
|
throwReasons=GAPI.DRIVE_ACCESS_THROW_REASONS+GAPI.DRIVE3_DELETE_ACL_THROW_REASONS,
|
|
63377
63444
|
retryReasons=[GAPI.SERVICE_LIMIT],
|
|
63378
|
-
useDomainAdminAccess=useDomainAdminAccess,
|
|
63445
|
+
useDomainAdminAccess=useDomainAdminAccess, enforceExpansiveAccess=enforceExpansiveAccess,
|
|
63446
|
+
fileId=ri[RI_ENTITY], permissionId=ri[RI_ITEM], supportsAllDrives=True)
|
|
63379
63447
|
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
63448
|
except (GAPI.fileNotFound, GAPI.forbidden, GAPI.internalError, GAPI.insufficientFilePermissions, GAPI.unknownError,
|
|
63381
63449
|
GAPI.badRequest, GAPI.cannotRemoveOwner, GAPI.cannotModifyInheritedTeamDrivePermission,
|
|
@@ -63395,12 +63463,15 @@ def deletePermissions(users, useDomainAdminAccess=False):
|
|
|
63395
63463
|
jsonData = getJSON([])
|
|
63396
63464
|
PM = PermissionMatch()
|
|
63397
63465
|
PM.SetDefaultMatch(False, {'role': 'owner'})
|
|
63466
|
+
enforceExpansiveAccess = False
|
|
63398
63467
|
while Cmd.ArgumentsRemaining():
|
|
63399
63468
|
myarg = getArgument()
|
|
63400
63469
|
if myarg in ADMIN_ACCESS_OPTIONS:
|
|
63401
63470
|
useDomainAdminAccess = True
|
|
63402
63471
|
elif PM and PM.ProcessArgument(myarg):
|
|
63403
63472
|
pass
|
|
63473
|
+
elif myarg == 'enforceexpansiveaccess':
|
|
63474
|
+
enforceExpansiveAccess = getBoolean()
|
|
63404
63475
|
else:
|
|
63405
63476
|
unknownArgumentExit()
|
|
63406
63477
|
_checkFileIdEntityDomainAccess(fileIdEntity, useDomainAdminAccess)
|
|
@@ -68631,7 +68702,7 @@ def deleteLabels(users, labelEntity):
|
|
|
68631
68702
|
http_status, reason, message = checkGAPIError(exception)
|
|
68632
68703
|
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
68704
|
|
|
68634
|
-
def _callbackDeleteLabel(request_id,
|
|
68705
|
+
def _callbackDeleteLabel(request_id, _, exception):
|
|
68635
68706
|
ri = request_id.splitlines()
|
|
68636
68707
|
if exception is None:
|
|
68637
68708
|
entityActionPerformed([Ent.USER, ri[RI_ENTITY], Ent.LABEL, labelIdToNameMap[ri[RI_ITEM]]], int(ri[RI_J]), int(ri[RI_JCOUNT]))
|
|
@@ -69232,7 +69303,7 @@ def _processMessagesThreads(users, entityType):
|
|
|
69232
69303
|
GAPI.INVALID_MESSAGE_ID: Msg.INVALID_MESSAGE_ID,
|
|
69233
69304
|
GAPI.FAILED_PRECONDITION: Msg.FAILED_PRECONDITION}
|
|
69234
69305
|
|
|
69235
|
-
def _callbackProcessMessage(request_id,
|
|
69306
|
+
def _callbackProcessMessage(request_id, _, exception):
|
|
69236
69307
|
ri = request_id.splitlines()
|
|
69237
69308
|
if exception is None:
|
|
69238
69309
|
if not csvPF:
|