From a72ef287e3aeacb007b18fa3ca6458c915ca2159 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Fri, 15 Sep 2017 19:20:52 -0700 Subject: [PATCH] Minor locations/sshPublicKeys cleanup (#571) * Minor locations/sshPublicKeys cleanup Make options names internally consistent and consistent with other commands. Drop publicsshkeys, too may choices Change title to SSH Public Keys to match Google's title * Simplify UserAttributes --- src/GamCommands.txt | 24 +++++++++++++++--------- src/gam.py | 10 +++++----- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/GamCommands.txt b/src/GamCommands.txt index 2b5f2e1a..ed0bd840 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -380,13 +380,16 @@ Named items is2svenforced| is2svenrolled| lastlogintime| + locations|location| noneditablealiases|aliases|nicknames| notes|note| organizations|organization| orgunitpath|org|ou| phones|phone| + posixaccounts|posix| primaryemail|username| relations|relation| + ssh|sshkeys|sshpublickeys| suspended| thumbnailphotourl|photo|photourl| websites|website| @@ -541,7 +544,7 @@ Item attributes field (type bool|date|double|email|int64|phone|string) [multivalued|multivalue] [indexed] [restricted] [range ] endfield ::= - (address|addresses clear|(type work|home|other|(custom ) [unstructured|formatted ] [pobox ] [extendedaddress ] [streetaddress ] + (address clear|(type work|home|other|(custom ) [unstructured|formatted ] [pobox ] [extendedaddress ] [streetaddress ] [locality ] [region ] [postalcode ] [country ] [countrycode ] notprimary|primary))| (admin )| (agreed2terms|agreedtoterms )| @@ -549,23 +552,26 @@ Item attributes (crypt|sha|sha1|sha-1|md5|nohash)| (customerid )| (email|primaryemail|username )| - (emails|otheremail|otheremails clear|(work|home|other| ))| - (externalid|externalids clear|(account|customer|network|organization| ))| + (otheremail clear|(work|home|other| ))| + (externalid clear|(account|customer|network|organization| ))| (firstname|givenname )| (gal|includeinglobaladdresslist )| - (im|ims clear|(type work|home|other|(custom ) protocol aim|gtalk|icq|jabber|msn|net_meeting|qq|skype|yahoo|(custom_protocol ) [notprimary|primary]))| + (im clear|(type work|home|other|(custom ) protocol aim|gtalk|icq|jabber|msn|net_meeting|qq|skype|yahoo|(custom_protocol ) [notprimary|primary]))| (ipwhitelisted )| (lastname|familyname )| - (note|notes clear|([text_plain|text_html] |(file [charset ])))| - (organization|organizations clear|([type domain_only|school|unknown|work] [customtype ] [name ] [title ] [department ] [symbol ] + (location clear|(type default|desk| area [building|buildingid ] [floor|floorname ] [section|floorsection ] [desk|deskcode ] endlocation))| + (note clear|([text_plain|text_html] |(file [charset ])))| + (organization clear|([type domain_only|school|unknown|work] [customtype ] [name ] [title ] [department ] [symbol ] [costcenter ] [location ] [description ] [domain ] notprimary|primary))| (org|ou|orgunitpath ) (password random|)| - (phone|phones 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 )] + (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 )] [value ] notprimary|primary))| - (relation|relations clear|(spouse|child|mother|father|parent|brother|sister|friend|relative|domestic_partner|manager|assistant|referred_by|partner| ))| + (posix clear|(username uid gid [system|systemid ] [home|homedirectory ] [shell ] [gecos ] [primary ] endposix))| + (relation clear|(spouse|child|mother|father|parent|brother|sister|friend|relative|domestic_partner|manager|assistant|referred_by|partner| ))| + (sshkeys clear|(key [expires ] endssh))| (suspended )| - (website|websites clear|(home_page|blog|profile|work|home|other|ftp|reservations|app_install_page| [notprimary|primary]))| + (website clear|(home_page|blog|profile|work|home|other|ftp|reservations|app_install_page| [notprimary|primary]))| (. [multivalued|multivalue|value|multinonempty [type work|home|other|(custom )]] ) gam version [check] [simple] diff --git a/src/gam.py b/src/gam.py index 874e3c90..095e1d68 100755 --- a/src/gam.py +++ b/src/gam.py @@ -6767,7 +6767,7 @@ def getUserAttributes(i, cd, updateCmd=False): note[u'value'] = sys.argv[i].replace(u'\\n', u'\n') i += 1 body[u'notes'] = note - elif myarg == u'location': + elif myarg in [u'location', u'locations']: i += 1 if checkClearBodyList(i, body, u'locations'): i += 1 @@ -6803,7 +6803,7 @@ def getUserAttributes(i, cd, updateCmd=False): print u'ERROR: %s is not a valid argument for user location details. Make sure user location details end with an endlocation argument' sys.exit(3) appendItemToBodyList(body, u'locations', location) - elif myarg in [u'ssh', u'sshpublickeys', u'sshkeys']: + elif myarg in [u'ssh', u'sshkeys', u'sshpublickeys']: i += 1 if checkClearBodyList(i, body, u'sshPublicKeys'): i += 1 @@ -6824,7 +6824,7 @@ def getUserAttributes(i, cd, updateCmd=False): print u'ERROR: %s is not a valid argument for user ssh details. Make sure user ssh details end with an endssh argument' sys.exit(3) appendItemToBodyList(body, u'sshPublicKeys', ssh) - elif myarg in [u'posix', u'posixaccount']: + elif myarg in [u'posix', u'posixaccounts']: i += 1 if checkClearBodyList(i, body, u'posixAccounts'): i += 1 @@ -8614,7 +8614,7 @@ def doGetUserInfo(user_email=None): print utils.convertUTF8(u' %s: %s' % (key, location[key])) print u'' if u'sshPublicKeys' in user: - print u'Public SSH Keys:' + print u'SSH Public Keys:' for sshkey in user[u'sshPublicKeys']: for key in sshkey: print utils.convertUTF8(u' %s: %s' % (key, sshkey[key])) @@ -9724,7 +9724,7 @@ USER_ARGUMENT_TO_PROPERTY_MAP = { u'relations': [u'relations',], u'ssh': [u'sshPublicKeys',], u'sshkeys': [u'sshPublicKeys',], - u'publicsshkeys': [u'sshPublicKeys',], + u'sshpublickeys': [u'sshPublicKeys',], u'suspended': [u'suspended', u'suspensionReason',], u'thumbnailphotourl': [u'thumbnailPhotoUrl',], u'username': [u'primaryEmail',],