Make labels display useful (#1260)

With the existing code you get these columns:

labels.cloudidentity.googleapis.com/groups.discussion_forum,labels.cloudidentity.googleapis.com/groups.security

but there is no data in the columns so you can't tell whcih groups have which values; by translating '' to True you can.
This commit is contained in:
Ross Scroggs
2020-10-09 07:33:03 -07:00
committed by GitHub
parent bf29a56aeb
commit 55e5b86ec4

View File

@@ -237,6 +237,11 @@ def print_():
for groupEntity in entityList:
i += 1
groupEmail = groupEntity['groupKey']['id']
for k, v in iter(groupEntity.pop('labels', {}).items()):
if v == '':
groupEntity[f'labels.{k}'] = True
else:
groupEntity[f'labels.{k}'] = v
group = utils.flatten_json(groupEntity)
for a_key in group:
if a_key not in titles:
@@ -304,7 +309,7 @@ def print_():
csvRows.append(group)
if sortHeaders:
display.sort_csv_titles([
'Email',
'name', 'groupKey.id'
], titles)
display.write_csv_file(csvRows, titles, 'Groups', todrive)