-make sure name exists in body before setting givenName or familyName.
-change if else for updateCmd to avoid a double negative
This commit is contained in:
Jay Lee
2016-08-19 12:44:27 -04:00
committed by GitHub
parent bbb70421ed
commit e1e49f8edf

View File

@ -6449,24 +6449,28 @@ def appendItemToBodyList(body, itemName, itemValue):
body[itemName].append(itemValue)
def getUserAttributes(i, updateCmd=False):
if not updateCmd:
if updateCmd:
body = {}
need_password = False
else:
body = {u'name': {u'givenName': u'Unknown', u'familyName': u'Unknown'}}
body[u'primaryEmail'] = sys.argv[i]
if body[u'primaryEmail'].find(u'@') == -1:
body[u'primaryEmail'] = u'%s@%s' % (body[u'primaryEmail'], GC_Values[GC_DOMAIN])
i += 1
need_password = True
else:
body = {}
need_password = False
need_to_hash_password = True
admin_body = {}
while i < len(sys.argv):
myarg = sys.argv[i].lower()
if myarg == u'firstname':
if u'name' not in body:
body[u'name'] = {}
body[u'name'][u'givenName'] = sys.argv[i+1]
i += 2
elif myarg == u'lastname':
if u'name' not in body:
body[u'name'] = {}
body[u'name'][u'familyName'] = sys.argv[i+1]
i += 2
elif myarg in [u'username', u'email', u'primaryemail'] and updateCmd: