Full support for archived user

This commit is contained in:
Jay Lee
2019-05-11 11:24:06 -04:00
parent af7b387f94
commit 690302f2b3
2 changed files with 29 additions and 6 deletions

View File

@@ -9714,6 +9714,8 @@ def doGetUserInfo(user_email=None):
print('Account Suspended: %s' % user['suspended'])
if 'suspensionReason' in user:
print('Suspension Reason: %s' % user['suspensionReason'])
if 'archived' in user:
print('Is Archived: %s' % user['archived'])
if 'changePasswordAtNextLogin' in user:
print('Must Change Password: %s' % user['changePasswordAtNextLogin'])
if 'id' in user:
@@ -12251,8 +12253,11 @@ def doPrintLicenses(returnFields=None, skus=None, countsOnly=False, returnCounts
fields = 'nextPageToken,items({0})'.format(returnFields)
if skus:
for sku in skus:
product, sku = getProductAndSKU(sku)
page_message = 'Got %%%%total_items%%%% Licenses for %s...\n' % sku
if not products:
product, sku = getProductAndSKU(sku)
else:
product = products[0]
page_message = 'Got %%%%total_items%%%% Licenses for %s...\n' % SKUS.get(sku, {'displayName': sku})['displayName']
try:
licenses += callGAPIpages(lic.licenseAssignments(), 'listForProductAndSku', 'items', throw_reasons=[GAPI_INVALID, GAPI_FORBIDDEN], page_message=page_message,
customerId=GC_Values[GC_DOMAIN], productId=product, skuId=sku, fields=fields)
@@ -12268,7 +12273,7 @@ def doPrintLicenses(returnFields=None, skus=None, countsOnly=False, returnCounts
products.append(sku['product'])
products.sort()
for productId in products:
page_message = 'Got %%%%total_items%%%% Licenses for %s...\n' % productId
page_message = 'Got %%%%total_items%%%% Licenses for %s...\n' % PRODUCTID_NAME_MAPPINGS.get(productId, productId)
try:
licenses += callGAPIpages(lic.licenseAssignments(), 'listForProduct', 'items', throw_reasons=[GAPI_INVALID, GAPI_FORBIDDEN], page_message=page_message,
customerId=GC_Values[GC_DOMAIN], productId=productId, fields=fields)

View File

@@ -62,11 +62,15 @@ SKUS = {
'Google-Apps-For-Postini': {
'product': 'Google-Apps', 'aliases': ['gams', 'postini', 'gsuitegams', 'gsuitepostini', 'gsuitemessagesecurity'], 'displayName': 'G Suite Message Security'},
'Google-Apps-Lite': {
'product': 'Google-Apps', 'aliases': ['gal', 'lite', 'gsuitelite'], 'displayName': 'G Suite Lite'},
'product': 'Google-Apps', 'aliases': ['gal', 'gsl', 'lite', 'gsuitelite'], 'displayName': 'G Suite Lite'},
'Google-Apps-Unlimited': {
'product': 'Google-Apps', 'aliases': ['gau', 'unlimited', 'gsuitebusiness'], 'displayName': 'G Suite Business'},
'product': 'Google-Apps', 'aliases': ['gau', 'gsb', 'unlimited', 'gsuitebusiness'], 'displayName': 'G Suite Business'},
'1010020020': {
'product': 'Google-Apps', 'aliases': ['gae', 'enterprise', 'gsuiteenterprise'], 'displayName': 'G Suite Enterprise'},
'product': 'Google-Apps', 'aliases': ['gae', 'gse', 'enterprise', 'gsuiteenterprise'], 'displayName': 'G Suite Enterprise'},
'1010340002': {
'product': '101034', 'aliases': ['gsbau', 'businessarchived', 'gsuitebusinessarchived'], 'displayName': 'G Suite Business Archived'},
'1010340001': {
'product': '101034', 'aliases': ['gseau', 'enterprisearchived', 'gsuiteenterprisearchived'], 'displayName': 'G Suite Enterprise Archived'},
'1010060001': {
'product': 'Google-Apps', 'aliases': ['d4e', 'driveenterprise', 'drive4enterprise'], 'displayName': 'Drive Enterprise'},
'Google-Drive-storage-20GB': {
@@ -97,6 +101,20 @@ SKUS = {
'product': 'Google-Chrome-Device-Management', 'aliases': ['chrome', 'cdm', 'googlechromedevicemanagement'], 'displayName': 'Google Chrome Device Management'}
}
PRODUCTID_NAME_MAPPINGS = {
'101001': 'Cloud Identity Free',
'101005': 'Cloud Identity Premium',
'101031': 'G Suite Enterprise for Education',
'101033': 'Google Voice',
'Google-Apps': 'G Suite',
'101034': 'G Suite Archived',
'101006': 'Drive Enterprise',
'Google-Drive-storage': 'Google Drive Storage',
'Google-Vault': 'Google Vault',
'Google-Coordinate': 'Google Coordinate',
'Google-Chrome-Device-Management': 'Google Chrome Device Management'
}
# Legacy APIs that use v1 discovery. Newer APIs should all use v2.
V1_DISCOVERY_APIS = {
'admin',