gam7 7.14.3__py3-none-any.whl → 7.15.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 +202 -195
- gam/gamlib/glgapi.py +4 -0
- {gam7-7.14.3.dist-info → gam7-7.15.0.dist-info}/METADATA +1 -1
- {gam7-7.14.3.dist-info → gam7-7.15.0.dist-info}/RECORD +7 -7
- {gam7-7.14.3.dist-info → gam7-7.15.0.dist-info}/WHEEL +0 -0
- {gam7-7.14.3.dist-info → gam7-7.15.0.dist-info}/entry_points.txt +0 -0
- {gam7-7.14.3.dist-info → gam7-7.15.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.15.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
|
|
@@ -2251,10 +2251,10 @@ def getMatchSkipFields(fieldNames):
|
|
|
2251
2251
|
return (matchFields, skipFields)
|
|
2252
2252
|
|
|
2253
2253
|
def checkMatchSkipFields(row, fieldnames, matchFields, skipFields):
|
|
2254
|
-
for matchField, matchPattern in
|
|
2254
|
+
for matchField, matchPattern in matchFields.items():
|
|
2255
2255
|
if (matchField not in row) or not matchPattern.search(row[matchField]):
|
|
2256
2256
|
return False
|
|
2257
|
-
for skipField, matchPattern in
|
|
2257
|
+
for skipField, matchPattern in skipFields.items():
|
|
2258
2258
|
if (skipField in row) and matchPattern.search(row[skipField]):
|
|
2259
2259
|
return False
|
|
2260
2260
|
if fieldnames and (GC.Values[GC.CSV_INPUT_ROW_FILTER] or GC.Values[GC.CSV_INPUT_ROW_DROP_FILTER]):
|
|
@@ -2695,7 +2695,7 @@ def printKeyValueListWithCount(kvList, i, count):
|
|
|
2695
2695
|
writeStdout(formatKeyValueList(Ind.Spaces(), kvList, currentCountNL(i, count)))
|
|
2696
2696
|
|
|
2697
2697
|
def printKeyValueDict(kvDict):
|
|
2698
|
-
for key, value in
|
|
2698
|
+
for key, value in kvDict.items():
|
|
2699
2699
|
writeStdout(formatKeyValueList(Ind.Spaces(), [key, value], '\n'))
|
|
2700
2700
|
|
|
2701
2701
|
def printKeyValueWithCRsNLs(key, value):
|
|
@@ -3532,7 +3532,7 @@ def SetGlobalVariables():
|
|
|
3532
3532
|
_printValueError(sectionName, itemName, f'"{filterVal}"', f'{Msg.EXPECTED}: column:filter')
|
|
3533
3533
|
continue
|
|
3534
3534
|
filterDict[column] = filterStr
|
|
3535
|
-
for column, filterStr in
|
|
3535
|
+
for column, filterStr in filterDict.items():
|
|
3536
3536
|
for c in REGEX_CHARS:
|
|
3537
3537
|
if c in column:
|
|
3538
3538
|
columnPat = column
|
|
@@ -3767,7 +3767,7 @@ def SetGlobalVariables():
|
|
|
3767
3767
|
def _verifyValues(sectionName, inputFilterSectionName, outputFilterSectionName):
|
|
3768
3768
|
printKeyValueList([Ent.Singular(Ent.SECTION), sectionName]) # Do not use printEntity
|
|
3769
3769
|
Ind.Increment()
|
|
3770
|
-
for itemName, itemEntry in
|
|
3770
|
+
for itemName, itemEntry in GC.VAR_INFO.items():
|
|
3771
3771
|
sectName = sectionName
|
|
3772
3772
|
if itemName in GC.CSV_INPUT_ROW_FILTER_ITEMS:
|
|
3773
3773
|
if inputFilterSectionName:
|
|
@@ -3778,7 +3778,7 @@ def SetGlobalVariables():
|
|
|
3778
3778
|
cfgValue = GM.Globals[GM.PARSER].get(sectName, itemName)
|
|
3779
3779
|
varType = itemEntry[GC.VAR_TYPE]
|
|
3780
3780
|
if varType == GC.TYPE_CHOICE:
|
|
3781
|
-
for choice, value in
|
|
3781
|
+
for choice, value in itemEntry[GC.VAR_CHOICES].items():
|
|
3782
3782
|
if cfgValue == value:
|
|
3783
3783
|
cfgValue = choice
|
|
3784
3784
|
break
|
|
@@ -3798,7 +3798,7 @@ def SetGlobalVariables():
|
|
|
3798
3798
|
Ind.Decrement()
|
|
3799
3799
|
|
|
3800
3800
|
def _chkCfgDirectories(sectionName):
|
|
3801
|
-
for itemName, itemEntry in
|
|
3801
|
+
for itemName, itemEntry in GC.VAR_INFO.items():
|
|
3802
3802
|
if itemEntry[GC.VAR_TYPE] == GC.TYPE_DIRECTORY:
|
|
3803
3803
|
dirPath = GC.Values[itemName]
|
|
3804
3804
|
if (not dirPath) and (itemName in {GC.GMAIL_CSE_INCERT_DIR, GC.GMAIL_CSE_INKEY_DIR}):
|
|
@@ -3813,7 +3813,7 @@ def SetGlobalVariables():
|
|
|
3813
3813
|
'\n'))
|
|
3814
3814
|
|
|
3815
3815
|
def _chkCfgFiles(sectionName):
|
|
3816
|
-
for itemName, itemEntry in
|
|
3816
|
+
for itemName, itemEntry in GC.VAR_INFO.items():
|
|
3817
3817
|
if itemEntry[GC.VAR_TYPE] == GC.TYPE_FILE:
|
|
3818
3818
|
fileName = GC.Values[itemName]
|
|
3819
3819
|
if (not fileName) and (itemName in {GC.EXTRA_ARGS, GC.CMDLOG}):
|
|
@@ -3916,18 +3916,18 @@ def SetGlobalVariables():
|
|
|
3916
3916
|
GC.Defaults[GC.DRIVE_DIR] = os.path.join(homePath, 'Downloads')
|
|
3917
3917
|
GM.Globals[GM.GAM_CFG_FILE] = os.path.join(GM.Globals[GM.GAM_CFG_PATH], FN_GAM_CFG)
|
|
3918
3918
|
if not os.path.isfile(GM.Globals[GM.GAM_CFG_FILE]):
|
|
3919
|
-
for itemName, itemEntry in
|
|
3919
|
+
for itemName, itemEntry in GC.VAR_INFO.items():
|
|
3920
3920
|
if itemEntry[GC.VAR_TYPE] == GC.TYPE_DIRECTORY:
|
|
3921
3921
|
_getDefault(itemName, itemEntry, None)
|
|
3922
3922
|
oldGamPath = os.environ.get(EV_OLDGAMPATH, GC.Defaults[GC.CONFIG_DIR])
|
|
3923
|
-
for itemName, itemEntry in
|
|
3923
|
+
for itemName, itemEntry in GC.VAR_INFO.items():
|
|
3924
3924
|
if itemEntry[GC.VAR_TYPE] != GC.TYPE_DIRECTORY:
|
|
3925
3925
|
_getDefault(itemName, itemEntry, oldGamPath)
|
|
3926
3926
|
GM.Globals[GM.PARSER] = configparser.RawConfigParser(defaults=collections.OrderedDict(sorted(list(GC.Defaults.items()), key=lambda t: t[0])))
|
|
3927
3927
|
_checkMakeDir(GC.CONFIG_DIR)
|
|
3928
3928
|
_checkMakeDir(GC.CACHE_DIR)
|
|
3929
3929
|
_checkMakeDir(GC.DRIVE_DIR)
|
|
3930
|
-
for itemName, itemEntry in
|
|
3930
|
+
for itemName, itemEntry in GC.VAR_INFO.items():
|
|
3931
3931
|
if itemEntry[GC.VAR_TYPE] == GC.TYPE_FILE:
|
|
3932
3932
|
srcFile = os.path.expanduser(_stripStringQuotes(GM.Globals[GM.PARSER].get(configparser.DEFAULTSECT, itemName)))
|
|
3933
3933
|
_copyCfgFile(srcFile, GC.CONFIG_DIR, oldGamPath)
|
|
@@ -4035,7 +4035,7 @@ def SetGlobalVariables():
|
|
|
4035
4035
|
prevExtraArgsTxt = GC.Values.get(GC.EXTRA_ARGS, None)
|
|
4036
4036
|
prevOauth2serviceJson = GC.Values.get(GC.OAUTH2SERVICE_JSON, None)
|
|
4037
4037
|
# Assign global variables, directories, timezone first as other variables depend on them
|
|
4038
|
-
for itemName, itemEntry in sorted(
|
|
4038
|
+
for itemName, itemEntry in sorted(GC.VAR_INFO.items()):
|
|
4039
4039
|
varType = itemEntry[GC.VAR_TYPE]
|
|
4040
4040
|
if varType == GC.TYPE_DIRECTORY:
|
|
4041
4041
|
GC.Values[itemName] = _getCfgDirectory(sectionName, itemName)
|
|
@@ -4043,7 +4043,7 @@ def SetGlobalVariables():
|
|
|
4043
4043
|
GC.Values[itemName] = _getCfgTimezone(sectionName, itemName)
|
|
4044
4044
|
GM.Globals[GM.DATETIME_NOW] = datetime.datetime.now(GC.Values[GC.TIMEZONE])
|
|
4045
4045
|
# Everything else except row filters
|
|
4046
|
-
for itemName, itemEntry in sorted(
|
|
4046
|
+
for itemName, itemEntry in sorted(GC.VAR_INFO.items()):
|
|
4047
4047
|
varType = itemEntry[GC.VAR_TYPE]
|
|
4048
4048
|
if varType == GC.TYPE_BOOLEAN:
|
|
4049
4049
|
GC.Values[itemName] = _getCfgBoolean(sectionName, itemName)
|
|
@@ -4066,7 +4066,7 @@ def SetGlobalVariables():
|
|
|
4066
4066
|
elif varType == GC.TYPE_FILE:
|
|
4067
4067
|
GC.Values[itemName] = _getCfgFile(sectionName, itemName)
|
|
4068
4068
|
# Row filters
|
|
4069
|
-
for itemName, itemEntry in sorted(
|
|
4069
|
+
for itemName, itemEntry in sorted(GC.VAR_INFO.items()):
|
|
4070
4070
|
varType = itemEntry[GC.VAR_TYPE]
|
|
4071
4071
|
if varType == GC.TYPE_ROWFILTER:
|
|
4072
4072
|
GC.Values[itemName] = _getCfgRowFilter(sectionName, itemName)
|
|
@@ -4200,7 +4200,7 @@ def SetGlobalVariables():
|
|
|
4200
4200
|
# Clear input row filters/limit from parser, children can define but shouldn't inherit global value
|
|
4201
4201
|
# Clear output header/row filters/limit from parser, children can define or they will inherit global value if not defined
|
|
4202
4202
|
if GM.Globals[GM.PID] == 0:
|
|
4203
|
-
for itemName, itemEntry in sorted(
|
|
4203
|
+
for itemName, itemEntry in sorted(GC.VAR_INFO.items()):
|
|
4204
4204
|
varType = itemEntry[GC.VAR_TYPE]
|
|
4205
4205
|
if varType in {GC.TYPE_HEADERFILTER, GC.TYPE_HEADERFORCE, GC.TYPE_HEADERORDER, GC.TYPE_ROWFILTER}:
|
|
4206
4206
|
GM.Globals[GM.PARSER].set(sectionName, itemName, '')
|
|
@@ -7264,13 +7264,13 @@ def send_email(msgSubject, msgBody, msgTo, i=0, count=0, clientAccess=False, msg
|
|
|
7264
7264
|
return
|
|
7265
7265
|
toSent = set(recipients.split(','))
|
|
7266
7266
|
toFailed = {}
|
|
7267
|
-
for addr, err in
|
|
7267
|
+
for addr, err in result.items():
|
|
7268
7268
|
if addr in toSent:
|
|
7269
7269
|
toSent.remove(addr)
|
|
7270
7270
|
toFailed[addr] = f'{err[0]}: {err[1]}'
|
|
7271
7271
|
if toSent:
|
|
7272
7272
|
entityActionPerformed([entityType, ','.join(toSent), Ent.MESSAGE, msgSubject], i, count)
|
|
7273
|
-
for addr, errMsg in
|
|
7273
|
+
for addr, errMsg in toFailed.items():
|
|
7274
7274
|
entityActionFailedWarning([entityType, addr, Ent.MESSAGE, msgSubject], errMsg, i, count)
|
|
7275
7275
|
|
|
7276
7276
|
def cleanAddr(emailAddr):
|
|
@@ -7305,7 +7305,7 @@ def send_email(msgSubject, msgBody, msgTo, i=0, count=0, clientAccess=False, msg
|
|
|
7305
7305
|
if bccRecipients:
|
|
7306
7306
|
message['Bcc'] = bccRecipients.lower()
|
|
7307
7307
|
if msgHeaders:
|
|
7308
|
-
for header, value in
|
|
7308
|
+
for header, value in msgHeaders.items():
|
|
7309
7309
|
if header not in {'Subject', 'From', 'To', 'Reply-To', 'Cc', 'Bcc'}:
|
|
7310
7310
|
message[header] = value
|
|
7311
7311
|
if mailBox is None:
|
|
@@ -8065,7 +8065,7 @@ class CSVPrintFile():
|
|
|
8065
8065
|
localUser = localParent = False
|
|
8066
8066
|
tdfileidLocation = tdparentLocation = tdaddsheetLocation = tdupdatesheetLocation = tduserLocation = Cmd.Location()
|
|
8067
8067
|
tdsheetLocation = {}
|
|
8068
|
-
for sheetEntity in
|
|
8068
|
+
for sheetEntity in self.TDSHEET_ENTITY_MAP.values():
|
|
8069
8069
|
tdsheetLocation[sheetEntity] = Cmd.Location()
|
|
8070
8070
|
self.todrive = {'user': GC.Values[GC.TODRIVE_USER], 'title': None, 'description': None,
|
|
8071
8071
|
'sheetEntity': None, 'addsheet': False, 'updatesheet': False, 'sheettitle': None,
|
|
@@ -8215,7 +8215,7 @@ class CSVPrintFile():
|
|
|
8215
8215
|
throwReasons=GAPI.SHEETS_ACCESS_THROW_REASONS,
|
|
8216
8216
|
spreadsheetId=self.todrive['fileId'],
|
|
8217
8217
|
fields='spreadsheetUrl,sheets(properties(sheetId,title),protectedRanges(range(sheetId),requestingUserCanEdit))')
|
|
8218
|
-
for sheetEntity in
|
|
8218
|
+
for sheetEntity in self.TDSHEET_ENTITY_MAP.values():
|
|
8219
8219
|
if self.todrive[sheetEntity]:
|
|
8220
8220
|
sheetId = getSheetIdFromSheetEntity(spreadsheet, self.todrive[sheetEntity])
|
|
8221
8221
|
if sheetId is None:
|
|
@@ -8352,13 +8352,13 @@ class CSVPrintFile():
|
|
|
8352
8352
|
elif addPermissionsTitle:
|
|
8353
8353
|
titles.append(field)
|
|
8354
8354
|
addPermissionsTitle = False
|
|
8355
|
-
for subField in
|
|
8355
|
+
for subField in self.driveSubfieldsChoiceMap[field.lower()].values():
|
|
8356
8356
|
if not isinstance(subField, list):
|
|
8357
8357
|
titles.append(f'{field}{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}0{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{subField}')
|
|
8358
8358
|
else:
|
|
8359
8359
|
titles.extend([f'{field}{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}0{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{subSubField}' for subSubField in subField])
|
|
8360
8360
|
else:
|
|
8361
|
-
for subField in
|
|
8361
|
+
for subField in self.driveSubfieldsChoiceMap[field.lower()].values():
|
|
8362
8362
|
if not isinstance(subField, list):
|
|
8363
8363
|
titles.append(f'{field}{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{subField}')
|
|
8364
8364
|
else:
|
|
@@ -8759,7 +8759,7 @@ class CSVPrintFile():
|
|
|
8759
8759
|
csvFile.seek(0)
|
|
8760
8760
|
spreadsheet = None
|
|
8761
8761
|
if self.todrive['updatesheet']:
|
|
8762
|
-
for sheetEntity in
|
|
8762
|
+
for sheetEntity in self.TDSHEET_ENTITY_MAP.values():
|
|
8763
8763
|
if self.todrive[sheetEntity]:
|
|
8764
8764
|
entityValueList = [Ent.USER, user, Ent.SPREADSHEET, title, self.todrive[sheetEntity]['sheetType'], self.todrive[sheetEntity]['sheetValue']]
|
|
8765
8765
|
if spreadsheet is None:
|
|
@@ -9101,7 +9101,7 @@ def cleanJSON(topStructure, listLimit=None, skipObjects=None, timeObjects=None):
|
|
|
9101
9101
|
listLen = len(structure)
|
|
9102
9102
|
listLen = min(listLen, listLimit or listLen)
|
|
9103
9103
|
return [_clean(v, '', DEFAULT_SKIP_OBJECTS) for v in structure[0:listLen]]
|
|
9104
|
-
return {k: _clean(v, k, DEFAULT_SKIP_OBJECTS) for k, v in sorted(
|
|
9104
|
+
return {k: _clean(v, k, DEFAULT_SKIP_OBJECTS) for k, v in sorted(structure.items()) if k not in subSkipObjects}
|
|
9105
9105
|
|
|
9106
9106
|
timeObjects = timeObjects or set()
|
|
9107
9107
|
return _clean(topStructure, '', DEFAULT_SKIP_OBJECTS.union(skipObjects or set()))
|
|
@@ -9136,7 +9136,7 @@ def flattenJSON(topStructure, flattened=None,
|
|
|
9136
9136
|
_flatten(structure[i], '', f'{path}{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{i}')
|
|
9137
9137
|
else:
|
|
9138
9138
|
if structure:
|
|
9139
|
-
for k, v in sorted(
|
|
9139
|
+
for k, v in sorted(structure.items()):
|
|
9140
9140
|
if k not in DEFAULT_SKIP_OBJECTS:
|
|
9141
9141
|
_flatten(v, k, f'{path}{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{k}')
|
|
9142
9142
|
else:
|
|
@@ -9147,7 +9147,7 @@ def flattenJSON(topStructure, flattened=None,
|
|
|
9147
9147
|
timeObjects = timeObjects or set()
|
|
9148
9148
|
noLenObjects = noLenObjects or set()
|
|
9149
9149
|
simpleLists = simpleLists or set()
|
|
9150
|
-
for k, v in sorted(
|
|
9150
|
+
for k, v in sorted(topStructure.items()):
|
|
9151
9151
|
if k not in allSkipObjects:
|
|
9152
9152
|
_flatten(v, k, k)
|
|
9153
9153
|
return flattened
|
|
@@ -10025,7 +10025,7 @@ def MultiprocessGAMCommands(items, showCmds):
|
|
|
10025
10025
|
while poolProcessResults[0] > 0:
|
|
10026
10026
|
time.sleep(1)
|
|
10027
10027
|
completedProcesses = []
|
|
10028
|
-
for p, result in
|
|
10028
|
+
for p, result in poolProcessResults.items():
|
|
10029
10029
|
if p != 0 and result.ready():
|
|
10030
10030
|
poolCallback(result.get())
|
|
10031
10031
|
completedProcesses.append(p)
|
|
@@ -10077,7 +10077,7 @@ def MultiprocessGAMCommands(items, showCmds):
|
|
|
10077
10077
|
if parallelPoolProcesses > 0:
|
|
10078
10078
|
while poolProcessResults[0] == parallelPoolProcesses:
|
|
10079
10079
|
completedProcesses = []
|
|
10080
|
-
for p, result in
|
|
10080
|
+
for p, result in poolProcessResults.items():
|
|
10081
10081
|
if p != 0 and result.ready():
|
|
10082
10082
|
poolCallback(result.get())
|
|
10083
10083
|
completedProcesses.append(p)
|
|
@@ -10098,7 +10098,7 @@ def MultiprocessGAMCommands(items, showCmds):
|
|
|
10098
10098
|
PROCESS_PLURAL_SINGULAR[poolProcessResults[0] == 1],
|
|
10099
10099
|
Msg.BATCH_CSV_WAIT_LIMIT.format(waitRemaining)))
|
|
10100
10100
|
completedProcesses = []
|
|
10101
|
-
for p, result in
|
|
10101
|
+
for p, result in poolProcessResults.items():
|
|
10102
10102
|
if p != 0 and result.ready():
|
|
10103
10103
|
poolCallback(result.get())
|
|
10104
10104
|
completedProcesses.append(p)
|
|
@@ -10254,7 +10254,7 @@ def doBatch(threadBatch=False):
|
|
|
10254
10254
|
if line.startswith('#'):
|
|
10255
10255
|
continue
|
|
10256
10256
|
if kwValues:
|
|
10257
|
-
for kw, value in
|
|
10257
|
+
for kw, value in kwValues.items():
|
|
10258
10258
|
line = line.replace(f'%{kw}%', value)
|
|
10259
10259
|
try:
|
|
10260
10260
|
argv = shlex.split(line)
|
|
@@ -10385,7 +10385,7 @@ def getSubFields(initial_argv, fieldNames):
|
|
|
10385
10385
|
|
|
10386
10386
|
def processSubFields(GAM_argv, row, subFields):
|
|
10387
10387
|
argv = GAM_argv[:]
|
|
10388
|
-
for GAM_argvI, fields in
|
|
10388
|
+
for GAM_argvI, fields in subFields.items():
|
|
10389
10389
|
oargv = argv[GAM_argvI][:]
|
|
10390
10390
|
argv[GAM_argvI] = ''
|
|
10391
10391
|
pos = 0
|
|
@@ -11273,7 +11273,7 @@ def doOAuthInfo():
|
|
|
11273
11273
|
if 'expires_in' in token_info:
|
|
11274
11274
|
printKeyValueList(['Expires', ISOformatTimeStamp((datetime.datetime.now()+datetime.timedelta(seconds=token_info['expires_in'])).replace(tzinfo=GC.Values[GC.TIMEZONE]))])
|
|
11275
11275
|
if showDetails:
|
|
11276
|
-
for k, v in sorted(
|
|
11276
|
+
for k, v in sorted(token_info.items()):
|
|
11277
11277
|
if k not in ['email', 'expires_in', 'issued_to', 'scope']:
|
|
11278
11278
|
printKeyValueList([k, v])
|
|
11279
11279
|
printBlankLine()
|
|
@@ -12081,7 +12081,7 @@ def doPrintShowProjects():
|
|
|
12081
12081
|
if jcount > 0:
|
|
12082
12082
|
printKeyValueList(['labels', jcount])
|
|
12083
12083
|
Ind.Increment()
|
|
12084
|
-
for k, v in
|
|
12084
|
+
for k, v in project['labels'].items():
|
|
12085
12085
|
printKeyValueList([k, v])
|
|
12086
12086
|
Ind.Decrement()
|
|
12087
12087
|
if 'parent' in project:
|
|
@@ -12104,7 +12104,7 @@ def doPrintShowProjects():
|
|
|
12104
12104
|
if 'condition' in binding:
|
|
12105
12105
|
printKeyValueList(['condition', ''])
|
|
12106
12106
|
Ind.Increment()
|
|
12107
|
-
for k, v in
|
|
12107
|
+
for k, v in binding['condition'].items():
|
|
12108
12108
|
printKeyValueList([k, v])
|
|
12109
12109
|
Ind.Decrement()
|
|
12110
12110
|
Ind.Decrement()
|
|
@@ -12145,7 +12145,7 @@ def doPrintShowProjects():
|
|
|
12145
12145
|
prow = row.copy()
|
|
12146
12146
|
prow[f'policy{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}role'] = binding['role']
|
|
12147
12147
|
if 'condition' in binding:
|
|
12148
|
-
for k, v in
|
|
12148
|
+
for k, v in binding['condition'].items():
|
|
12149
12149
|
prow[f'policy{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}condition{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{k}'] = v
|
|
12150
12150
|
members = binding.get('members', [])
|
|
12151
12151
|
if not oneMemberPerRow:
|
|
@@ -12301,7 +12301,7 @@ def checkServiceAccount(users):
|
|
|
12301
12301
|
testDeprecated = 'DEPRECATED'
|
|
12302
12302
|
if Act.Get() == Act.CHECK:
|
|
12303
12303
|
if not checkScopesSet:
|
|
12304
|
-
for scope in
|
|
12304
|
+
for scope in GM.Globals[GM.SVCACCT_SCOPES].values():
|
|
12305
12305
|
checkScopesSet.update(scope)
|
|
12306
12306
|
else:
|
|
12307
12307
|
if not checkScopesSet:
|
|
@@ -12508,7 +12508,7 @@ def _showSAKeys(keys, count, currentPrivateKeyId):
|
|
|
12508
12508
|
keyName = key.pop('name').rsplit('/', 1)[-1]
|
|
12509
12509
|
printKeyValueListWithCount(['name', keyName], i, count)
|
|
12510
12510
|
Ind.Increment()
|
|
12511
|
-
for k, v in sorted(
|
|
12511
|
+
for k, v in sorted(key.items()):
|
|
12512
12512
|
if k not in SVCACCT_KEY_TIME_OBJECTS:
|
|
12513
12513
|
printKeyValueList([k, v])
|
|
12514
12514
|
else:
|
|
@@ -13540,7 +13540,7 @@ def doReportUsage():
|
|
|
13540
13540
|
versions = {}
|
|
13541
13541
|
for version in item['msgValue']:
|
|
13542
13542
|
versions[version['version_number']] = version['num_devices']
|
|
13543
|
-
for k, v in sorted(
|
|
13543
|
+
for k, v in sorted(versions.items(), reverse=True):
|
|
13544
13544
|
title = f'cros:num_devices_chrome_{k}'
|
|
13545
13545
|
row[title] = v
|
|
13546
13546
|
else:
|
|
@@ -13808,7 +13808,7 @@ def doReport():
|
|
|
13808
13808
|
versions = {}
|
|
13809
13809
|
for version in item['msgValue']:
|
|
13810
13810
|
versions[version['version_number']] = version['num_devices']
|
|
13811
|
-
for k, v in sorted(
|
|
13811
|
+
for k, v in sorted(versions.items(), reverse=True):
|
|
13812
13812
|
title = f'cros:device_version{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{k}'
|
|
13813
13813
|
csvPF.AddTitles(title)
|
|
13814
13814
|
row[title] = v
|
|
@@ -13817,7 +13817,7 @@ def doReport():
|
|
|
13817
13817
|
for subitem in item['msgValue']:
|
|
13818
13818
|
if 'count' in subitem:
|
|
13819
13819
|
mycount = myvalue = None
|
|
13820
|
-
for key, value in
|
|
13820
|
+
for key, value in subitem.items():
|
|
13821
13821
|
if key == 'count':
|
|
13822
13822
|
mycount = value
|
|
13823
13823
|
else:
|
|
@@ -13882,7 +13882,7 @@ def doReport():
|
|
|
13882
13882
|
for subitem in item['msgValue']:
|
|
13883
13883
|
if 'count' in subitem:
|
|
13884
13884
|
mycount = myvalue = None
|
|
13885
|
-
for key, value in
|
|
13885
|
+
for key, value in subitem.items():
|
|
13886
13886
|
if key == 'count':
|
|
13887
13887
|
mycount = value
|
|
13888
13888
|
else:
|
|
@@ -14077,7 +14077,7 @@ def doReport():
|
|
|
14077
14077
|
if usageReports and not includeServices:
|
|
14078
14078
|
includeServices = set(fullDataServices)
|
|
14079
14079
|
if filterTimes and filters is not None:
|
|
14080
|
-
for filterTimeName, filterTimeValue in
|
|
14080
|
+
for filterTimeName, filterTimeValue in filterTimes.items():
|
|
14081
14081
|
filters = filters.replace(f'#{filterTimeName}#', filterTimeValue)
|
|
14082
14082
|
if not orgUnitId:
|
|
14083
14083
|
showOrgUnit = False
|
|
@@ -14191,9 +14191,9 @@ def doReport():
|
|
|
14191
14191
|
if user != 'all' and lastDate is None and GC.Values[GC.CSV_OUTPUT_USERS_AUDIT]:
|
|
14192
14192
|
csvPF.WriteRowNoFilter({'date': prevTryDate, 'email': user})
|
|
14193
14193
|
if aggregateByDate:
|
|
14194
|
-
for usageDate, events in
|
|
14194
|
+
for usageDate, events in eventCounts.items():
|
|
14195
14195
|
row = {'date': usageDate}
|
|
14196
|
-
for event, count in
|
|
14196
|
+
for event, count in events.items():
|
|
14197
14197
|
if convertMbToGb and event.endswith('_in_gb'):
|
|
14198
14198
|
count = f'{count/1024:.2f}'
|
|
14199
14199
|
row[event] = count
|
|
@@ -14201,11 +14201,11 @@ def doReport():
|
|
|
14201
14201
|
csvPF.SortRows('date', False)
|
|
14202
14202
|
csvPF.writeCSVfile(f'User Reports Aggregate - {tryDate}')
|
|
14203
14203
|
elif aggregateByUser:
|
|
14204
|
-
for email, events in
|
|
14204
|
+
for email, events in eventCounts.items():
|
|
14205
14205
|
row = {'email': email}
|
|
14206
14206
|
if showOrgUnit:
|
|
14207
14207
|
row['orgUnitPath'] = userOrgUnits.get(email, UNKNOWN)
|
|
14208
|
-
for event, count in
|
|
14208
|
+
for event, count in events.items():
|
|
14209
14209
|
if convertMbToGb and event.endswith('_in_gb'):
|
|
14210
14210
|
count = f'{count/1024:.2f}'
|
|
14211
14211
|
row[event] = count
|
|
@@ -14376,7 +14376,7 @@ def doReport():
|
|
|
14376
14376
|
for mess in message['parameter']:
|
|
14377
14377
|
value = mess.get('value', ' '.join(mess.get('multiValue', [])))
|
|
14378
14378
|
parts[mess['name']] = parts.get(mess['name'], [])+[value]
|
|
14379
|
-
for part, v in
|
|
14379
|
+
for part, v in parts.items():
|
|
14380
14380
|
if part == 'scope_name':
|
|
14381
14381
|
part = 'scope'
|
|
14382
14382
|
event[part] = ' '.join(v)
|
|
@@ -14443,20 +14443,20 @@ def doReport():
|
|
|
14443
14443
|
csvPF.AddTitles(sorted(addCSVData.keys()))
|
|
14444
14444
|
if eventCounts:
|
|
14445
14445
|
if not countsByDate:
|
|
14446
|
-
for actor, events in
|
|
14446
|
+
for actor, events in eventCounts.items():
|
|
14447
14447
|
row = {'emailAddress': actor}
|
|
14448
14448
|
row.update(zeroEventCounts)
|
|
14449
|
-
for event, count in
|
|
14449
|
+
for event, count in events.items():
|
|
14450
14450
|
row[event] = count
|
|
14451
14451
|
if addCSVData:
|
|
14452
14452
|
row.update(addCSVData)
|
|
14453
14453
|
csvPF.WriteRowTitles(row)
|
|
14454
14454
|
else:
|
|
14455
|
-
for actor, eventDates in
|
|
14456
|
-
for eventDate, events in
|
|
14455
|
+
for actor, eventDates in eventCounts.items():
|
|
14456
|
+
for eventDate, events in eventDates.items():
|
|
14457
14457
|
row = {'emailAddress': actor, 'date': eventDate}
|
|
14458
14458
|
row.update(zeroEventCounts)
|
|
14459
|
-
for event, count in
|
|
14459
|
+
for event, count in events.items():
|
|
14460
14460
|
row[event] = count
|
|
14461
14461
|
if addCSVData:
|
|
14462
14462
|
row.update(addCSVData)
|
|
@@ -14471,7 +14471,7 @@ def doReport():
|
|
|
14471
14471
|
if addCSVData:
|
|
14472
14472
|
csvPF.AddTitles(sorted(addCSVData.keys()))
|
|
14473
14473
|
if eventCounts:
|
|
14474
|
-
for event, count in sorted(
|
|
14474
|
+
for event, count in sorted(eventCounts.items()):
|
|
14475
14475
|
row = {'event': event, 'count': count}
|
|
14476
14476
|
if addCSVData:
|
|
14477
14477
|
row.update(addCSVData)
|
|
@@ -14756,7 +14756,7 @@ def _getTagReplacementFieldValues(user, i, count, tagReplacements, results=None)
|
|
|
14756
14756
|
else:
|
|
14757
14757
|
results = {'primaryEmail': user}
|
|
14758
14758
|
userName, domain = splitEmailAddress(user)
|
|
14759
|
-
for
|
|
14759
|
+
for tag in tagReplacements['tags'].values():
|
|
14760
14760
|
if tag.get('field'):
|
|
14761
14761
|
field = tag['field']
|
|
14762
14762
|
if field == 'primaryEmail':
|
|
@@ -18128,7 +18128,7 @@ def doPrintOrgs():
|
|
|
18128
18128
|
if showCrOSCounts or showUserCounts:
|
|
18129
18129
|
if showCrOSCounts:
|
|
18130
18130
|
total = 0
|
|
18131
|
-
for k, v in sorted(
|
|
18131
|
+
for k, v in sorted(crosCounts[orgUnitPath].items()):
|
|
18132
18132
|
row[f'CrOS{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{k}'] = v
|
|
18133
18133
|
total += v
|
|
18134
18134
|
row[f'CrOS{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}Total'] = total
|
|
@@ -20235,7 +20235,8 @@ def _clearUpdateContacts(updateContacts):
|
|
|
20235
20235
|
if not localContactSelects(contactsManager, contactQuery, fields):
|
|
20236
20236
|
continue
|
|
20237
20237
|
if updateContacts:
|
|
20238
|
-
|
|
20238
|
+
##### Zip
|
|
20239
|
+
for field, value in update_fields.items():
|
|
20239
20240
|
fields[field] = value
|
|
20240
20241
|
contactEntry = contactsManager.FieldsToContact(fields)
|
|
20241
20242
|
else:
|
|
@@ -22017,7 +22018,7 @@ def _processPersonMetadata(person, parameters):
|
|
|
22017
22018
|
person[PEOPLE_UPDATE_TIME] = formatLocalTime(sources[0][PEOPLE_UPDATE_TIME])
|
|
22018
22019
|
if parameters['sourceTypes']:
|
|
22019
22020
|
stripKeys = []
|
|
22020
|
-
for k, v in
|
|
22021
|
+
for k, v in person.items():
|
|
22021
22022
|
if isinstance(v, list):
|
|
22022
22023
|
person[k] = []
|
|
22023
22024
|
for entry in v:
|
|
@@ -22032,7 +22033,7 @@ def _processPersonMetadata(person, parameters):
|
|
|
22032
22033
|
person.pop(k, None)
|
|
22033
22034
|
if parameters['strip']:
|
|
22034
22035
|
person.pop(PEOPLE_METADATA, None)
|
|
22035
|
-
for
|
|
22036
|
+
for v in person.values():
|
|
22036
22037
|
if isinstance(v, list):
|
|
22037
22038
|
for entry in v:
|
|
22038
22039
|
if isinstance(entry, dict):
|
|
@@ -23164,7 +23165,7 @@ PEOPLE_GROUP_TIME_OBJECTS = {'updateTime'}
|
|
|
23164
23165
|
|
|
23165
23166
|
def _normalizeContactGroupMetadata(contactGroup):
|
|
23166
23167
|
normalizedContactGroup = contactGroup.copy()
|
|
23167
|
-
for k, v in
|
|
23168
|
+
for k, v in normalizedContactGroup.pop('metadata', {}).items():
|
|
23168
23169
|
normalizedContactGroup[k] = v
|
|
23169
23170
|
return normalizedContactGroup
|
|
23170
23171
|
|
|
@@ -24116,7 +24117,7 @@ def infoCrOSDevices(entityList):
|
|
|
24116
24117
|
if up in cros:
|
|
24117
24118
|
printKeyValueList([up, ''])
|
|
24118
24119
|
Ind.Increment()
|
|
24119
|
-
for key, value in sorted(
|
|
24120
|
+
for key, value in sorted(cros[up].items()):
|
|
24120
24121
|
if key not in CROS_TIME_OBJECTS:
|
|
24121
24122
|
printKeyValueList([key, value])
|
|
24122
24123
|
else:
|
|
@@ -24391,7 +24392,7 @@ def substituteQueryTimes(queries, queryTimes):
|
|
|
24391
24392
|
if queryTimes:
|
|
24392
24393
|
for i, query in enumerate(queries):
|
|
24393
24394
|
if query is not None:
|
|
24394
|
-
for queryTimeName, queryTimeValue in
|
|
24395
|
+
for queryTimeName, queryTimeValue in queryTimes.items():
|
|
24395
24396
|
query = query.replace(f'#{queryTimeName}#', queryTimeValue)
|
|
24396
24397
|
queries[i] = query
|
|
24397
24398
|
|
|
@@ -24476,7 +24477,7 @@ def doPrintCrOSDevices(entityList=None):
|
|
|
24476
24477
|
return
|
|
24477
24478
|
for attrib in ['diskSpaceUsage', 'osUpdateStatus', 'tpmVersionInfo']:
|
|
24478
24479
|
if attrib in cros:
|
|
24479
|
-
for key, value in sorted(
|
|
24480
|
+
for key, value in sorted(cros[attrib].items()):
|
|
24480
24481
|
attribKey = f'{attrib}{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{key}'
|
|
24481
24482
|
if key not in CROS_TIME_OBJECTS:
|
|
24482
24483
|
cros[attribKey] = value
|
|
@@ -25649,7 +25650,7 @@ def doPrintShowChromeProfiles():
|
|
|
25649
25650
|
else:
|
|
25650
25651
|
FJQC.GetFormatJSONQuoteChar(myarg, True)
|
|
25651
25652
|
if filterTimes and cbfilter is not None:
|
|
25652
|
-
for filterTimeName, filterTimeValue in
|
|
25653
|
+
for filterTimeName, filterTimeValue in filterTimes.items():
|
|
25653
25654
|
cbfilter = cbfilter.replace(f'#{filterTimeName}#', filterTimeValue)
|
|
25654
25655
|
fields = getItemFieldsFromFieldsList('chromeBrowserProfiles', fieldsList)
|
|
25655
25656
|
customerId = _getCustomerId()
|
|
@@ -25724,7 +25725,7 @@ def _getChromeProfileNameEntityForCommand(cm, parameters):
|
|
|
25724
25725
|
parameters['commandNameList'][i] = f'customers/{customerId}/profiles/{commandName}'
|
|
25725
25726
|
return
|
|
25726
25727
|
if parameters['filterTimes']:
|
|
25727
|
-
for filterTimeName, filterTimeValue in
|
|
25728
|
+
for filterTimeName, filterTimeValue in parameters['filterTimes'].items():
|
|
25728
25729
|
parameters['cbfilter'] = parameters['cbfilter'].replace(f'#{filterTimeName}#', filterTimeValue)
|
|
25729
25730
|
printGettingAllAccountEntities(Ent.CHROME_PROFILE, parameters['cbfilter'])
|
|
25730
25731
|
pageMessage = getPageMessage()
|
|
@@ -28652,7 +28653,7 @@ def simplifyChromeSchemaDisplay(schema):
|
|
|
28652
28653
|
mfield.pop('number')
|
|
28653
28654
|
mtypeEntry['field'][mfield.pop('name')] = mfield
|
|
28654
28655
|
mesgDict[mesgType['name']] = mtypeEntry.copy()
|
|
28655
|
-
for
|
|
28656
|
+
for mtypeEntry in mesgDict.values():
|
|
28656
28657
|
for mfieldName, mfield in mtypeEntry['field'].items():
|
|
28657
28658
|
mfield['descriptions'] = []
|
|
28658
28659
|
if mfield['type'] == 'TYPE_STRING' and mfield.get('label') == 'LABEL_REPEATED':
|
|
@@ -29625,8 +29626,8 @@ def _showChromePolicySchemaStd(schema):
|
|
|
29625
29626
|
if vtype == 'TYPE_ENUM':
|
|
29626
29627
|
enums = mtypeEntry['subtype']['enums']
|
|
29627
29628
|
descriptions = mtypeEntry['descriptions']
|
|
29628
|
-
for i in
|
|
29629
|
-
printKeyValueList([f'{
|
|
29629
|
+
for i, v in enumerate(enums):
|
|
29630
|
+
printKeyValueList([f'{v}', f'{descriptions[i]}'])
|
|
29630
29631
|
elif vtype == 'TYPE_MESSAGE':
|
|
29631
29632
|
for mfieldName, mfield in mtypeEntry['subtype']['field'].items():
|
|
29632
29633
|
# managedBookmarks is recursive
|
|
@@ -29639,7 +29640,7 @@ def _showChromePolicySchemaStd(schema):
|
|
|
29639
29640
|
|
|
29640
29641
|
printKeyValueList([f'{schema.get("name")}', f'{schema.get("description")}'])
|
|
29641
29642
|
Ind.Increment()
|
|
29642
|
-
for
|
|
29643
|
+
for mtypeEntry in schema['settings'].values():
|
|
29643
29644
|
if mtypeEntry['subfield']:
|
|
29644
29645
|
continue
|
|
29645
29646
|
for mfieldName, mfield in mtypeEntry['field'].items():
|
|
@@ -29678,7 +29679,7 @@ def doShowChromePolicySchemasStd(cp):
|
|
|
29678
29679
|
for schema in result:
|
|
29679
29680
|
schema_name, schema_dict = simplifyChromeSchemaDisplay(schema)
|
|
29680
29681
|
schemas[schema_name.lower()] = schema_dict
|
|
29681
|
-
for _, schema in sorted(
|
|
29682
|
+
for _, schema in sorted(schemas.items()):
|
|
29682
29683
|
_showChromePolicySchemaStd(schema)
|
|
29683
29684
|
printBlankLine()
|
|
29684
29685
|
|
|
@@ -30036,11 +30037,11 @@ def doSyncCIDevices():
|
|
|
30036
30037
|
if last_sync == NEVER_TIME_NOMS:
|
|
30037
30038
|
remoteDeviceMap[sndt]['unassigned'] = True
|
|
30038
30039
|
devicesToAdd = []
|
|
30039
|
-
for sndt, device in
|
|
30040
|
+
for sndt, device in localDevices.items():
|
|
30040
30041
|
if sndt not in remoteDevices:
|
|
30041
30042
|
devicesToAdd.append(device)
|
|
30042
30043
|
missingDevices = []
|
|
30043
|
-
for sndt, device in
|
|
30044
|
+
for sndt, device in remoteDevices.items():
|
|
30044
30045
|
if sndt not in localDevices:
|
|
30045
30046
|
missingDevices.append(device)
|
|
30046
30047
|
Act.Set([Act.CREATE, Act.CREATE_PREVIEW][preview])
|
|
@@ -30337,10 +30338,10 @@ def doPrintCIDevices():
|
|
|
30337
30338
|
if mg:
|
|
30338
30339
|
du = mg.group(1)
|
|
30339
30340
|
state_name = mg.group(2)
|
|
30340
|
-
for
|
|
30341
|
-
if
|
|
30342
|
-
|
|
30343
|
-
|
|
30341
|
+
for deviceUser in deviceUsers:
|
|
30342
|
+
if deviceUser['name'] == du:
|
|
30343
|
+
deviceUser.setdefault('clientstates', {})
|
|
30344
|
+
deviceUser['clientstates'][state_name] = state
|
|
30344
30345
|
break
|
|
30345
30346
|
for deviceUser in deviceUsers:
|
|
30346
30347
|
mg = DEVICE_USERNAME_PATTERN.match(deviceUser['name'])
|
|
@@ -32748,7 +32749,7 @@ def doCreateGroup(ciGroupsAPI=False):
|
|
|
32748
32749
|
entityActionNotPerformedWarning([Ent.GROUP, groupEmail], Msg.EMAIL_ADDRESS_IS_UNMANAGED_ACCOUNT)
|
|
32749
32750
|
return
|
|
32750
32751
|
if ciGroupsAPI:
|
|
32751
|
-
for k, v in
|
|
32752
|
+
for k, v in GROUP_CIGROUP_FIELDS_MAP.items():
|
|
32752
32753
|
if k in gs_body:
|
|
32753
32754
|
body[v] = gs_body.pop(k)
|
|
32754
32755
|
body.setdefault('displayName', groupEmail)
|
|
@@ -33262,7 +33263,7 @@ def doUpdateGroups():
|
|
|
33262
33263
|
gs = buildGAPIObject(API.GROUPSSETTINGS)
|
|
33263
33264
|
gs_body = getSettingsFromGroup(cd, ','.join(entityList), gs, gs_body)
|
|
33264
33265
|
if ci_body:
|
|
33265
|
-
for k, v in
|
|
33266
|
+
for k, v in GROUP_CIGROUP_FIELDS_MAP.items():
|
|
33266
33267
|
if k in gs_body:
|
|
33267
33268
|
ci_body[v] = gs_body.pop(k)
|
|
33268
33269
|
if gs_body:
|
|
@@ -33896,7 +33897,7 @@ def _showCIGroup(group, groupEmail, i=0, count=0):
|
|
|
33896
33897
|
continue
|
|
33897
33898
|
value = group[key]
|
|
33898
33899
|
if key == 'labels':
|
|
33899
|
-
for k, v in
|
|
33900
|
+
for k, v in value.items():
|
|
33900
33901
|
if v == '':
|
|
33901
33902
|
value[k] = True
|
|
33902
33903
|
if isinstance(value, (list, dict)):
|
|
@@ -34099,7 +34100,7 @@ def infoGroups(entityList):
|
|
|
34099
34100
|
else:
|
|
34100
34101
|
printKeyValueWithCRsNLs(key, value)
|
|
34101
34102
|
if settings:
|
|
34102
|
-
for
|
|
34103
|
+
for _, attr in sorted(GROUP_SETTINGS_ATTRIBUTES.items()):
|
|
34103
34104
|
key = attr[0]
|
|
34104
34105
|
if key in settings:
|
|
34105
34106
|
if key not in GROUP_FIELDS_WITH_CRS_NLS:
|
|
@@ -34114,7 +34115,7 @@ def infoGroups(entityList):
|
|
|
34114
34115
|
else:
|
|
34115
34116
|
showTitle = True
|
|
34116
34117
|
if showDeprecatedAttributes:
|
|
34117
|
-
for
|
|
34118
|
+
for _, subattr in sorted(GROUP_MERGED_TO_COMPONENT_MAP[key].items()):
|
|
34118
34119
|
subkey = subattr[0]
|
|
34119
34120
|
if subkey in settings:
|
|
34120
34121
|
if showTitle:
|
|
@@ -34126,7 +34127,7 @@ def infoGroups(entityList):
|
|
|
34126
34127
|
Ind.Decrement()
|
|
34127
34128
|
if showDeprecatedAttributes:
|
|
34128
34129
|
showTitle = True
|
|
34129
|
-
for
|
|
34130
|
+
for _, attr in sorted(GROUP_DEPRECATED_ATTRIBUTES.items()):
|
|
34130
34131
|
subkey = attr[0]
|
|
34131
34132
|
if subkey in settings:
|
|
34132
34133
|
if showTitle:
|
|
@@ -34246,23 +34247,23 @@ def clearUnneededGroupMatchPatterns(matchPatterns):
|
|
|
34246
34247
|
matchPatterns.pop(field, None)
|
|
34247
34248
|
|
|
34248
34249
|
def checkGroupMatchPatterns(groupEmail, group, matchPatterns):
|
|
34249
|
-
for field,
|
|
34250
|
+
for field, matchp in matchPatterns.items():
|
|
34250
34251
|
if field == 'email':
|
|
34251
|
-
if not
|
|
34252
|
-
if not
|
|
34252
|
+
if not matchp['not']:
|
|
34253
|
+
if not matchp['pattern'].match(groupEmail):
|
|
34253
34254
|
return False
|
|
34254
34255
|
else:
|
|
34255
|
-
if
|
|
34256
|
+
if matchp['pattern'].match(groupEmail):
|
|
34256
34257
|
return False
|
|
34257
34258
|
elif field == 'adminCreated':
|
|
34258
|
-
if
|
|
34259
|
+
if matchp != group[field]:
|
|
34259
34260
|
return False
|
|
34260
34261
|
else: # field in {'name', 'displayName', 'description'}:
|
|
34261
|
-
if not
|
|
34262
|
-
if not
|
|
34262
|
+
if not matchp['not']:
|
|
34263
|
+
if not matchp['pattern'].match(group[field]):
|
|
34263
34264
|
return False
|
|
34264
34265
|
else:
|
|
34265
|
-
if
|
|
34266
|
+
if matchp['pattern'].match(group[field]):
|
|
34266
34267
|
return False
|
|
34267
34268
|
return True
|
|
34268
34269
|
|
|
@@ -34416,11 +34417,11 @@ def doPrintGroups():
|
|
|
34416
34417
|
if matchSettings:
|
|
34417
34418
|
if not isinstance(groupSettings, dict):
|
|
34418
34419
|
return
|
|
34419
|
-
for key,
|
|
34420
|
+
for key, matchp in matchSettings.items():
|
|
34420
34421
|
gvalue = groupSettings.get(key)
|
|
34421
|
-
if
|
|
34422
|
+
if matchp['notvalues'] and gvalue in matchp['notvalues']:
|
|
34422
34423
|
return
|
|
34423
|
-
if
|
|
34424
|
+
if matchp['values'] and gvalue not in matchp['values']:
|
|
34424
34425
|
return
|
|
34425
34426
|
if showOwnedBy and not checkGroupShowOwnedBy(showOwnedBy, groupMembers):
|
|
34426
34427
|
return
|
|
@@ -34458,7 +34459,7 @@ def doPrintGroups():
|
|
|
34458
34459
|
addMemberInfoToRow(row, groupMembers, typesSet, memberOptions, memberDisplayOptions, delimiter,
|
|
34459
34460
|
isSuspended, isArchived, False)
|
|
34460
34461
|
if isinstance(groupSettings, dict):
|
|
34461
|
-
for key, value in
|
|
34462
|
+
for key, value in groupSettings.items():
|
|
34462
34463
|
if key not in {'kind', 'etag', 'email', 'name', 'description'}:
|
|
34463
34464
|
if value is None:
|
|
34464
34465
|
value = ''
|
|
@@ -34469,12 +34470,12 @@ def doPrintGroups():
|
|
|
34469
34470
|
row[key] = value
|
|
34470
34471
|
groupCloudEntity = ciGroups.get(row['email'], {})
|
|
34471
34472
|
if groupCloudEntity:
|
|
34472
|
-
for k, v in
|
|
34473
|
+
for k, v in groupCloudEntity.pop('labels', {}).items():
|
|
34473
34474
|
if v == '':
|
|
34474
34475
|
groupCloudEntity[f'labels{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{k}'] = True
|
|
34475
34476
|
else:
|
|
34476
34477
|
groupCloudEntity[f'labels{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{k}'] = v
|
|
34477
|
-
for key, value in sorted(
|
|
34478
|
+
for key, value in sorted(flattenJSON({'cloudIdentity': groupCloudEntity}, flattened={}, timeObjects=CIGROUP_TIME_OBJECTS).items()):
|
|
34478
34479
|
csvPF.AddTitles(key)
|
|
34479
34480
|
row[key] = value
|
|
34480
34481
|
csvPF.WriteRow(row)
|
|
@@ -34618,11 +34619,11 @@ def doPrintGroups():
|
|
|
34618
34619
|
elif myarg == 'maxresults':
|
|
34619
34620
|
maxResults = getInteger(minVal=1, maxVal=200)
|
|
34620
34621
|
elif myarg == 'nodeprecated':
|
|
34621
|
-
deprecatedAttributesSet.update([attr[0] for attr in
|
|
34622
|
-
deprecatedAttributesSet.update([attr[0] for attr in
|
|
34623
|
-
deprecatedAttributesSet.update([attr[0] for attr in
|
|
34624
|
-
deprecatedAttributesSet.update([attr[0] for attr in
|
|
34625
|
-
deprecatedAttributesSet.update([attr[0] for attr in
|
|
34622
|
+
deprecatedAttributesSet.update([attr[0] for attr in GROUP_DISCOVER_ATTRIBUTES.values()])
|
|
34623
|
+
deprecatedAttributesSet.update([attr[0] for attr in GROUP_ASSIST_CONTENT_ATTRIBUTES.values()])
|
|
34624
|
+
deprecatedAttributesSet.update([attr[0] for attr in GROUP_MODERATE_CONTENT_ATTRIBUTES.values()])
|
|
34625
|
+
deprecatedAttributesSet.update([attr[0] for attr in GROUP_MODERATE_MEMBERS_ATTRIBUTES.values()])
|
|
34626
|
+
deprecatedAttributesSet.update([attr[0] for attr in GROUP_DEPRECATED_ATTRIBUTES.values()])
|
|
34626
34627
|
elif myarg in {'convertcrnl', 'converttextnl', 'convertfooternl'}:
|
|
34627
34628
|
convertCRNL = True
|
|
34628
34629
|
elif myarg == 'delimiter':
|
|
@@ -34670,7 +34671,7 @@ def doPrintGroups():
|
|
|
34670
34671
|
valueList = getChoice({'not': 'notvalues'}, mapChoice=True, defaultChoice='values')
|
|
34671
34672
|
matchBody = {}
|
|
34672
34673
|
getGroupAttrValue(getString(Cmd.OB_FIELD_NAME).lower(), matchBody)
|
|
34673
|
-
for key, value in
|
|
34674
|
+
for key, value in matchBody.items():
|
|
34674
34675
|
matchSettings.setdefault(key, {'notvalues': [], 'values': []})
|
|
34675
34676
|
matchSettings[key][valueList].append(value)
|
|
34676
34677
|
elif getPGGroupRolesMemberDisplayOptions(myarg, rolesSet, memberDisplayOptions):
|
|
@@ -34851,13 +34852,13 @@ def doPrintGroups():
|
|
|
34851
34852
|
if sortHeaders:
|
|
34852
34853
|
sortTitles = ['email']+GROUP_INFO_PRINT_ORDER+['aliases', 'nonEditableAliases']
|
|
34853
34854
|
if getSettings:
|
|
34854
|
-
sortTitles += sorted([attr[0] for attr in
|
|
34855
|
+
sortTitles += sorted([attr[0] for attr in GROUP_SETTINGS_ATTRIBUTES.values()])
|
|
34855
34856
|
for key in GROUP_MERGED_ATTRIBUTES_PRINT_ORDER:
|
|
34856
34857
|
sortTitles.append(key)
|
|
34857
34858
|
if not deprecatedAttributesSet:
|
|
34858
|
-
sortTitles += sorted([attr[0] for attr in
|
|
34859
|
+
sortTitles += sorted([attr[0] for attr in GROUP_MERGED_TO_COMPONENT_MAP[key].values()])
|
|
34859
34860
|
if not deprecatedAttributesSet:
|
|
34860
|
-
sortTitles += sorted([attr[0] for attr in
|
|
34861
|
+
sortTitles += sorted([attr[0] for attr in GROUP_DEPRECATED_ATTRIBUTES.values()])
|
|
34861
34862
|
if rolesSet:
|
|
34862
34863
|
setMemberDisplaySortTitles(memberDisplayOptions, sortTitles)
|
|
34863
34864
|
csvPF.SetSortTitles(sortTitles)
|
|
@@ -35848,7 +35849,7 @@ def doUpdateCIGroups():
|
|
|
35848
35849
|
elif myarg in ['memberrestriction', 'memberrestrictions']:
|
|
35849
35850
|
query = getString(Cmd.OB_QUERY, minLen=0)
|
|
35850
35851
|
member_types = {'USER': '1', 'SERVICE_ACCOUNT': '2', 'GROUP': '3',}
|
|
35851
|
-
for key, val in
|
|
35852
|
+
for key, val in member_types.items():
|
|
35852
35853
|
query = query.replace(key, val)
|
|
35853
35854
|
se_body['memberRestriction'] = {'query': query}
|
|
35854
35855
|
elif myarg == 'locked':
|
|
@@ -35864,7 +35865,7 @@ def doUpdateCIGroups():
|
|
|
35864
35865
|
if gs_body:
|
|
35865
35866
|
gs = buildGAPIObject(API.GROUPSSETTINGS)
|
|
35866
35867
|
gs_body = getSettingsFromGroup(cd, ','.join(entityList), gs, gs_body)
|
|
35867
|
-
for k, v in
|
|
35868
|
+
for k, v in GROUP_CIGROUP_FIELDS_MAP.items():
|
|
35868
35869
|
if k in gs_body:
|
|
35869
35870
|
ci_body[v] = gs_body.pop(k)
|
|
35870
35871
|
if gs_body:
|
|
@@ -36817,12 +36818,12 @@ def doPrintCIGroups():
|
|
|
36817
36818
|
csvPF.WriteRowNoFilter(row)
|
|
36818
36819
|
return
|
|
36819
36820
|
mapCIGroupFieldNames(groupEntity)
|
|
36820
|
-
for k, v in
|
|
36821
|
+
for k, v in groupEntity.pop('labels', {}).items():
|
|
36821
36822
|
if v == '':
|
|
36822
36823
|
groupEntity[f'labels{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{k}'] = True
|
|
36823
36824
|
else:
|
|
36824
36825
|
groupEntity[f'labels{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{k}'] = v
|
|
36825
|
-
for key, value in sorted(
|
|
36826
|
+
for key, value in sorted(flattenJSON(groupEntity, flattened={}, timeObjects=CIGROUP_TIME_OBJECTS).items()):
|
|
36826
36827
|
csvPF.AddTitles(key)
|
|
36827
36828
|
row[key] = value
|
|
36828
36829
|
if rolesSet and groupMembers is not None:
|
|
@@ -36832,11 +36833,11 @@ def doPrintCIGroups():
|
|
|
36832
36833
|
|
|
36833
36834
|
ci = buildGAPIObject(API.CLOUDIDENTITY_GROUPS)
|
|
36834
36835
|
setTrueCustomerId()
|
|
36836
|
+
parent = f'customers/{GC.Values[GC.CUSTOMER_ID]}'
|
|
36835
36837
|
delimiter = GC.Values[GC.CSV_OUTPUT_FIELD_DELIMITER]
|
|
36836
36838
|
memberRestrictions = sortHeaders = False
|
|
36837
36839
|
memberDisplayOptions = initPGGroupMemberDisplayOptions()
|
|
36838
36840
|
pageSize = 500
|
|
36839
|
-
parent = f'customers/{GC.Values[GC.CUSTOMER_ID]}'
|
|
36840
36841
|
groupFieldsLists = {'ci': ['groupKey']}
|
|
36841
36842
|
csvPF = CSVPrintFile(['email'])
|
|
36842
36843
|
FJQC = FormatJSONQuoteChar(csvPF)
|
|
@@ -36854,7 +36855,7 @@ def doPrintCIGroups():
|
|
|
36854
36855
|
showOwnedBy = convertUIDtoEmailAddress(getEmailAddress(), emailTypes=['user'])
|
|
36855
36856
|
elif myarg in {'cimember', 'enterprisemember', 'ciowner'}:
|
|
36856
36857
|
emailAddress = convertUIDtoEmailAddress(getEmailAddress(), emailTypes=['user', 'group'])
|
|
36857
|
-
memberQuery = f"member_key_id == '{emailAddress}' && '{CIGROUP_DISCUSSION_FORUM_LABEL}' in labels"
|
|
36858
|
+
memberQuery = f"member_key_id == '{emailAddress}' && '{CIGROUP_DISCUSSION_FORUM_LABEL}' in labels && parent == '{parent}'"
|
|
36858
36859
|
entitySelection = None
|
|
36859
36860
|
if myarg == 'ciowner':
|
|
36860
36861
|
showOwnedBy = emailAddress
|
|
@@ -37256,6 +37257,7 @@ def _getCIListGroupMembersArgs(listView):
|
|
|
37256
37257
|
def doPrintCIGroupMembers():
|
|
37257
37258
|
ci = buildGAPIObject(API.CLOUDIDENTITY_GROUPS)
|
|
37258
37259
|
setTrueCustomerId()
|
|
37260
|
+
parent = f'customers/{GC.Values[GC.CUSTOMER_ID]}'
|
|
37259
37261
|
memberOptions = initMemberOptions()
|
|
37260
37262
|
memberDisplayOptions = initIPSGMGroupMemberDisplayOptions()
|
|
37261
37263
|
groupColumn = True
|
|
@@ -37277,7 +37279,7 @@ def doPrintCIGroupMembers():
|
|
|
37277
37279
|
showOwnedBy = convertUIDtoEmailAddress(getEmailAddress(), emailTypes=['user'])
|
|
37278
37280
|
elif myarg in {'cimember', 'enterprisemember', 'ciowner'}:
|
|
37279
37281
|
emailAddress = convertUIDtoEmailAddress(getEmailAddress(), emailTypes=['user', 'group'])
|
|
37280
|
-
query = f"member_key_id == '{emailAddress}' && '{CIGROUP_DISCUSSION_FORUM_LABEL}' in labels"
|
|
37282
|
+
query = f"member_key_id == '{emailAddress}' && '{CIGROUP_DISCUSSION_FORUM_LABEL}' in labels && parent == '{parent}'"
|
|
37281
37283
|
entityList = None
|
|
37282
37284
|
if myarg == 'ciowner':
|
|
37283
37285
|
showOwnedBy = emailAddress
|
|
@@ -37479,6 +37481,7 @@ def doShowCIGroupMembers():
|
|
|
37479
37481
|
|
|
37480
37482
|
ci = buildGAPIObject(API.CLOUDIDENTITY_GROUPS)
|
|
37481
37483
|
setTrueCustomerId()
|
|
37484
|
+
parent = f'customers/{GC.Values[GC.CUSTOMER_ID]}'
|
|
37482
37485
|
subTitle = f'{Msg.ALL} {Ent.Plural(Ent.CLOUD_IDENTITY_GROUP)}'
|
|
37483
37486
|
groupFieldsLists = {'ci': ['groupKey', 'name']}
|
|
37484
37487
|
entityList = query = showOwnedBy = None
|
|
@@ -37496,7 +37499,7 @@ def doShowCIGroupMembers():
|
|
|
37496
37499
|
showOwnedBy = convertUIDtoEmailAddress(getEmailAddress(), emailTypes=['user'])
|
|
37497
37500
|
elif myarg in {'cimember', 'enterprisemember', 'ciowner'}:
|
|
37498
37501
|
emailAddress = convertUIDtoEmailAddress(getEmailAddress(), emailTypes=['user', 'group'])
|
|
37499
|
-
query = f"member_key_id == '{emailAddress}' && '{CIGROUP_DISCUSSION_FORUM_LABEL}' in labels"
|
|
37502
|
+
query = f"member_key_id == '{emailAddress}' && '{CIGROUP_DISCUSSION_FORUM_LABEL}' in labels parent == '{parent}'"
|
|
37500
37503
|
entityList = None
|
|
37501
37504
|
if myarg == 'ciowner':
|
|
37502
37505
|
showOwnedBy = emailAddress
|
|
@@ -38056,7 +38059,7 @@ def _getBuildingByNameOrId(cd, minLen=1, allowNV=False):
|
|
|
38056
38059
|
# No exact name match, check for case insensitive name matches
|
|
38057
38060
|
which_building_lower = which_building.lower()
|
|
38058
38061
|
ci_matches = []
|
|
38059
|
-
for buildingName, buildingId in
|
|
38062
|
+
for buildingName, buildingId in GM.Globals[GM.MAP_BUILDING_NAME_TO_ID].items():
|
|
38060
38063
|
if buildingName.lower() == which_building_lower:
|
|
38061
38064
|
ci_matches.append({'buildingName': buildingName, 'buildingId': buildingId})
|
|
38062
38065
|
# One match, return ID
|
|
@@ -39434,7 +39437,7 @@ def _getCalendarEventAttribute(myarg, body, parameters, function):
|
|
|
39434
39437
|
body.pop(field, None)
|
|
39435
39438
|
|
|
39436
39439
|
def clearJSONsubfields(body, clearFields):
|
|
39437
|
-
for field, subfields in
|
|
39440
|
+
for field, subfields in clearFields.items():
|
|
39438
39441
|
if field in body:
|
|
39439
39442
|
if isinstance(body[field], list):
|
|
39440
39443
|
for item in body[field]:
|
|
@@ -41720,7 +41723,7 @@ def _validateVaultQuery(body, corpusArgumentMap):
|
|
|
41720
41723
|
if 'searchMethod' not in body['query']:
|
|
41721
41724
|
missingArgumentExit(formatChoiceList(VAULT_SEARCH_METHODS_MAP))
|
|
41722
41725
|
if 'exportOptions' in body:
|
|
41723
|
-
for corpus, options in
|
|
41726
|
+
for corpus, options in VAULT_CORPUS_OPTIONS_MAP.items():
|
|
41724
41727
|
if body['query']['corpus'] != corpus:
|
|
41725
41728
|
body['exportOptions'].pop(options, None)
|
|
41726
41729
|
|
|
@@ -44425,7 +44428,7 @@ def updateUsers(entityList):
|
|
|
44425
44428
|
try:
|
|
44426
44429
|
result = callGAPI(cd.users(), 'update',
|
|
44427
44430
|
throwReasons=[GAPI.CONDITION_NOT_MET, GAPI.USER_NOT_FOUND, GAPI.DOMAIN_NOT_FOUND,
|
|
44428
|
-
GAPI.FORBIDDEN, GAPI.BAD_REQUEST,
|
|
44431
|
+
GAPI.FORBIDDEN, GAPI.BAD_REQUEST, GAPI.ADMIN_CANNOT_UNSUSPEND,
|
|
44429
44432
|
GAPI.INVALID, GAPI.INVALID_INPUT, GAPI.INVALID_PARAMETER,
|
|
44430
44433
|
GAPI.INVALID_ORGUNIT, GAPI.INVALID_SCHEMA_VALUE, GAPI.DUPLICATE,
|
|
44431
44434
|
GAPI.INSUFFICIENT_ARCHIVED_USER_LICENSES, GAPI.CONFLICT],
|
|
@@ -44487,7 +44490,8 @@ def updateUsers(entityList):
|
|
|
44487
44490
|
entityActionFailedWarning([Ent.USER, user, Ent.USER, body['primaryEmail']], str(e), i, count)
|
|
44488
44491
|
except GAPI.invalidOrgunit:
|
|
44489
44492
|
entityActionFailedWarning([Ent.USER, user], Msg.INVALID_ORGUNIT, i, count)
|
|
44490
|
-
except (GAPI.resourceNotFound, GAPI.domainNotFound, GAPI.domainCannotUseApis,
|
|
44493
|
+
except (GAPI.resourceNotFound, GAPI.domainNotFound, GAPI.domainCannotUseApis,
|
|
44494
|
+
GAPI.forbidden, GAPI.badRequest, GAPI.adminCannotUnsuspend,
|
|
44491
44495
|
GAPI.invalid, GAPI.invalidInput, GAPI.invalidParameter, GAPI.insufficientArchivedUserLicenses,
|
|
44492
44496
|
GAPI.conflict, GAPI.badRequest, GAPI.backendError, GAPI.systemError, GAPI.conditionNotMet) as e:
|
|
44493
44497
|
entityActionFailedWarning([Ent.USER, user], str(e), i, count)
|
|
@@ -44655,12 +44659,14 @@ def suspendUnsuspendUsers(entityList):
|
|
|
44655
44659
|
try:
|
|
44656
44660
|
callGAPI(cd.users(), 'update',
|
|
44657
44661
|
throwReasons=[GAPI.USER_NOT_FOUND, GAPI.DOMAIN_NOT_FOUND,
|
|
44658
|
-
GAPI.DOMAIN_CANNOT_USE_APIS, GAPI.FORBIDDEN, GAPI.BAD_REQUEST
|
|
44662
|
+
GAPI.DOMAIN_CANNOT_USE_APIS, GAPI.FORBIDDEN, GAPI.BAD_REQUEST,
|
|
44663
|
+
GAPI.ADMIN_CANNOT_UNSUSPEND],
|
|
44659
44664
|
userKey=user, body=body)
|
|
44660
44665
|
entityActionPerformed([Ent.USER, user], i, count)
|
|
44661
44666
|
except GAPI.userNotFound:
|
|
44662
44667
|
entityUnknownWarning(Ent.USER, user, i, count)
|
|
44663
|
-
except (GAPI.domainNotFound, GAPI.domainCannotUseApis, GAPI.forbidden,
|
|
44668
|
+
except (GAPI.domainNotFound, GAPI.domainCannotUseApis, GAPI.forbidden,
|
|
44669
|
+
GAPI.badRequest, GAPI.adminCannotUnsuspend) as e:
|
|
44664
44670
|
entityActionFailedWarning([Ent.USER, user], str(e), i, count)
|
|
44665
44671
|
|
|
44666
44672
|
# gam suspend users <UserTypeEntity> [noactionifalias]
|
|
@@ -45003,7 +45009,7 @@ def _filterSchemaFields(userEntity, schemaParms):
|
|
|
45003
45009
|
customSchemas = {}
|
|
45004
45010
|
for schema in sorted(schemas):
|
|
45005
45011
|
if schema in schemaParms['selectedSchemaFields']:
|
|
45006
|
-
for field, value in sorted(
|
|
45012
|
+
for field, value in sorted(schemas[schema].items()):
|
|
45007
45013
|
if field not in schemaParms['selectedSchemaFields'][schema]:
|
|
45008
45014
|
continue
|
|
45009
45015
|
customSchemas.setdefault(schema, {})
|
|
@@ -45044,6 +45050,7 @@ def infoUsers(entityList):
|
|
|
45044
45050
|
|
|
45045
45051
|
cd = buildGAPIObject(API.DIRECTORY)
|
|
45046
45052
|
ci = None
|
|
45053
|
+
setTrueCustomerId()
|
|
45047
45054
|
getAliases = getBuildingNames = getCIGroupsTree = getGroups = getLicenses = getSchemas = not GC.Values[GC.QUICK_INFO_USER]
|
|
45048
45055
|
getGroupsTree = False
|
|
45049
45056
|
FJQC = FormatJSONQuoteChar()
|
|
@@ -45946,7 +45953,7 @@ def doPrintUsers(entityList=None):
|
|
|
45946
45953
|
if sortRows and orderBy == 'email':
|
|
45947
45954
|
csvPF.SortRows('primaryEmail', reverse=sortOrder == 'DESCENDING')
|
|
45948
45955
|
elif not FJQC.formatJSON:
|
|
45949
|
-
for domain, count in sorted(
|
|
45956
|
+
for domain, count in sorted(domainCounts.items()):
|
|
45950
45957
|
csvPF.WriteRowNoFilter({'domain': domain, 'count': count})
|
|
45951
45958
|
else:
|
|
45952
45959
|
csvPF.WriteRowNoFilter({'JSON': json.dumps(cleanJSON(domainCounts), ensure_ascii=False, sort_keys=True)})
|
|
@@ -46041,7 +46048,7 @@ def doPrintUserCountsByOrgUnit():
|
|
|
46041
46048
|
userCounts[orgUnitPath]['active'] += 1
|
|
46042
46049
|
userCounts[orgUnitPath]['total'] += 1
|
|
46043
46050
|
totalCounts = USER_COUNTS_ZERO_FIELDS.copy()
|
|
46044
|
-
for k, v in sorted(
|
|
46051
|
+
for k, v in sorted(userCounts.items()):
|
|
46045
46052
|
_printUserCounts(k, v)
|
|
46046
46053
|
for f in USER_COUNTS_FIELDS:
|
|
46047
46054
|
totalCounts[f] += v[f]
|
|
@@ -49545,7 +49552,7 @@ def doCourseAddItems(courseIdList, getEntityListArg):
|
|
|
49545
49552
|
addItems = getStringReturnInList(Cmd.OB_COURSE_ALIAS)
|
|
49546
49553
|
elif addType == Ent.COURSE_TOPIC:
|
|
49547
49554
|
addItems = getStringReturnInList(Cmd.OB_COURSE_TOPIC)
|
|
49548
|
-
else: # addType == Ent.COURSE_ANNOUNCEMENT:
|
|
49555
|
+
else: #elif addType == Ent.COURSE_ANNOUNCEMENT:
|
|
49549
49556
|
addItems = [getCourseAnnouncement(True)]
|
|
49550
49557
|
courseParticipantLists = None
|
|
49551
49558
|
else:
|
|
@@ -51850,7 +51857,7 @@ def transferCalendars(users):
|
|
|
51850
51857
|
body[field] = updateBody[field]
|
|
51851
51858
|
else:
|
|
51852
51859
|
body = {}
|
|
51853
|
-
for field, updateField in
|
|
51860
|
+
for field, updateField in updateBody.items():
|
|
51854
51861
|
if field not in appendFieldsList:
|
|
51855
51862
|
body[field] = updateField
|
|
51856
51863
|
callGAPI(targetCal.calendars(), 'patch',
|
|
@@ -52196,7 +52203,7 @@ def updateCalendarAttendees(users):
|
|
|
52196
52203
|
entityActionNotPerformedWarning([Ent.EVENT, eventSummary], Msg.USER_IS_NOT_ORGANIZER, k, kcount)
|
|
52197
52204
|
continue
|
|
52198
52205
|
needsUpdate = False
|
|
52199
|
-
for _, v in sorted(
|
|
52206
|
+
for _, v in sorted(attendeeMap.items()):
|
|
52200
52207
|
v['done'] = False
|
|
52201
52208
|
updatedAttendeesAdd = []
|
|
52202
52209
|
updatedAttendeesRemove = []
|
|
@@ -52252,7 +52259,7 @@ def updateCalendarAttendees(users):
|
|
|
52252
52259
|
entityPerformActionModifierNewValue([Ent.EVENT, eventSummary, Ent.ATTENDEE, oldAddr], Act.MODIFIER_WITH, update['email'], u, ucount)
|
|
52253
52260
|
updatedAttendeesAdd.append(attendee)
|
|
52254
52261
|
needsUpdate = True
|
|
52255
|
-
for newAddr, v in sorted(
|
|
52262
|
+
for newAddr, v in sorted(attendeeMap.items()):
|
|
52256
52263
|
if v['op'] == 'add' and not v['done']:
|
|
52257
52264
|
u += 1
|
|
52258
52265
|
v['done'] = True
|
|
@@ -52265,7 +52272,7 @@ def updateCalendarAttendees(users):
|
|
|
52265
52272
|
entityPerformAction([Ent.EVENT, eventSummary, Ent.ATTENDEE, newAddr], u, ucount)
|
|
52266
52273
|
updatedAttendeesAdd.append(attendee)
|
|
52267
52274
|
needsUpdate = True
|
|
52268
|
-
for newAddr, v in sorted(
|
|
52275
|
+
for newAddr, v in sorted(attendeeMap.items()):
|
|
52269
52276
|
if not v['done']:
|
|
52270
52277
|
u += 1
|
|
52271
52278
|
Act.Set(Act.SKIP)
|
|
@@ -54082,7 +54089,7 @@ def printDriveActivity(users):
|
|
|
54082
54089
|
if isinstance(v, (dict, list)):
|
|
54083
54090
|
_updateKnownUsers(v)
|
|
54084
54091
|
elif isinstance(structure, dict):
|
|
54085
|
-
for k, v in sorted(
|
|
54092
|
+
for k, v in sorted(structure.items()):
|
|
54086
54093
|
if k != 'knownUser':
|
|
54087
54094
|
if isinstance(v, (dict, list)):
|
|
54088
54095
|
_updateKnownUsers(v)
|
|
@@ -54329,7 +54336,7 @@ def printShowDriveSettings(users):
|
|
|
54329
54336
|
if title in fieldsList and title in feed:
|
|
54330
54337
|
printKeyValueList([title, None])
|
|
54331
54338
|
Ind.Increment()
|
|
54332
|
-
for item, value in sorted(
|
|
54339
|
+
for item, value in sorted(feed[title].items()):
|
|
54333
54340
|
printKeyValueList([item, delimiter.join(value)])
|
|
54334
54341
|
Ind.Decrement()
|
|
54335
54342
|
|
|
@@ -54345,7 +54352,7 @@ def printShowDriveSettings(users):
|
|
|
54345
54352
|
jcount = len(feed[title])
|
|
54346
54353
|
row[title] = jcount
|
|
54347
54354
|
j = 0
|
|
54348
|
-
for item, value in sorted(
|
|
54355
|
+
for item, value in sorted(feed[title].items()):
|
|
54349
54356
|
row[f'{title}{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{j:02d}{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{item}'] = delimiter.join(value)
|
|
54350
54357
|
j += 1
|
|
54351
54358
|
|
|
@@ -54423,7 +54430,7 @@ def printShowDriveSettings(users):
|
|
|
54423
54430
|
if 'maxImportSizes' in fieldsList and 'maxImportSizes' in fieldsList:
|
|
54424
54431
|
printKeyValueList(['maxImportSizes', None])
|
|
54425
54432
|
Ind.Increment()
|
|
54426
|
-
for setting, value in
|
|
54433
|
+
for setting, value in feed['maxImportSizes'].items():
|
|
54427
54434
|
printKeyValueList([setting, formatFileSize(int(value))])
|
|
54428
54435
|
Ind.Decrement()
|
|
54429
54436
|
if 'driveThemes' in fieldsList and 'driveThemes' in feed:
|
|
@@ -54445,7 +54452,7 @@ def printShowDriveSettings(users):
|
|
|
54445
54452
|
jcount = len(feed['maxImportSizes'])
|
|
54446
54453
|
row['maxImportSizes'] = jcount
|
|
54447
54454
|
j = 0
|
|
54448
|
-
for setting, value in
|
|
54455
|
+
for setting, value in feed['maxImportSizes'].items():
|
|
54449
54456
|
row[f'maxImportSizes{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{j}{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{setting}'] = formatFileSize(int(value))
|
|
54450
54457
|
j += 1
|
|
54451
54458
|
if 'driveThemes' in fieldsList and 'driveThemes' in feed:
|
|
@@ -54534,7 +54541,7 @@ def getFilePaths(drive, fileTree, initialResult, filePathInfo, addParentsToTree=
|
|
|
54534
54541
|
paths[parentId][lparentId] = filePathInfo['allPaths'][lparentId]
|
|
54535
54542
|
|
|
54536
54543
|
def _makeFilePaths(localPaths, fplist, filePaths, name, maxDepth):
|
|
54537
|
-
for k, v in
|
|
54544
|
+
for k, v in localPaths.items():
|
|
54538
54545
|
fplist.append(filePathInfo['ids'].get(k, ''))
|
|
54539
54546
|
if not v:
|
|
54540
54547
|
fp = fplist[:]
|
|
@@ -54640,28 +54647,28 @@ def _mapDriveProperties(f_file):
|
|
|
54640
54647
|
properties = f_file.pop('properties', [])
|
|
54641
54648
|
if appProperties:
|
|
54642
54649
|
f_file.setdefault('properties', [])
|
|
54643
|
-
for key, value in sorted(
|
|
54650
|
+
for key, value in sorted(appProperties.items()):
|
|
54644
54651
|
f_file['properties'].append({'key': key, 'value': value, 'visibility': 'PRIVATE'})
|
|
54645
54652
|
if properties:
|
|
54646
54653
|
f_file.setdefault('properties', [])
|
|
54647
|
-
for key, value in sorted(
|
|
54654
|
+
for key, value in sorted(properties.items()):
|
|
54648
54655
|
f_file['properties'].append({'key': key, 'value': value, 'visibility': 'PUBLIC'})
|
|
54649
54656
|
|
|
54650
54657
|
def _mapDriveFieldNames(f_file, user, parentsSubFields, mapToLabels):
|
|
54651
54658
|
if mapToLabels:
|
|
54652
|
-
for attrib, v2attrib in
|
|
54659
|
+
for attrib, v2attrib in API.DRIVE3_TO_DRIVE2_LABELS_MAP.items():
|
|
54653
54660
|
if attrib in f_file:
|
|
54654
54661
|
f_file.setdefault('labels', {})
|
|
54655
54662
|
f_file['labels'][v2attrib] = f_file.pop(attrib)
|
|
54656
|
-
for attrib, v2attrib in
|
|
54663
|
+
for attrib, v2attrib in API.DRIVE3_TO_DRIVE2_FILES_FIELDS_MAP.items():
|
|
54657
54664
|
if attrib in f_file:
|
|
54658
54665
|
f_file[v2attrib] = f_file.pop(attrib)
|
|
54659
54666
|
capabilities = f_file.get('capabilities')
|
|
54660
54667
|
if capabilities:
|
|
54661
|
-
for attrib, v2attrib in
|
|
54668
|
+
for attrib, v2attrib in API.DRIVE3_TO_DRIVE2_CAPABILITIES_FIELDS_MAP.items():
|
|
54662
54669
|
if attrib in capabilities:
|
|
54663
54670
|
f_file[v2attrib] = capabilities[attrib]
|
|
54664
|
-
for attrib, v2attrib in
|
|
54671
|
+
for attrib, v2attrib in API.DRIVE3_TO_DRIVE2_CAPABILITIES_NAMES_MAP.items():
|
|
54665
54672
|
if attrib in capabilities:
|
|
54666
54673
|
capabilities[v2attrib] = capabilities.pop(attrib)
|
|
54667
54674
|
if 'spaces' in f_file:
|
|
@@ -54685,7 +54692,7 @@ def _mapDriveFieldNames(f_file, user, parentsSubFields, mapToLabels):
|
|
|
54685
54692
|
_mapDrivePermissionNames(permission)
|
|
54686
54693
|
|
|
54687
54694
|
def _mapDriveRevisionNames(revision):
|
|
54688
|
-
for attrib, v2attrib in
|
|
54695
|
+
for attrib, v2attrib in API.DRIVE3_TO_DRIVE2_REVISIONS_FIELDS_MAP.items():
|
|
54689
54696
|
if attrib in revision:
|
|
54690
54697
|
revision[v2attrib] = revision.pop(attrib)
|
|
54691
54698
|
if 'lastModifyingUser' in revision:
|
|
@@ -56129,7 +56136,7 @@ class PermissionMatch():
|
|
|
56129
56136
|
@staticmethod
|
|
56130
56137
|
def CheckPermissionMatch(permission, permissionMatch):
|
|
56131
56138
|
match = False
|
|
56132
|
-
for field, value in
|
|
56139
|
+
for field, value in permissionMatch[1].items():
|
|
56133
56140
|
if field in {'type', 'role'}:
|
|
56134
56141
|
if permission.get(field, '') not in value:
|
|
56135
56142
|
break
|
|
@@ -56428,7 +56435,7 @@ class DriveListParameters():
|
|
|
56428
56435
|
if self.excludeTrashed:
|
|
56429
56436
|
self.AppendToQuery('trashed=false')
|
|
56430
56437
|
if self.fileIdEntity['query']:
|
|
56431
|
-
for queryTimeName, queryTimeValue in
|
|
56438
|
+
for queryTimeName, queryTimeValue in self.queryTimes.items():
|
|
56432
56439
|
self.fileIdEntity['query'] = self.fileIdEntity['query'].replace(f'#{queryTimeName}#', queryTimeValue)
|
|
56433
56440
|
self.fileIdEntity['query'] = _mapDrive2QueryToDrive3(self.fileIdEntity['query'])
|
|
56434
56441
|
if not fileIdEntity.get('shareddrive'):
|
|
@@ -56743,7 +56750,7 @@ def printFileList(users):
|
|
|
56743
56750
|
|
|
56744
56751
|
def writeMimeTypeCountsRow(user, sourceId, sourceName, mimeTypeInfo):
|
|
56745
56752
|
countTotal = sizeTotal = 0
|
|
56746
|
-
for mtinfo in
|
|
56753
|
+
for mtinfo in mimeTypeInfo.values():
|
|
56747
56754
|
countTotal += mtinfo['count']
|
|
56748
56755
|
sizeTotal += mtinfo['size']
|
|
56749
56756
|
row = {'Owner': user, 'Total': countTotal}
|
|
@@ -56754,7 +56761,7 @@ def printFileList(users):
|
|
|
56754
56761
|
row['Size'] = sizeTotal
|
|
56755
56762
|
if addCSVData:
|
|
56756
56763
|
row.update(addCSVData)
|
|
56757
|
-
for mimeType, mtinfo in sorted(
|
|
56764
|
+
for mimeType, mtinfo in sorted(mimeTypeInfo.items()):
|
|
56758
56765
|
row[f'{mimeType}'] = mtinfo['count']
|
|
56759
56766
|
if showMimeTypeSize:
|
|
56760
56767
|
row[f'{mimeType}:Size'] = mtinfo['size']
|
|
@@ -56956,7 +56963,7 @@ def printFileList(users):
|
|
|
56956
56963
|
fileNameTitle = 'name'
|
|
56957
56964
|
csvPF.RemoveTitles(['capabilities'])
|
|
56958
56965
|
if DLP.queryTimes and selectSubQuery:
|
|
56959
|
-
for queryTimeName, queryTimeValue in
|
|
56966
|
+
for queryTimeName, queryTimeValue in DLP.queryTimes.items():
|
|
56960
56967
|
selectSubQuery = selectSubQuery.replace(f'#{queryTimeName}#', queryTimeValue)
|
|
56961
56968
|
selectSubQuery = _mapDrive2QueryToDrive3(selectSubQuery)
|
|
56962
56969
|
if addCSVData:
|
|
@@ -57055,7 +57062,7 @@ def printFileList(users):
|
|
|
57055
57062
|
if incrementalPrint:
|
|
57056
57063
|
if countsOnly:
|
|
57057
57064
|
if summary != FILECOUNT_SUMMARY_NONE:
|
|
57058
|
-
for mimeType, mtinfo in
|
|
57065
|
+
for mimeType, mtinfo in mimeTypeInfo.items():
|
|
57059
57066
|
summaryMimeTypeInfo.setdefault(mimeType, {'count': 0, 'size': 0})
|
|
57060
57067
|
summaryMimeTypeInfo[mimeType]['count'] += mtinfo['count']
|
|
57061
57068
|
summaryMimeTypeInfo[mimeType]['size'] += mtinfo['size']
|
|
@@ -57135,7 +57142,7 @@ def printFileList(users):
|
|
|
57135
57142
|
if countsOnly:
|
|
57136
57143
|
if showSource:
|
|
57137
57144
|
if summary != FILECOUNT_SUMMARY_NONE:
|
|
57138
|
-
for mimeType, mtinfo in
|
|
57145
|
+
for mimeType, mtinfo in mimeTypeInfo.items():
|
|
57139
57146
|
summaryMimeTypeInfo.setdefault(mimeType, {'count': 0, 'size': 0})
|
|
57140
57147
|
summaryMimeTypeInfo[mimeType]['count'] += mtinfo['count']
|
|
57141
57148
|
summaryMimeTypeInfo[mimeType]['size'] += mtinfo['size']
|
|
@@ -57144,7 +57151,7 @@ def printFileList(users):
|
|
|
57144
57151
|
if countsOnly:
|
|
57145
57152
|
if not showSource:
|
|
57146
57153
|
if summary != FILECOUNT_SUMMARY_NONE:
|
|
57147
|
-
for mimeType, mtinfo in
|
|
57154
|
+
for mimeType, mtinfo in mimeTypeInfo.items():
|
|
57148
57155
|
summaryMimeTypeInfo.setdefault(mimeType, {'count': 0, 'size': 0})
|
|
57149
57156
|
summaryMimeTypeInfo[mimeType]['count'] += mtinfo['count']
|
|
57150
57157
|
summaryMimeTypeInfo[mimeType]['size'] += mtinfo['size']
|
|
@@ -57697,14 +57704,14 @@ def printShowFileCounts(users):
|
|
|
57697
57704
|
def showMimeTypeInfo(user, mimeTypeInfo, sharedDriveId, sharedDriveName, lastModification, i, count):
|
|
57698
57705
|
if summary != FILECOUNT_SUMMARY_NONE:
|
|
57699
57706
|
if count != 0:
|
|
57700
|
-
for mimeType, mtinfo in
|
|
57707
|
+
for mimeType, mtinfo in mimeTypeInfo.items():
|
|
57701
57708
|
summaryMimeTypeInfo.setdefault(mimeType, {'count': 0, 'size': 0})
|
|
57702
57709
|
summaryMimeTypeInfo[mimeType]['count'] += mtinfo['count']
|
|
57703
57710
|
summaryMimeTypeInfo[mimeType]['size'] += mtinfo['size']
|
|
57704
57711
|
if summary == FILECOUNT_SUMMARY_ONLY:
|
|
57705
57712
|
return
|
|
57706
57713
|
countTotal = sizeTotal = 0
|
|
57707
|
-
for mtinfo in
|
|
57714
|
+
for mtinfo in mimeTypeInfo.values():
|
|
57708
57715
|
countTotal += mtinfo['count']
|
|
57709
57716
|
sizeTotal += mtinfo['size']
|
|
57710
57717
|
if not csvPF:
|
|
@@ -57721,7 +57728,7 @@ def printShowFileCounts(users):
|
|
|
57721
57728
|
Ind.Increment()
|
|
57722
57729
|
if showLastModification:
|
|
57723
57730
|
_showLastModification(lastModification)
|
|
57724
|
-
for mimeType, mtinfo in sorted(
|
|
57731
|
+
for mimeType, mtinfo in sorted(mimeTypeInfo.items()):
|
|
57725
57732
|
if not showMimeTypeSize:
|
|
57726
57733
|
printKeyValueList([mimeType, mtinfo['count']])
|
|
57727
57734
|
else:
|
|
@@ -57738,7 +57745,7 @@ def printShowFileCounts(users):
|
|
|
57738
57745
|
_updateLastModificationRow(row, lastModification)
|
|
57739
57746
|
if addCSVData:
|
|
57740
57747
|
row.update(addCSVData)
|
|
57741
|
-
for mimeType, mtinfo in sorted(
|
|
57748
|
+
for mimeType, mtinfo in sorted(mimeTypeInfo.items()):
|
|
57742
57749
|
row[f'{mimeType}'] = mtinfo['count']
|
|
57743
57750
|
if showMimeTypeSize:
|
|
57744
57751
|
row[f'{mimeType}:Size'] = mtinfo['size']
|
|
@@ -58244,14 +58251,14 @@ def printShowFileShareCounts(users):
|
|
|
58244
58251
|
def showShareCounts(user, shareCounts, i, count):
|
|
58245
58252
|
if summary != FILECOUNT_SUMMARY_NONE:
|
|
58246
58253
|
if count != 0:
|
|
58247
|
-
for field, shareCount in
|
|
58254
|
+
for field, shareCount in shareCounts.items():
|
|
58248
58255
|
summaryShareCounts[field] += shareCount
|
|
58249
58256
|
if summary == FILECOUNT_SUMMARY_ONLY:
|
|
58250
58257
|
return
|
|
58251
58258
|
if not csvPF:
|
|
58252
58259
|
printEntity([Ent.USER, user, Ent.DRIVE_FILE_OR_FOLDER, shareCounts[FILESHARECOUNTS_TOTAL]], i, count)
|
|
58253
58260
|
Ind.Increment()
|
|
58254
|
-
for field, shareCount in
|
|
58261
|
+
for field, shareCount in shareCounts.items():
|
|
58255
58262
|
printKeyValueList([field, shareCount])
|
|
58256
58263
|
Ind.Decrement()
|
|
58257
58264
|
else:
|
|
@@ -59916,7 +59923,7 @@ def _copyPermissions(drive, user, i, count, j, jcount,
|
|
|
59916
59923
|
|
|
59917
59924
|
def getNonInheritedPermissions(permissions):
|
|
59918
59925
|
nonInheritedPermIds = set()
|
|
59919
|
-
for permissionId, permission in
|
|
59926
|
+
for permissionId, permission in permissions.items():
|
|
59920
59927
|
if not permission['inherited']:
|
|
59921
59928
|
nonInheritedPermIds.add(permissionId)
|
|
59922
59929
|
return nonInheritedPermIds
|
|
@@ -59940,7 +59947,7 @@ def _copyPermissions(drive, user, i, count, j, jcount,
|
|
|
59940
59947
|
copySourcePerms = {}
|
|
59941
59948
|
deleteTargetPermIds = set()
|
|
59942
59949
|
updateTargetPerms = {}
|
|
59943
|
-
for permissionId, permission in
|
|
59950
|
+
for permissionId, permission in sourcePerms.items():
|
|
59944
59951
|
kvList = permissionKVList(user, entityType, newFileTitle, permission)
|
|
59945
59952
|
if isPermissionCopyable(kvList, permission):
|
|
59946
59953
|
copySourcePerms[permissionId] = permission
|
|
@@ -59994,7 +60001,7 @@ def _copyPermissions(drive, user, i, count, j, jcount,
|
|
|
59994
60001
|
Act.Set(Act.COPY)
|
|
59995
60002
|
kcount = len(copySourcePerms)
|
|
59996
60003
|
k = 0
|
|
59997
|
-
for permissionId, permission in
|
|
60004
|
+
for permissionId, permission in copySourcePerms.items():
|
|
59998
60005
|
k += 1
|
|
59999
60006
|
kvList = permissionKVList(user, entityType, newFileTitle, permission)
|
|
60000
60007
|
permission.pop('id')
|
|
@@ -60067,7 +60074,7 @@ def _copyPermissions(drive, user, i, count, j, jcount,
|
|
|
60067
60074
|
Act.Set(Act.UPDATE)
|
|
60068
60075
|
kcount = len(updateTargetPerms)
|
|
60069
60076
|
k = 0
|
|
60070
|
-
for permissionId, permission in
|
|
60077
|
+
for permissionId, permission in updateTargetPerms.items():
|
|
60071
60078
|
k += 1
|
|
60072
60079
|
kvList = permissionKVList(user, entityType, newFileTitle, permission)
|
|
60073
60080
|
removeExpiration = permission['updates'].pop('removeExpiration', False)
|
|
@@ -61066,7 +61073,7 @@ def _updateMoveFilePermissions(drive, user, i, count,
|
|
|
61066
61073
|
Ind.Increment()
|
|
61067
61074
|
deleteSourcePerms = {}
|
|
61068
61075
|
addSourcePerms = {}
|
|
61069
|
-
for permissionId, permission in
|
|
61076
|
+
for permissionId, permission in sourcePerms.items():
|
|
61070
61077
|
kvList = permissionKVList(user, entityType, fileTitle, permission)
|
|
61071
61078
|
if isPermissionDeletable(kvList, permission):
|
|
61072
61079
|
pass
|
|
@@ -61077,7 +61084,7 @@ def _updateMoveFilePermissions(drive, user, i, count,
|
|
|
61077
61084
|
if kcount > 0:
|
|
61078
61085
|
Act.Set(Act.DELETE)
|
|
61079
61086
|
k = 0
|
|
61080
|
-
for permissionId, permission in
|
|
61087
|
+
for permissionId, permission in deleteSourcePerms.items():
|
|
61081
61088
|
k += 1
|
|
61082
61089
|
kvList = permissionKVList(user, entityType, fileTitle, permission)
|
|
61083
61090
|
try:
|
|
@@ -61104,7 +61111,7 @@ def _updateMoveFilePermissions(drive, user, i, count,
|
|
|
61104
61111
|
if kcount > 0:
|
|
61105
61112
|
Act.Set(Act.CREATE)
|
|
61106
61113
|
k = 0
|
|
61107
|
-
for permissionId, permission in
|
|
61114
|
+
for permissionId, permission in addSourcePerms.items():
|
|
61108
61115
|
k += 1
|
|
61109
61116
|
kvList = permissionKVList(user, entityType, fileTitle, permission)
|
|
61110
61117
|
permission.pop('id')
|
|
@@ -63423,7 +63430,7 @@ def transferOwnership(users):
|
|
|
63423
63430
|
else:
|
|
63424
63431
|
_identifyChildrenToTransfer(fileEntryInfo, user, i, count)
|
|
63425
63432
|
if csvPF:
|
|
63426
|
-
for xferFileId, fileInfo in
|
|
63433
|
+
for xferFileId, fileInfo in filesToTransfer.items():
|
|
63427
63434
|
row = {'OldOwner': user, 'NewOwner': newOwner, 'type': Ent.Singular(fileInfo['type']), 'id': xferFileId, 'name': fileInfo['name']}
|
|
63428
63435
|
if filepath:
|
|
63429
63436
|
addFilePathsToRow(drive, fileTree, fileTree[xferFileId]['info'], filePathInfo, csvPF, row)
|
|
@@ -63434,7 +63441,7 @@ def transferOwnership(users):
|
|
|
63434
63441
|
entityPerformActionNumItemsModifier([Ent.USER, user], kcount, Ent.DRIVE_FILE_OR_FOLDER, f'{Act.MODIFIER_TO} {Ent.Singular(Ent.USER)}: {newOwner}', i, count)
|
|
63435
63442
|
Ind.Increment()
|
|
63436
63443
|
k = 0
|
|
63437
|
-
for xferFileId, fileInfo in
|
|
63444
|
+
for xferFileId, fileInfo in filesToTransfer.items():
|
|
63438
63445
|
k += 1
|
|
63439
63446
|
entityType = fileInfo['type']
|
|
63440
63447
|
fileDesc = f'{fileInfo["name"]} ({xferFileId})'
|
|
@@ -63794,8 +63801,8 @@ def claimOwnership(users):
|
|
|
63794
63801
|
else:
|
|
63795
63802
|
_identifyChildrenToClaim(fileEntryInfo, user, i, count)
|
|
63796
63803
|
if csvPF:
|
|
63797
|
-
for oldOwner in filesToClaim:
|
|
63798
|
-
for claimFileId, fileInfo in
|
|
63804
|
+
for oldOwner, oldOwnerFilesToClaim in filesToClaim.items():
|
|
63805
|
+
for claimFileId, fileInfo in oldOwnerFilesToClaim.items():
|
|
63799
63806
|
row = {'NewOwner': user, 'OldOwner': oldOwner, 'type': Ent.Singular(fileInfo['type']), 'id': claimFileId, 'name': fileInfo['name']}
|
|
63800
63807
|
if filepath:
|
|
63801
63808
|
addFilePathsToRow(drive, fileTree, fileTree[claimFileId]['info'], filePathInfo, csvPF, row)
|
|
@@ -63806,10 +63813,10 @@ def claimOwnership(users):
|
|
|
63806
63813
|
entityPerformActionNumItems([Ent.USER, user], kcount, Ent.USER, i, count)
|
|
63807
63814
|
Ind.Increment()
|
|
63808
63815
|
k = 0
|
|
63809
|
-
for oldOwner in filesToClaim:
|
|
63816
|
+
for oldOwner, oldOwnerFilesToClaim in filesToClaim.items():
|
|
63810
63817
|
k += 1
|
|
63811
63818
|
_, userDomain = splitEmailAddress(oldOwner)
|
|
63812
|
-
lcount = len(
|
|
63819
|
+
lcount = len(oldOwnerFilesToClaim)
|
|
63813
63820
|
if userDomain == GC.Values[GC.DOMAIN] or userDomain in subdomains:
|
|
63814
63821
|
_, sourceDrive = buildGAPIServiceObject(API.DRIVE3, oldOwner, k, kcount)
|
|
63815
63822
|
if not sourceDrive:
|
|
@@ -63818,7 +63825,7 @@ def claimOwnership(users):
|
|
|
63818
63825
|
f'{Act.MODIFIER_FROM} {Ent.Singular(Ent.USER)}: {oldOwner}', k, kcount)
|
|
63819
63826
|
Ind.Increment()
|
|
63820
63827
|
l = 0
|
|
63821
|
-
for xferFileId, fileInfo in
|
|
63828
|
+
for xferFileId, fileInfo in oldOwnerFilesToClaim.items():
|
|
63822
63829
|
l += 1
|
|
63823
63830
|
entityType = fileInfo['type']
|
|
63824
63831
|
fileDesc = f'{fileInfo["name"]} ({xferFileId})'
|
|
@@ -63931,7 +63938,7 @@ def claimOwnership(users):
|
|
|
63931
63938
|
f'{Act.MODIFIER_FROM} {Ent.Singular(Ent.USER)}: {oldOwner}', j, jcount)
|
|
63932
63939
|
Ind.Increment()
|
|
63933
63940
|
l = 0
|
|
63934
|
-
for xferFileId, fileInfo in
|
|
63941
|
+
for xferFileId, fileInfo in oldOwnerFilesToClaim.items():
|
|
63935
63942
|
l += 1
|
|
63936
63943
|
entityActionNotPerformedWarning([Ent.USER, user, fileInfo['type'], f'{fileInfo["name"]} ({xferFileId})'],
|
|
63937
63944
|
Msg.USER_IN_OTHER_DOMAIN.format(Ent.Singular(Ent.USER), oldOwner), l, lcount)
|
|
@@ -66269,7 +66276,7 @@ SHAREDDRIVE_API_GUI_ROLES_MAP = {
|
|
|
66269
66276
|
def _getSharedDriveRole(shareddrive):
|
|
66270
66277
|
if 'capabilities' not in shareddrive:
|
|
66271
66278
|
return None
|
|
66272
|
-
for role, capabilities in
|
|
66279
|
+
for role, capabilities in SHAREDDRIVE_ROLES_CAPABILITIES_MAP.items():
|
|
66273
66280
|
match = True
|
|
66274
66281
|
for capability in capabilities:
|
|
66275
66282
|
if capabilities[capability] != shareddrive['capabilities'].get(capability, ''):
|
|
@@ -67002,7 +67009,7 @@ def printSharedDriveOrganizers(users, useDomainAdminAccess=False):
|
|
|
67002
67009
|
delimiter = GC.Values[GC.CSV_OUTPUT_FIELD_DELIMITER]
|
|
67003
67010
|
roles = set(['organizer'])
|
|
67004
67011
|
includeTypes = set()
|
|
67005
|
-
showNoOrganizerDrives = SHOW_NO_PERMISSIONS_DRIVES_CHOICE_MAP['
|
|
67012
|
+
showNoOrganizerDrives = SHOW_NO_PERMISSIONS_DRIVES_CHOICE_MAP['true']
|
|
67006
67013
|
fieldsList = ['role', 'type', 'emailAddress']
|
|
67007
67014
|
cd = entityList = orgUnitId = query = matchPattern = None
|
|
67008
67015
|
domainList = set([(GC.Values[GC.DOMAIN] if GC.Values[GC.DOMAIN] else _getValueFromOAuth('hd'))])
|
|
@@ -69692,12 +69699,12 @@ def _printShowTokens(entityType, users):
|
|
|
69692
69699
|
performActionNumItems(jcount, Ent.ACCESS_TOKEN)
|
|
69693
69700
|
Ind.Increment()
|
|
69694
69701
|
j = 0
|
|
69695
|
-
for _, token in sorted(
|
|
69702
|
+
for _, token in sorted(aggregateTokensById.items()):
|
|
69696
69703
|
j += 1
|
|
69697
69704
|
_showToken(token, tokenTitle, aggregateUsersBy, j, jcount)
|
|
69698
69705
|
Ind.Decrement()
|
|
69699
69706
|
else:
|
|
69700
|
-
for _, token in sorted(
|
|
69707
|
+
for _, token in sorted(aggregateTokensById.items()):
|
|
69701
69708
|
_printToken(token)
|
|
69702
69709
|
elif aggregateUsersBy == 'displayText':
|
|
69703
69710
|
if not csvPF:
|
|
@@ -69705,24 +69712,24 @@ def _printShowTokens(entityType, users):
|
|
|
69705
69712
|
performActionNumItems(jcount, Ent.ACCESS_TOKEN)
|
|
69706
69713
|
Ind.Increment()
|
|
69707
69714
|
j = 0
|
|
69708
|
-
for _, tokenIds in sorted(
|
|
69715
|
+
for _, tokenIds in sorted(tokenNameIdMap.items()):
|
|
69709
69716
|
for tokcid in sorted(tokenIds):
|
|
69710
69717
|
j += 1
|
|
69711
69718
|
_showToken(aggregateTokensById[tokcid], tokenTitle, aggregateUsersBy, j, jcount)
|
|
69712
69719
|
Ind.Decrement()
|
|
69713
69720
|
else:
|
|
69714
|
-
for _, tokenIds in sorted(
|
|
69721
|
+
for _, tokenIds in sorted(tokenNameIdMap.items()):
|
|
69715
69722
|
for tokcid in sorted(tokenIds):
|
|
69716
69723
|
_printToken(aggregateTokensById[tokcid])
|
|
69717
69724
|
else: # aggregateUsersBy == 'user':
|
|
69718
69725
|
if not csvPF:
|
|
69719
69726
|
jcount = len(aggregateTokensById)
|
|
69720
69727
|
j = 0
|
|
69721
|
-
for user, count in sorted(
|
|
69728
|
+
for user, count in sorted(aggregateTokensById.items()):
|
|
69722
69729
|
j += 1
|
|
69723
69730
|
printEntityKVList([Ent.USER, user], [Ent.Plural(Ent.ACCESS_TOKEN), count], j, jcount)
|
|
69724
69731
|
else:
|
|
69725
|
-
for user, count in sorted(
|
|
69732
|
+
for user, count in sorted(aggregateTokensById.items()):
|
|
69726
69733
|
csvPF.WriteRow({'user': user, 'tokenCount': count})
|
|
69727
69734
|
if csvPF:
|
|
69728
69735
|
csvPF.writeCSVfile('OAuth Tokens')
|
|
@@ -70623,10 +70630,10 @@ def printShowLabels(users):
|
|
|
70623
70630
|
labelTree = _buildLabelTree(labels)
|
|
70624
70631
|
Ind.Increment()
|
|
70625
70632
|
if not showNested:
|
|
70626
|
-
for label, _ in sorted(
|
|
70633
|
+
for label, _ in sorted(labelTree.items(), key=lambda k: (k[1]['info']['type'], k[1]['info']['name'])):
|
|
70627
70634
|
_printFlatLabel(labelTree[label])
|
|
70628
70635
|
else:
|
|
70629
|
-
for label, _ in sorted(
|
|
70636
|
+
for label, _ in sorted(labelTree.items(), key=lambda k: (k[1]['info']['type'], k[1]['info']['name'])):
|
|
70630
70637
|
_printNestedLabel(labelTree[label])
|
|
70631
70638
|
Ind.Decrement()
|
|
70632
70639
|
else:
|
|
@@ -70804,7 +70811,7 @@ def _finalizeMessageSelectParameters(parameters, queryOrIdsRequired):
|
|
|
70804
70811
|
if parameters['labelGroupOpen']:
|
|
70805
70812
|
parameters['query'] += ')'
|
|
70806
70813
|
if parameters['queryTimes']:
|
|
70807
|
-
for queryTimeName, queryTimeValue in
|
|
70814
|
+
for queryTimeName, queryTimeValue in parameters['queryTimes'].items():
|
|
70808
70815
|
parameters['query'] = parameters['query'].replace(f'#{queryTimeName}#', queryTimeValue)
|
|
70809
70816
|
_mapMessageQueryDates(parameters)
|
|
70810
70817
|
elif queryOrIdsRequired and parameters['messageEntity'] is None and not parameters['labelIds']:
|
|
@@ -71690,7 +71697,7 @@ def _draftImportInsertMessage(users, operation):
|
|
|
71690
71697
|
message = MIMEText(tmpHTML, 'html', UTF8)
|
|
71691
71698
|
else:
|
|
71692
71699
|
message = MIMEText(tmpText, 'plain', UTF8)
|
|
71693
|
-
for header, value in
|
|
71700
|
+
for header, value in msgHeaders.items():
|
|
71694
71701
|
if substituteForUserInHeaders:
|
|
71695
71702
|
value = _substituteForUser(value, user, userName)
|
|
71696
71703
|
message[header] = Header()
|
|
@@ -71710,7 +71717,7 @@ def _draftImportInsertMessage(users, operation):
|
|
|
71710
71717
|
body = {'raw': base64.urlsafe_b64encode(bytes(tmpFile.read(), UTF8)).decode()}
|
|
71711
71718
|
tmpFile.close()
|
|
71712
71719
|
else:
|
|
71713
|
-
for header, value in
|
|
71720
|
+
for header, value in msgHeaders.items():
|
|
71714
71721
|
if substituteForUserInHeaders:
|
|
71715
71722
|
value = _substituteForUser(value, user, userName)
|
|
71716
71723
|
msgText = re.sub(fr'(?sm)\n{header}:.+?(?=[\r\n]+[a-zA-Z0-9-]+:)', f'\n{header}: {value}', msgText, 1)
|
|
@@ -72488,14 +72495,14 @@ def printShowMessagesThreads(users, entityType):
|
|
|
72488
72495
|
if onlyUser or positiveCountsOnly or labelMatchPattern:
|
|
72489
72496
|
for sender in senderLabelsMaps:
|
|
72490
72497
|
userLabelsMap = {}
|
|
72491
|
-
for labelId, label in
|
|
72498
|
+
for labelId, label in senderLabelsMaps[sender].items():
|
|
72492
72499
|
if (label['match'] and
|
|
72493
72500
|
(not onlyUser or label['type'] != LABEL_TYPE_SYSTEM) and
|
|
72494
72501
|
(not positiveCountsOnly or label['count'] > 0)):
|
|
72495
72502
|
userLabelsMap[labelId] = label
|
|
72496
72503
|
senderLabelsMaps[sender] = userLabelsMap
|
|
72497
72504
|
if not csvPF:
|
|
72498
|
-
for sender, labelsMap in sorted(
|
|
72505
|
+
for sender, labelsMap in sorted(senderLabelsMaps.items()):
|
|
72499
72506
|
jcount = len(labelsMap)
|
|
72500
72507
|
kvlist = [Ent.USER, user]
|
|
72501
72508
|
if senderMatchPattern:
|
|
@@ -72503,7 +72510,7 @@ def printShowMessagesThreads(users, entityType):
|
|
|
72503
72510
|
entityPerformActionNumItems(kvlist, jcount, Ent.LABEL, i, count)
|
|
72504
72511
|
Ind.Increment()
|
|
72505
72512
|
j = 0
|
|
72506
|
-
for label in sorted(
|
|
72513
|
+
for label in sorted(labelsMap.values(), key=lambda k: k['name']):
|
|
72507
72514
|
j += 1
|
|
72508
72515
|
if not show_size:
|
|
72509
72516
|
printEntityKVList([Ent.LABEL, label['name']], ['Count', label['count'], 'Type', label['type']], j, jcount)
|
|
@@ -72511,7 +72518,7 @@ def printShowMessagesThreads(users, entityType):
|
|
|
72511
72518
|
printEntityKVList([Ent.LABEL, label['name']], ['Count', label['count'], 'Size', label['size'], 'Type', label['type']], j, jcount)
|
|
72512
72519
|
Ind.Decrement()
|
|
72513
72520
|
else:
|
|
72514
|
-
for sender, labelsMap in sorted(
|
|
72521
|
+
for sender, labelsMap in sorted(senderLabelsMaps.items()):
|
|
72515
72522
|
row = {'User': user}
|
|
72516
72523
|
if senderMatchPattern:
|
|
72517
72524
|
row['Sender'] = sender
|
|
@@ -72520,7 +72527,7 @@ def printShowMessagesThreads(users, entityType):
|
|
|
72520
72527
|
label.pop('size', None)
|
|
72521
72528
|
if addCSVData:
|
|
72522
72529
|
row.update(addCSVData)
|
|
72523
|
-
csvPF.WriteRowTitles(flattenJSON({'Labels': sorted(
|
|
72530
|
+
csvPF.WriteRowTitles(flattenJSON({'Labels': sorted(labelsMap.values(), key=lambda k: k['name'])}, flattened=row))
|
|
72524
72531
|
elif not senderMatchPattern:
|
|
72525
72532
|
v = messageThreadCounts[parameters['listType']]
|
|
72526
72533
|
if not positiveCountsOnly or v > 0:
|
|
@@ -72536,11 +72543,11 @@ def printShowMessagesThreads(users, entityType):
|
|
|
72536
72543
|
else:
|
|
72537
72544
|
if not show_size:
|
|
72538
72545
|
if not csvPF:
|
|
72539
|
-
for k, v in sorted(
|
|
72546
|
+
for k, v in sorted(senderCounts.items()):
|
|
72540
72547
|
if not positiveCountsOnly or v['count'] > 0:
|
|
72541
72548
|
printEntityKVList([Ent.USER, user, Ent.SENDER, k], [parameters['listType'], v['count']], i, count)
|
|
72542
72549
|
else:
|
|
72543
|
-
for k, v in sorted(
|
|
72550
|
+
for k, v in sorted(senderCounts.items()):
|
|
72544
72551
|
if not positiveCountsOnly or v['count'] > 0:
|
|
72545
72552
|
row = {'User': user, 'Sender': k, parameters['listType']: v['count']}
|
|
72546
72553
|
if addCSVData:
|
|
@@ -72548,11 +72555,11 @@ def printShowMessagesThreads(users, entityType):
|
|
|
72548
72555
|
csvPF.WriteRow(row)
|
|
72549
72556
|
else:
|
|
72550
72557
|
if not csvPF:
|
|
72551
|
-
for k, v in sorted(
|
|
72558
|
+
for k, v in sorted(senderCounts.items()):
|
|
72552
72559
|
if not positiveCountsOnly or v['count'] > 0:
|
|
72553
72560
|
printEntityKVList([Ent.USER, user, Ent.SENDER, k], [parameters['listType'], v['count'], 'size', v['size']], i, count)
|
|
72554
72561
|
else:
|
|
72555
|
-
for k, v in sorted(
|
|
72562
|
+
for k, v in sorted(senderCounts.items()):
|
|
72556
72563
|
if not positiveCountsOnly or v['count'] > 0:
|
|
72557
72564
|
row = {'User': user, 'Sender': k, parameters['listType']: v['count'], 'size': v['size']}
|
|
72558
72565
|
if addCSVData:
|
|
@@ -73031,7 +73038,7 @@ def createFilter(users):
|
|
|
73031
73038
|
try:
|
|
73032
73039
|
lcount = len(addLabelIndicies)
|
|
73033
73040
|
l = 0
|
|
73034
|
-
for addLabelName, addLabelData in
|
|
73041
|
+
for addLabelName, addLabelData in addLabelIndicies.items():
|
|
73035
73042
|
l += 1
|
|
73036
73043
|
retries = 3
|
|
73037
73044
|
for _ in range(1, retries+1):
|
|
@@ -73513,7 +73520,7 @@ def printShowFormResponses(users):
|
|
|
73513
73520
|
else:
|
|
73514
73521
|
FJQC.GetFormatJSONQuoteChar(myarg, True)
|
|
73515
73522
|
if filterTimes and frfilter is not None:
|
|
73516
|
-
for filterTimeName, filterTimeValue in
|
|
73523
|
+
for filterTimeName, filterTimeValue in filterTimes.items():
|
|
73517
73524
|
frfilter = frfilter.replace(f'#{filterTimeName}#', filterTimeValue)
|
|
73518
73525
|
if csvPF:
|
|
73519
73526
|
if countsOnly:
|
|
@@ -78747,7 +78754,7 @@ def showAPICallsRetryData():
|
|
|
78747
78754
|
Ind.Reset()
|
|
78748
78755
|
writeStderr(Msg.API_CALLS_RETRY_DATA)
|
|
78749
78756
|
Ind.Increment()
|
|
78750
|
-
for k, v in sorted(
|
|
78757
|
+
for k, v in sorted(GM.Globals[GM.API_CALLS_RETRY_DATA].items()):
|
|
78751
78758
|
m, s = divmod(int(v[1]), 60)
|
|
78752
78759
|
h, m = divmod(m, 60)
|
|
78753
78760
|
writeStderr(formatKeyValueList(Ind.Spaces(), [k, f'{v[0]}/{h}:{m:02d}:{s:02d}'], '\n'))
|