mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-04 04:41:35 +00:00
Improve info|print users #1890
This commit is contained in:
@@ -5803,12 +5803,12 @@ gam download storagefile <StorageBucketObjectName>
|
|||||||
|
|
||||||
<UserClearAttribute> ::=
|
<UserClearAttribute> ::=
|
||||||
(address clear)|
|
(address clear)|
|
||||||
(otheremail clear)|
|
|
||||||
(externalid clear)|
|
(externalid clear)|
|
||||||
(im clear)|
|
(im clear)|
|
||||||
(keyword clear)|
|
(keyword clear)|
|
||||||
(location clear)|
|
(location clear)|
|
||||||
(organization clear)|
|
(organization clear)|
|
||||||
|
(otheremail clear)|
|
||||||
(phone clear)|
|
(phone clear)|
|
||||||
(posix clear)|
|
(posix clear)|
|
||||||
(relation clear)|
|
(relation clear)|
|
||||||
@@ -5821,6 +5821,18 @@ gam download storagefile <StorageBucketObjectName>
|
|||||||
<UserMultiAttribute>|
|
<UserMultiAttribute>|
|
||||||
<UserClearAttribute>
|
<UserClearAttribute>
|
||||||
|
|
||||||
|
<UserMultiAttributeFilterName> ::=
|
||||||
|
address|addresses|
|
||||||
|
externalid|externalids|
|
||||||
|
im|ims|
|
||||||
|
keyword|keywords|
|
||||||
|
location|locations|
|
||||||
|
orgainzation|organizations|
|
||||||
|
otheremail|otheremails|
|
||||||
|
phone|phones|
|
||||||
|
relation|relations|
|
||||||
|
website|websites
|
||||||
|
|
||||||
gam create|add user <EmailAddress> [ignorenullpassword] <UserAttribute>*
|
gam create|add user <EmailAddress> [ignorenullpassword] <UserAttribute>*
|
||||||
[verifynotinvitable|alwaysevict]
|
[verifynotinvitable|alwaysevict]
|
||||||
(groups [<GroupRole>] [[delivery] <DeliverySetting>] <GroupEntity>)*
|
(groups [<GroupRole>] [[delivery] <DeliverySetting>] <GroupEntity>)*
|
||||||
@@ -5875,6 +5887,8 @@ gam info user [<UserItem>]
|
|||||||
[nolicenses|nolicences|licenses|licences]
|
[nolicenses|nolicences|licenses|licences]
|
||||||
[noschemas|allschemas|(schemas|custom|customschemas <SchemaNameList>)]
|
[noschemas|allschemas|(schemas|custom|customschemas <SchemaNameList>)]
|
||||||
[userview] <UserFieldName>* [fields <UserFieldNameList>]
|
[userview] <UserFieldName>* [fields <UserFieldNameList>]
|
||||||
|
(filtermultiattrtype <UserMultiAttributeFilterName> <String>)*
|
||||||
|
(filtermultiattrcustom <UserMultiAttributeFilterName> <String>)*
|
||||||
[(products|product <ProductIDList>)|(skus|sku <SKUIDList>)]
|
[(products|product <ProductIDList>)|(skus|sku <SKUIDList>)]
|
||||||
[formatjson]
|
[formatjson]
|
||||||
|
|
||||||
@@ -5911,6 +5925,8 @@ gam info users <UserTypeEntity>
|
|||||||
[nolicenses|nolicences|licenses|licences]
|
[nolicenses|nolicences|licenses|licences]
|
||||||
[noschemas|allschemas|(schemas|custom|customschemas <SchemaNameList>)]
|
[noschemas|allschemas|(schemas|custom|customschemas <SchemaNameList>)]
|
||||||
[userview] <UserFieldName>* [fields <UserFieldNameList>]
|
[userview] <UserFieldName>* [fields <UserFieldNameList>]
|
||||||
|
(filtermultiattrtype <UserMultiAttributeFilterName> <String>)*
|
||||||
|
(filtermultiattrcustom <UserMultiAttributeFilterName> <String>)*
|
||||||
[(products|product <ProductIDList>)|(skus|sku <SKUIDList>)]
|
[(products|product <ProductIDList>)|(skus|sku <SKUIDList>)]
|
||||||
[formatjson]
|
[formatjson]
|
||||||
|
|
||||||
@@ -5947,6 +5963,8 @@ gam <UserTypeEntity> info users
|
|||||||
[nolicenses|nolicences|licenses|licences]
|
[nolicenses|nolicences|licenses|licences]
|
||||||
[noschemas|allschemas|(schemas|custom|customschemas <SchemaNameList>)]
|
[noschemas|allschemas|(schemas|custom|customschemas <SchemaNameList>)]
|
||||||
[userview] <UserFieldName>* [fields <UserFieldNameList>]
|
[userview] <UserFieldName>* [fields <UserFieldNameList>]
|
||||||
|
(filtermultiattrtype <UserMultiAttributeFilterName> <String>)*
|
||||||
|
(filtermultiattrcustom <UserMultiAttributeFilterName> <String>)*
|
||||||
[(products|product <ProductIDList>)|(skus|sku <SKUIDList>)]
|
[(products|product <ProductIDList>)|(skus|sku <SKUIDList>)]
|
||||||
[formatjson]
|
[formatjson]
|
||||||
|
|
||||||
@@ -5966,6 +5984,8 @@ gam print users [todrive <ToDriveAttribute>*]
|
|||||||
[schemas|custom|customschemas all|<SchemaNameList>]
|
[schemas|custom|customschemas all|<SchemaNameList>]
|
||||||
[emailpart|emailparts|username]
|
[emailpart|emailparts|username]
|
||||||
[userview] [basic|full|allfields|(<UserFieldName>*|fields <UserFieldNameList>)]
|
[userview] [basic|full|allfields|(<UserFieldName>*|fields <UserFieldNameList>)]
|
||||||
|
(filtermultiattrtype <UserMultiAttributeFilterName> <String>)*
|
||||||
|
(filtermultiattrcustom <UserMultiAttributeFilterName> <String>)*
|
||||||
[delimiter <Character>] [sortheaders [<Boolean>]] [scalarsfirst [<Boolean>]]
|
[delimiter <Character>] [sortheaders [<Boolean>]] [scalarsfirst [<Boolean>]]
|
||||||
[formatjson [quotechar <Character>]] [quoteplusphonenumbers]
|
[formatjson [quotechar <Character>]] [quoteplusphonenumbers]
|
||||||
[issuspended <Boolean>] [isarchived <Boolean>] [aliasmatchpattern <REMatchPattern>]
|
[issuspended <Boolean>] [isarchived <Boolean>] [aliasmatchpattern <REMatchPattern>]
|
||||||
@@ -5983,6 +6003,8 @@ gam print users [todrive <ToDriveAttribute>*] select <UserTypeEntity>
|
|||||||
[schemas|custom|customschemas all|<SchemaNameList>]
|
[schemas|custom|customschemas all|<SchemaNameList>]
|
||||||
[emailpart|emailparts|username]
|
[emailpart|emailparts|username]
|
||||||
[userview] [basic|full|allfields|(<UserFieldName>*|fields <UserFieldNameList>)]
|
[userview] [basic|full|allfields|(<UserFieldName>*|fields <UserFieldNameList>)]
|
||||||
|
(filtermultiattrtype <UserMultiAttributeFilterName> <String>)*
|
||||||
|
(filtermultiattrcustom <UserMultiAttributeFilterName> <String>)*
|
||||||
[delimiter <Character>] [sortheaders [<Boolean>]] [scalarsfirst [<Boolean>]]
|
[delimiter <Character>] [sortheaders [<Boolean>]] [scalarsfirst [<Boolean>]]
|
||||||
[formatjson [quotechar <Character>]] [quoteplusphonenumbers]
|
[formatjson [quotechar <Character>]] [quoteplusphonenumbers]
|
||||||
[issuspended <Boolean>] [isarchived <Boolean>] [aliasmatchpattern <REMatchPattern>]
|
[issuspended <Boolean>] [isarchived <Boolean>] [aliasmatchpattern <REMatchPattern>]
|
||||||
@@ -5998,6 +6020,8 @@ gam <UserTypeEntity> print users [todrive <ToDriveAttribute>*]
|
|||||||
[schemas|custom|customschemas all|<SchemaNameList>]
|
[schemas|custom|customschemas all|<SchemaNameList>]
|
||||||
[emailpart|emailparts|username]
|
[emailpart|emailparts|username]
|
||||||
[userview] [basic|full|allfields|(<UserFieldName>*|fields <UserFieldNameList>)]
|
[userview] [basic|full|allfields|(<UserFieldName>*|fields <UserFieldNameList>)]
|
||||||
|
(filtermultiattrtype <UserMultiAttributeFilterName> <String>)*
|
||||||
|
(filtermultiattrcustom <UserMultiAttributeFilterName> <String>)*
|
||||||
[delimiter <Character>] [sortheaders [<Boolean>]] [scalarsfirst [<Boolean>]]
|
[delimiter <Character>] [sortheaders [<Boolean>]] [scalarsfirst [<Boolean>]]
|
||||||
[formatjson [quotechar <Character>]] [quoteplusphonenumbers]
|
[formatjson [quotechar <Character>]] [quoteplusphonenumbers]
|
||||||
[issuspended <Boolean>] [isarchived <Boolean>] [aliasmatchpattern <REMatchPattern>]
|
[issuspended <Boolean>] [isarchived <Boolean>] [aliasmatchpattern <REMatchPattern>]
|
||||||
|
|||||||
@@ -1,7 +1,28 @@
|
|||||||
7.35.04
|
7.36.00
|
||||||
|
|
||||||
Fixed bug in `gam create feature name <Name>` where the result was incorrectly shown as
|
Added options `filtermultiattrtype` and filtermultiattrcustom` to `gam info user` and
|
||||||
`Building: <Name>, Added` instead of `Feature: <Name>, Added`.
|
`gam print users` that support filtering `<UserMultiAttribute>` display based on `type` or `customType`.
|
||||||
|
|
||||||
|
```
|
||||||
|
<UserMultiAttributeFilterName> ::=
|
||||||
|
address|addresses|
|
||||||
|
externalid|externalids|
|
||||||
|
im|ims|
|
||||||
|
keyword|keywords|
|
||||||
|
location|locations|
|
||||||
|
orgainzation|organizations|
|
||||||
|
otheremail|otheremails|
|
||||||
|
phone|phones|
|
||||||
|
relation|relations|
|
||||||
|
website|websites
|
||||||
|
```
|
||||||
|
|
||||||
|
* `filtermultiattrtype <UserMultiAttributeFilterName> <String>` - Display `<UserMultiAttributeFilterName>` if its `type` is `<String>`
|
||||||
|
* `filtermultiattrcustom <UserMultiAttributeFilterName> <String>` - Display `<UserMultiAttributeFilterName>` if its `customType` is `<String>`
|
||||||
|
|
||||||
|
```
|
||||||
|
gam info user user@domain.com quick filtermultiattrtype organizations work filtermultiattrcustom phones private
|
||||||
|
```
|
||||||
|
|
||||||
7.35.03
|
7.35.03
|
||||||
|
|
||||||
|
|||||||
@@ -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.35.04'
|
__version__ = '7.36.00'
|
||||||
__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
|
||||||
@@ -46726,10 +46726,58 @@ USER_FIELDS_CHOICE_MAP = {
|
|||||||
'websites': 'websites',
|
'websites': 'websites',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
USER_MULTI_ATTR_FILTER_CHOICE_MAP = {
|
||||||
|
'address': 'addresses',
|
||||||
|
'addresses': 'addresses',
|
||||||
|
'email': 'emails',
|
||||||
|
'emails': 'emails',
|
||||||
|
'externalid': 'externalIds',
|
||||||
|
'externalids': 'externalIds',
|
||||||
|
'im': 'ims',
|
||||||
|
'ims': 'ims',
|
||||||
|
'keyword': 'keywords',
|
||||||
|
'keywords': 'keywords',
|
||||||
|
'location': 'locations',
|
||||||
|
'locations': 'locations',
|
||||||
|
'organization': 'organizations',
|
||||||
|
'organizations': 'organizations',
|
||||||
|
'organisation': 'organizations',
|
||||||
|
'organisations': 'organizations',
|
||||||
|
'otheremail': 'emails',
|
||||||
|
'otheremails': 'emails',
|
||||||
|
'phone': 'phones',
|
||||||
|
'phones': 'phones',
|
||||||
|
'relation': 'relations',
|
||||||
|
'relations': 'relations',
|
||||||
|
'website': 'websites',
|
||||||
|
'websites': 'websites',
|
||||||
|
}
|
||||||
|
|
||||||
INFO_USER_OPTIONS = {'noaliases', 'nobuildingnames', 'nogroups', 'nolicenses', 'nolicences', 'noschemas', 'schemas', 'userview'}
|
INFO_USER_OPTIONS = {'noaliases', 'nobuildingnames', 'nogroups', 'nolicenses', 'nolicences', 'noschemas', 'schemas', 'userview'}
|
||||||
USER_SKIP_OBJECTS = {'thumbnailPhotoEtag'}
|
USER_SKIP_OBJECTS = {'thumbnailPhotoEtag'}
|
||||||
USER_TIME_OBJECTS = {'creationTime', 'deletionTime', 'lastLoginTime'}
|
USER_TIME_OBJECTS = {'creationTime', 'deletionTime', 'lastLoginTime'}
|
||||||
|
|
||||||
|
def _getUserMultiAttributeFilters(myarg, userMultiAttributeFilters):
|
||||||
|
up = getChoice(USER_MULTI_ATTR_FILTER_CHOICE_MAP, mapChoice=True)
|
||||||
|
filterValue = getString(Cmd.OB_STRING)
|
||||||
|
userMultiAttributeFilters.setdefault(up, [])
|
||||||
|
if myarg == 'filtermultiattrtype':
|
||||||
|
userMultiAttributeFilters[up].append({'type': filterValue})
|
||||||
|
else: #elif myarg == 'filtermultiattrcustom':
|
||||||
|
userMultiAttributeFilters[up].append({'customType': filterValue})
|
||||||
|
|
||||||
|
def _filterUserMultiAttributes(user, userMultiAttributeFilters):
|
||||||
|
for up, upTypes in userMultiAttributeFilters.items():
|
||||||
|
if up in user:
|
||||||
|
filterAttrList = []
|
||||||
|
for userAttr in user.pop(up):
|
||||||
|
for upType in upTypes:
|
||||||
|
if ((userAttr.get('type', None) == upType.get('type', '')) or
|
||||||
|
(userAttr.get('customType', None) == upType.get('customType', ''))):
|
||||||
|
filterAttrList.append(userAttr)
|
||||||
|
break
|
||||||
|
user[up] = filterAttrList
|
||||||
|
|
||||||
def _formatLanguagesList(propertyValue, delimiter):
|
def _formatLanguagesList(propertyValue, delimiter):
|
||||||
languages = []
|
languages = []
|
||||||
for language in propertyValue:
|
for language in propertyValue:
|
||||||
@@ -46824,6 +46872,7 @@ def infoUsers(entityList):
|
|||||||
fieldsList = []
|
fieldsList = []
|
||||||
groups = []
|
groups = []
|
||||||
memberships = []
|
memberships = []
|
||||||
|
userMultiAttributeFilters = {}
|
||||||
skus = SKU.getAllSKUs() if not GM.Globals[GM.LICENSE_SKUS] else GM.Globals[GM.LICENSE_SKUS]
|
skus = SKU.getAllSKUs() if not GM.Globals[GM.LICENSE_SKUS] else GM.Globals[GM.LICENSE_SKUS]
|
||||||
while Cmd.ArgumentsRemaining():
|
while Cmd.ArgumentsRemaining():
|
||||||
myarg = getArgument()
|
myarg = getArgument()
|
||||||
@@ -46858,6 +46907,8 @@ def infoUsers(entityList):
|
|||||||
getGroups = getLicenses = False
|
getGroups = getLicenses = False
|
||||||
elif getFieldsList(myarg, USER_FIELDS_CHOICE_MAP, fieldsList):
|
elif getFieldsList(myarg, USER_FIELDS_CHOICE_MAP, fieldsList):
|
||||||
pass
|
pass
|
||||||
|
elif myarg in {'filtermultiattrtype', 'filtermultiattrcustom'}:
|
||||||
|
_getUserMultiAttributeFilters(myarg, userMultiAttributeFilters)
|
||||||
# Ignore info group arguments that may have come from whatis
|
# Ignore info group arguments that may have come from whatis
|
||||||
elif myarg in INFO_GROUP_OPTIONS:
|
elif myarg in INFO_GROUP_OPTIONS:
|
||||||
pass
|
pass
|
||||||
@@ -46885,6 +46936,8 @@ def infoUsers(entityList):
|
|||||||
throwReasons=GAPI.USER_GET_THROW_REASONS+[GAPI.INVALID_INPUT, GAPI.RESOURCE_NOT_FOUND],
|
throwReasons=GAPI.USER_GET_THROW_REASONS+[GAPI.INVALID_INPUT, GAPI.RESOURCE_NOT_FOUND],
|
||||||
userKey=userEmail, projection=schemaParms['projection'], customFieldMask=schemaParms['customFieldMask'],
|
userKey=userEmail, projection=schemaParms['projection'], customFieldMask=schemaParms['customFieldMask'],
|
||||||
viewType=viewType, fields=fields)
|
viewType=viewType, fields=fields)
|
||||||
|
if userMultiAttributeFilters:
|
||||||
|
_filterUserMultiAttributes(user, userMultiAttributeFilters)
|
||||||
groups = []
|
groups = []
|
||||||
memberships = []
|
memberships = []
|
||||||
if getGroups or getGroupsTree:
|
if getGroups or getGroupsTree:
|
||||||
@@ -47322,6 +47375,8 @@ def doPrintUsers(entityList=None):
|
|||||||
return
|
return
|
||||||
if showValidColumn:
|
if showValidColumn:
|
||||||
userEntity[showValidColumn] = True
|
userEntity[showValidColumn] = True
|
||||||
|
if userMultiAttributeFilters:
|
||||||
|
_filterUserMultiAttributes(userEntity, userMultiAttributeFilters)
|
||||||
userEmail = userEntity['primaryEmail']
|
userEmail = userEntity['primaryEmail']
|
||||||
if printOptions['emailParts']:
|
if printOptions['emailParts']:
|
||||||
if userEmail.find('@') != -1:
|
if userEmail.find('@') != -1:
|
||||||
@@ -47464,6 +47519,7 @@ def doPrintUsers(entityList=None):
|
|||||||
showItemCountOnly = False
|
showItemCountOnly = False
|
||||||
addCSVData = {}
|
addCSVData = {}
|
||||||
includeCSVDataInJSON = False
|
includeCSVDataInJSON = False
|
||||||
|
userMultiAttributeFilters = {}
|
||||||
while Cmd.ArgumentsRemaining():
|
while Cmd.ArgumentsRemaining():
|
||||||
myarg = getArgument()
|
myarg = getArgument()
|
||||||
if myarg == 'todrive':
|
if myarg == 'todrive':
|
||||||
@@ -47543,6 +47599,8 @@ def doPrintUsers(entityList=None):
|
|||||||
getAddCSVData(addCSVData)
|
getAddCSVData(addCSVData)
|
||||||
elif myarg == 'includecsvdatainjson':
|
elif myarg == 'includecsvdatainjson':
|
||||||
includeCSVDataInJSON = getBoolean()
|
includeCSVDataInJSON = getBoolean()
|
||||||
|
elif myarg in {'filtermultiattrtype', 'filtermultiattrcustom'}:
|
||||||
|
_getUserMultiAttributeFilters(myarg, userMultiAttributeFilters)
|
||||||
else:
|
else:
|
||||||
FJQC.GetFormatJSONQuoteChar(myarg, False)
|
FJQC.GetFormatJSONQuoteChar(myarg, False)
|
||||||
_, _, entityList = getEntityArgument(entityList)
|
_, _, entityList = getEntityArgument(entityList)
|
||||||
|
|||||||
Reference in New Issue
Block a user