mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
Fixed bug in 'gam report users ... aggregatebydate|aggregatebyuser`
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
7.28.07
|
||||||
|
|
||||||
|
Fixed bug in 'gam report users ... aggregatebydate|aggregatebyuser` where `accounts:used_quota_in_percentage` was incorrectly displayed.
|
||||||
|
|
||||||
7.28.06
|
7.28.06
|
||||||
|
|
||||||
Updated `gam <UserTypeEntity> info|print|show calendars` and
|
Updated `gam <UserTypeEntity> info|print|show calendars` and
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
||||||
__version__ = '7.28.06'
|
__version__ = '7.28.07'
|
||||||
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
||||||
|
|
||||||
#pylint: disable=wrong-import-position
|
#pylint: disable=wrong-import-position
|
||||||
@@ -13999,6 +13999,12 @@ def doReport():
|
|||||||
csvPF.WriteRow(row)
|
csvPF.WriteRow(row)
|
||||||
return (True, lastDate)
|
return (True, lastDate)
|
||||||
|
|
||||||
|
def _computeUsedQuotaInPercentage(events):
|
||||||
|
if ('accounts:total_quota_in_mb' in events) and ('accounts:used_quota_in_mb' in events):
|
||||||
|
events['accounts:used_quota_in_percentage'] = int(events['accounts:used_quota_in_mb']/events['accounts:total_quota_in_mb']*100)
|
||||||
|
else:
|
||||||
|
events['accounts:used_quota_in_percentage'] = 0
|
||||||
|
|
||||||
# dynamically extend our choices with other reports Google dynamically adds
|
# dynamically extend our choices with other reports Google dynamically adds
|
||||||
rep = buildGAPIObject(API.REPORTS)
|
rep = buildGAPIObject(API.REPORTS)
|
||||||
dyn_choices = rep._rootDesc \
|
dyn_choices = rep._rootDesc \
|
||||||
@@ -14296,6 +14302,8 @@ def doReport():
|
|||||||
row = {'date': usageDate}
|
row = {'date': usageDate}
|
||||||
if addCSVData:
|
if addCSVData:
|
||||||
row.update(addCSVData)
|
row.update(addCSVData)
|
||||||
|
if 'accounts:used_quota_in_percentage' in events:
|
||||||
|
_computeUsedQuotaInPercentage(events)
|
||||||
for event, count in events.items():
|
for event, count in events.items():
|
||||||
if convertMbToGb and event.endswith('_in_gb'):
|
if convertMbToGb and event.endswith('_in_gb'):
|
||||||
count = f'{count/1024:.2f}'
|
count = f'{count/1024:.2f}'
|
||||||
@@ -14310,6 +14318,8 @@ def doReport():
|
|||||||
row['orgUnitPath'] = userOrgUnits.get(email, UNKNOWN)
|
row['orgUnitPath'] = userOrgUnits.get(email, UNKNOWN)
|
||||||
if addCSVData:
|
if addCSVData:
|
||||||
row.update(addCSVData)
|
row.update(addCSVData)
|
||||||
|
if 'accounts:used_quota_in_percentage' in events:
|
||||||
|
_computeUsedQuotaInPercentage(events)
|
||||||
for event, count in events.items():
|
for event, count in events.items():
|
||||||
if convertMbToGb and event.endswith('_in_gb'):
|
if convertMbToGb and event.endswith('_in_gb'):
|
||||||
count = f'{count/1024:.2f}'
|
count = f'{count/1024:.2f}'
|
||||||
@@ -17164,9 +17174,9 @@ def doPrintShowAdmins():
|
|||||||
admin['condition'] = 'securitygroup'
|
admin['condition'] = 'securitygroup'
|
||||||
elif admin['condition'] == NONSECURITY_GROUP_CONDITION:
|
elif admin['condition'] == NONSECURITY_GROUP_CONDITION:
|
||||||
admin['condition'] = 'nonsecuritygroup'
|
admin['condition'] = 'nonsecuritygroup'
|
||||||
if debug:
|
# if debug:
|
||||||
print('******', admin['assignedTo'], admin.get('assigneeType', 'no type'),
|
# print('******', admin['assignedTo'], admin.get('assigneeType', 'no type'),
|
||||||
admin['assignedToField'], not typesSet or admin['assignedToField'] in typesSet)
|
# admin['assignedToField'], not typesSet or admin['assignedToField'] in typesSet)
|
||||||
return not typesSet or admin['assignedToField'] in typesSet
|
return not typesSet or admin['assignedToField'] in typesSet
|
||||||
|
|
||||||
cd = buildGAPIObject(API.DIRECTORY)
|
cd = buildGAPIObject(API.DIRECTORY)
|
||||||
@@ -17174,7 +17184,8 @@ def doPrintShowAdmins():
|
|||||||
csvPF = CSVPrintFile(PRINT_ADMIN_TITLES) if Act.csvFormat() else None
|
csvPF = CSVPrintFile(PRINT_ADMIN_TITLES) if Act.csvFormat() else None
|
||||||
roleId = None
|
roleId = None
|
||||||
userKey = None
|
userKey = None
|
||||||
debug = oneItemPerRow = recursive = showPrivileges = False
|
# debug = False
|
||||||
|
oneItemPerRow = recursive = showPrivileges = False
|
||||||
typesSet = set()
|
typesSet = set()
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
rolePrivileges = {}
|
rolePrivileges = {}
|
||||||
@@ -17207,8 +17218,8 @@ def doPrintShowAdmins():
|
|||||||
showPrivileges = True
|
showPrivileges = True
|
||||||
elif myarg == 'oneitemperrow':
|
elif myarg == 'oneitemperrow':
|
||||||
oneItemPerRow = True
|
oneItemPerRow = True
|
||||||
elif myarg == 'debug':
|
# elif myarg == 'debug':
|
||||||
debug = True
|
# debug = True
|
||||||
else:
|
else:
|
||||||
unknownArgumentExit()
|
unknownArgumentExit()
|
||||||
if roleId and not kwargs:
|
if roleId and not kwargs:
|
||||||
|
|||||||
Reference in New Issue
Block a user