mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-09 14:13:35 +00:00
When displaying license info to user, show Id and displayName if available (#603)
Plus documentation update thatgot left behind
This commit is contained in:
@ -553,7 +553,7 @@ Item attributes
|
||||
(customerid <String>)|
|
||||
(email|primaryemail|username <EmailAddress>)|
|
||||
(otheremail clear|(work|home|other|<String> <String>))|
|
||||
(externalid clear|(account|customer|network|organization|<String> <String>))|
|
||||
(externalid clear|(account|customer|login_id|network|organization|<String> <String>))|
|
||||
(firstname|givenname <String>)|
|
||||
(gal|includeinglobaladdresslist <Boolean>)|
|
||||
(im clear|(type work|home|other|(custom <String>) protocol aim|gtalk|icq|jabber|msn|net_meeting|qq|skype|yahoo|(custom_protocol <String>) <String> [notprimary|primary]))|
|
||||
@ -568,7 +568,7 @@ Item attributes
|
||||
(phone clear|([type work|home|other|work_fax|home_fax|other_fax|main|company_main|assistant|mobile|work_mobile|pager|work_pager|car|radio|callback|isdn|telex|tty_tdd|grand_central|(custom <String>)]
|
||||
[value <String>] notprimary|primary))|
|
||||
(posix clear|(username <String> uid <Integer> gid <Integer> [system|systemid <String>] [home|homedirectory <String>] [shell <String>] [gecos <String>] [primary <Boolean>] endposix))|
|
||||
(relation clear|(spouse|child|mother|father|parent|brother|sister|friend|relative|domestic_partner|manager|assistant|referred_by|partner|<String> <String>))|
|
||||
(relation clear|(spouse|child|mother|father|parent|brother|sister|friend|relative|domestic_partner|manager|dotted-line_managerassistant|admin_assistant|exec_assistant|referred_by|partner|<String> <String>))|
|
||||
(sshkeys clear|(key <String> [expires <Integer>] endssh))|
|
||||
(suspended <Boolean>)|
|
||||
(website clear|(home_page|blog|profile|work|home|other|ftp|reservations|app_install_page|<String> <URL> [notprimary|primary]))|
|
||||
|
14
src/gam.py
14
src/gam.py
@ -4799,10 +4799,10 @@ def doLicense(users, operation):
|
||||
if user.find(u'@') == -1:
|
||||
user = u'%s@%s' % (user, GC_Values[GC_DOMAIN])
|
||||
if operation == u'delete':
|
||||
print u'Removing license %s from user %s' % (_skuIdToDisplayName(skuId), user)
|
||||
print u'Removing license %s from user %s' % (_formatSKUIdDisplayName(skuId), user)
|
||||
callGAPI(lic.licenseAssignments(), operation, soft_errors=True, productId=productId, skuId=skuId, userId=user)
|
||||
elif operation == u'insert':
|
||||
print u'Adding license %s to user %s' % (_skuIdToDisplayName(skuId), user)
|
||||
print u'Adding license %s to user %s' % (_formatSKUIdDisplayName(skuId), user)
|
||||
callGAPI(lic.licenseAssignments(), operation, soft_errors=True, productId=productId, skuId=skuId, body={u'userId': user})
|
||||
elif operation == u'patch':
|
||||
try:
|
||||
@ -4813,7 +4813,7 @@ def doLicense(users, operation):
|
||||
print u'ERROR: You need to specify the user\'s old SKU as the last argument'
|
||||
sys.exit(2)
|
||||
_, old_sku = getProductAndSKU(old_sku)
|
||||
print u'Changing user %s from license %s to %s' % (user, _skuIdToDisplayName(old_sku), _skuIdToDisplayName(skuId))
|
||||
print u'Changing user %s from license %s to %s' % (user, _formatSKUIdDisplayName(old_sku), _formatSKUIdDisplayName(skuId))
|
||||
callGAPI(lic.licenseAssignments(), operation, soft_errors=True, productId=productId, skuId=old_sku, userId=user, body={u'skuId': skuId})
|
||||
|
||||
def doPop(users):
|
||||
@ -8776,11 +8776,17 @@ def doGetUserInfo(user_email=None):
|
||||
lbatch.add(lic.licenseAssignments().get(userId=user_email, productId=productId, skuId=skuId, fields=u'skuId'))
|
||||
lbatch.execute()
|
||||
for user_license in user_licenses:
|
||||
print ' %s' % _skuIdToDisplayName(user_license)
|
||||
print ' %s' % (_formatSKUIdDisplayName(user_license))
|
||||
|
||||
def _skuIdToDisplayName(skuId):
|
||||
return SKUS[skuId][u'displayName'] if skuId in SKUS else skuId
|
||||
|
||||
def _formatSKUIdDisplayName(skuId):
|
||||
skuIdDisplay = _skuIdToDisplayName(skuId)
|
||||
if skuId == skuIdDisplay:
|
||||
return skuId
|
||||
return u'{0} ({1})'.format(skuId, skuIdDisplay)
|
||||
|
||||
def doGetGroupInfo(group_name=None):
|
||||
cd = buildGAPIObject(u'directory')
|
||||
gs = buildGAPIObject(u'groupssettings')
|
||||
|
Reference in New Issue
Block a user