mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
Update print messages and print drivesettings
This commit is contained in:
@@ -12,6 +12,11 @@ See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Win
|
|||||||
|
|
||||||
### 6.76.06
|
### 6.76.06
|
||||||
|
|
||||||
|
Fixed bug in `gam <UserTypeEntity> print messages ... positivecountsonly` where message counts with value 0 were deiplayed.
|
||||||
|
|
||||||
|
Added option `addcsvdata <FieldName> <String>` to `gam <UserTypeEntity> print|messages` that adds
|
||||||
|
additional columns of data to the CSV file output.
|
||||||
|
|
||||||
Added option `showusagebytes` to `gam <UserTypeEntity> print|show drivesettings` that displays
|
Added option `showusagebytes` to `gam <UserTypeEntity> print|show drivesettings` that displays
|
||||||
the following fields in bytes ```usageBytes,usageInDriveBytes,usageInDriveTrashBytes```
|
the following fields in bytes ```usageBytes,usageInDriveBytes,usageInDriveTrashBytes```
|
||||||
in addition to the fields in their formatted form with units: ```usage,usageInDrive,usageInDriveTrash```.
|
in addition to the fields in their formatted form with units: ```usage,usageInDrive,usageInDriveTrash```.
|
||||||
|
|||||||
@@ -365,6 +365,10 @@ gam <UserTypeEntity> archive messages <GroupItem>
|
|||||||
|
|
||||||
Messages are archived to the group specified by `<GroupItem>`.
|
Messages are archived to the group specified by `<GroupItem>`.
|
||||||
|
|
||||||
|
When `query` is specified:
|
||||||
|
* `max_to_archive 0` - All messages selected will be archived; this is the default
|
||||||
|
* `max_to_archive <Number>` - No messages will be archived if the number messages selected is > `<Number>`
|
||||||
|
|
||||||
By default, the command results are displayed as indented keys and values. Use the `csv` option
|
By default, the command results are displayed as indented keys and values. Use the `csv` option
|
||||||
to display the command results in CSV form.
|
to display the command results in CSV form.
|
||||||
```
|
```
|
||||||
@@ -406,6 +410,10 @@ By default, when exporting a message, an existing local file will not be overwri
|
|||||||
* `overwrite true` - Overwite an existing file
|
* `overwrite true` - Overwite an existing file
|
||||||
* `overwrite false` - Do not overwite an existing file; add a numeric prefix and create a new file
|
* `overwrite false` - Do not overwite an existing file; add a numeric prefix and create a new file
|
||||||
|
|
||||||
|
When `query` is specified:
|
||||||
|
* `max_to_export 0` - All messages selected will be exported
|
||||||
|
* `max_to_export <Number>` - No messages will be exported if the number messages selected is > `<Number>`; `<Number>` defaults to 1.
|
||||||
|
|
||||||
See below for message selection.
|
See below for message selection.
|
||||||
|
|
||||||
## Forward messages/threads
|
## Forward messages/threads
|
||||||
@@ -429,6 +437,10 @@ If `addorigfieldstosubject` is specified, GAM appends the original `from`, `to`
|
|||||||
Fwd: Ross to TestUser (Original From: Ross Scroggs <ross.scroggs@gmail.com> To: testuser@domain.com Date: Thu, 23 Nov 2023 07:01:59 -0800)
|
Fwd: Ross to TestUser (Original From: Ross Scroggs <ross.scroggs@gmail.com> To: testuser@domain.com Date: Thu, 23 Nov 2023 07:01:59 -0800)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
When `query` is specified:
|
||||||
|
* `max_to_forward 0` - All messages selected will be forwarded
|
||||||
|
* `max_to_forward <Number>` - No messages will be forwarded if the number messages selected is > `<Number>`; `<Number>` defaults to 1.
|
||||||
|
|
||||||
See below for message selection.
|
See below for message selection.
|
||||||
|
|
||||||
## Manage messages/threads
|
## Manage messages/threads
|
||||||
@@ -542,7 +554,8 @@ gam <UserTypeEntity> print messages|threads [todrive <ToDriveAttribute>*]
|
|||||||
```
|
```
|
||||||
## Display all messages
|
## Display all messages
|
||||||
By default, Gam displays all messages.
|
By default, Gam displays all messages.
|
||||||
* `max_to_xxx` - Limit the number of messages that will be displayed
|
* `max_to_print|max_to_show 0` - All messages will be displayed; this is the default
|
||||||
|
* `max_to_print|max_to_show <Number>` - Limit the number of messages that will be displayed to `<Number>`
|
||||||
* `includespamtrash` - Include messages in the Spam and Trash folders
|
* `includespamtrash` - Include messages in the Spam and Trash folders
|
||||||
|
|
||||||
## Display a specific set of messages
|
## Display a specific set of messages
|
||||||
@@ -550,7 +563,8 @@ By default, Gam displays all messages.
|
|||||||
|
|
||||||
## Display a selected set of messages
|
## Display a selected set of messages
|
||||||
* `((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+` - Criteria to select messages
|
* `((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])+` - Criteria to select messages
|
||||||
* `max_to_xxx` - Limit the number of messages that will be displayed
|
* `max_to_print|max_to_show 0` - All selected messages will be displayed; this is the default
|
||||||
|
* `max_to_print|max_to_show <Number>` - Limit the number of selected messages that will be displayed to `<Number>`
|
||||||
* `includespamtrash` - Include messages in the Spam and Trash folders
|
* `includespamtrash` - Include messages in the Spam and Trash folders
|
||||||
* `labelmatchpattern <RegularExpression>` - Only display messages with some label that matches `<RegularExpression>`
|
* `labelmatchpattern <RegularExpression>` - Only display messages with some label that matches `<RegularExpression>`
|
||||||
* `labelmatchpattern xyz` - Label must start with xyz
|
* `labelmatchpattern xyz` - Label must start with xyz
|
||||||
|
|||||||
@@ -7226,9 +7226,10 @@ gam <UserTypeEntity> print messages|threads [todrive <ToDriveAttribute>*]
|
|||||||
[countsonly|positivecountsonly] [useronly]
|
[countsonly|positivecountsonly] [useronly]
|
||||||
[headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String> [dateheaderconverttimezone [<Boolean>]]]
|
[headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String> [dateheaderconverttimezone [<Boolean>]]]
|
||||||
[showlabels] [delimiter <Character>] [showbody] [showdate] [showsize] [showsnippet]
|
[showlabels] [delimiter <Character>] [showbody] [showdate] [showsize] [showsnippet]
|
||||||
|
[convertcrnl] [delimiter <Character>]
|
||||||
[[attachmentnamepattern <RegularExpression>]
|
[[attachmentnamepattern <RegularExpression>]
|
||||||
[showattachments [noshowtextplain]]]
|
[showattachments [noshowtextplain]]]
|
||||||
[convertcrnl]
|
(addcsvdata <FieldName> <String>)*
|
||||||
|
|
||||||
# Users - Gmail - Profile
|
# Users - Gmail - Profile
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ Merged GAM-Team version
|
|||||||
|
|
||||||
6.76.06
|
6.76.06
|
||||||
|
|
||||||
|
Fixed bug in `gam <UserTypeEntity> print messages ... positivecountsonly` where message counts with value 0 were deiplayed.
|
||||||
|
|
||||||
|
Added option `addcsvdata <FieldName> <String>` to `gam <UserTypeEntity> print|messages` that adds
|
||||||
|
additional columns of data to the CSV file output.
|
||||||
|
|
||||||
Added option `showusagebytes` to `gam <UserTypeEntity> print|show drivesettings` that displays
|
Added option `showusagebytes` to `gam <UserTypeEntity> print|show drivesettings` that displays
|
||||||
the following fields in bytes ```usageBytes,usageInDriveBytes,usageInDriveTrashBytes```
|
the following fields in bytes ```usageBytes,usageInDriveBytes,usageInDriveTrashBytes```
|
||||||
in addition to the fields in their formatted form with units: ```usage,usageInDrive,usageInDriveTrash```.
|
in addition to the fields in their formatted form with units: ```usage,usageInDrive,usageInDriveTrash```.
|
||||||
|
|||||||
@@ -4163,6 +4163,8 @@ def SetGlobalVariables():
|
|||||||
GC.Values[GC.PRINT_CROS_OUS] = GM.Globals[GM.PRINT_CROS_OUS]
|
GC.Values[GC.PRINT_CROS_OUS] = GM.Globals[GM.PRINT_CROS_OUS]
|
||||||
if not GC.Values[GC.PRINT_CROS_OUS_AND_CHILDREN]:
|
if not GC.Values[GC.PRINT_CROS_OUS_AND_CHILDREN]:
|
||||||
GC.Values[GC.PRINT_CROS_OUS_AND_CHILDREN] = GM.Globals[GM.PRINT_CROS_OUS_AND_CHILDREN]
|
GC.Values[GC.PRINT_CROS_OUS_AND_CHILDREN] = GM.Globals[GM.PRINT_CROS_OUS_AND_CHILDREN]
|
||||||
|
GC.Values[GC.SHOW_GETTINGS] = GM.Globals[GM.SHOW_GETTINGS]
|
||||||
|
GC.Values[GC.SHOW_GETTINGS_GOT_NL] = GM.Globals[GM.SHOW_GETTINGS_GOT_NL]
|
||||||
# customer_id, domain and admin_email must be set when enable_dasa = true
|
# customer_id, domain and admin_email must be set when enable_dasa = true
|
||||||
if GC.Values[GC.ENABLE_DASA]:
|
if GC.Values[GC.ENABLE_DASA]:
|
||||||
errors = 0
|
errors = 0
|
||||||
@@ -9574,6 +9576,7 @@ def ProcessGAMCommandMulti(pid, numItems, logCmd, mpQueueCSVFile, mpQueueStdout,
|
|||||||
csvHeaderForce,
|
csvHeaderForce,
|
||||||
csvRowFilter, csvRowFilterMode, csvRowDropFilter, csvRowDropFilterMode,
|
csvRowFilter, csvRowFilterMode, csvRowDropFilter, csvRowDropFilterMode,
|
||||||
csvRowLimit,
|
csvRowLimit,
|
||||||
|
showGettings, showGettingsGotNL,
|
||||||
args):
|
args):
|
||||||
global mplock
|
global mplock
|
||||||
|
|
||||||
@@ -9612,6 +9615,8 @@ def ProcessGAMCommandMulti(pid, numItems, logCmd, mpQueueCSVFile, mpQueueStdout,
|
|||||||
GM.Globals[GM.PRINT_CROS_OUS] = printCrosOUs
|
GM.Globals[GM.PRINT_CROS_OUS] = printCrosOUs
|
||||||
GM.Globals[GM.PRINT_CROS_OUS_AND_CHILDREN] = printCrosOUsAndChildren
|
GM.Globals[GM.PRINT_CROS_OUS_AND_CHILDREN] = printCrosOUsAndChildren
|
||||||
GM.Globals[GM.SAVED_STDOUT] = None
|
GM.Globals[GM.SAVED_STDOUT] = None
|
||||||
|
GM.Globals[GM.SHOW_GETTINGS] = showGettings
|
||||||
|
GM.Globals[GM.SHOW_GETTINGS_GOT_NL] = showGettingsGotNL
|
||||||
GM.Globals[GM.SYSEXITRC] = 0
|
GM.Globals[GM.SYSEXITRC] = 0
|
||||||
GM.Globals[GM.PARSER] = None
|
GM.Globals[GM.PARSER] = None
|
||||||
if mpQueueCSVFile:
|
if mpQueueCSVFile:
|
||||||
@@ -9818,6 +9823,7 @@ def MultiprocessGAMCommands(items, showCmds):
|
|||||||
GC.Values[GC.CSV_OUTPUT_ROW_DROP_FILTER],
|
GC.Values[GC.CSV_OUTPUT_ROW_DROP_FILTER],
|
||||||
GC.Values[GC.CSV_OUTPUT_ROW_DROP_FILTER_MODE],
|
GC.Values[GC.CSV_OUTPUT_ROW_DROP_FILTER_MODE],
|
||||||
GC.Values[GC.CSV_OUTPUT_ROW_LIMIT],
|
GC.Values[GC.CSV_OUTPUT_ROW_LIMIT],
|
||||||
|
GC.Values[GC.SHOW_GETTINGS], GC.Values[GC.SHOW_GETTINGS_GOT_NL],
|
||||||
item])
|
item])
|
||||||
poolProcessResults[0] += 1
|
poolProcessResults[0] += 1
|
||||||
if parallelPoolProcesses > 0:
|
if parallelPoolProcesses > 0:
|
||||||
@@ -25470,6 +25476,11 @@ def _getChatPageMessage(entityType, user, i, count, pfilter):
|
|||||||
return getPageMessage()
|
return getPageMessage()
|
||||||
|
|
||||||
CHAT_PAGE_SIZE = 1000
|
CHAT_PAGE_SIZE = 1000
|
||||||
|
CHAT_SPACES_ADMIN_ORDERBY_CHOICE_MAP = {
|
||||||
|
'createtime': 'createTime',
|
||||||
|
'lastactivetime': 'lastActiveTime',
|
||||||
|
'membershipcount': 'membershipCount.joined_direct_human_user_count'
|
||||||
|
}
|
||||||
|
|
||||||
# gam [<UserTypeEntity>] show chatspaces
|
# gam [<UserTypeEntity>] show chatspaces
|
||||||
# [types <ChatSpaceTypeList>]
|
# [types <ChatSpaceTypeList>]
|
||||||
@@ -25477,15 +25488,34 @@ CHAT_PAGE_SIZE = 1000
|
|||||||
# gam [<UserTypeEntity>] print chatspaces [todrive <ToDriveAttribute>*]
|
# gam [<UserTypeEntity>] print chatspaces [todrive <ToDriveAttribute>*]
|
||||||
# [types <ChatSpaceTypeList>]
|
# [types <ChatSpaceTypeList>]
|
||||||
# [formatjson [quotechar <Character>]]
|
# [formatjson [quotechar <Character>]]
|
||||||
|
# gam [<UserTypeEntity>] show chatspaces adminaccess|asadmin
|
||||||
|
# [query <String>]]
|
||||||
|
# [orderby <ChatSpaceAdminOrderByFieldName> [ascending|descending]]
|
||||||
|
# [formatjson]
|
||||||
|
# gam [<UserTypeEntity>] print chatspaces adminaccess|asadmin [todrive <ToDriveAttribute>*]
|
||||||
|
# [query <String>]]
|
||||||
|
# [orderby <ChatSpaceAdminOrderByFieldName> [ascending|descending]]
|
||||||
|
# [formatjson [quotechar <Character>]]
|
||||||
def printShowChatSpaces(users):
|
def printShowChatSpaces(users):
|
||||||
csvPF = CSVPrintFile(['User', 'name'] if not isinstance(users, list) else ['name']) if Act.csvFormat() else None
|
csvPF = CSVPrintFile(['User', 'name'] if not isinstance(users, list) else ['name']) if Act.csvFormat() else None
|
||||||
FJQC = FormatJSONQuoteChar(csvPF)
|
FJQC = FormatJSONQuoteChar(csvPF)
|
||||||
|
useAdminAccess = checkArgumentPresent(ADMIN_ACCESS_OPTIONS)
|
||||||
|
OBY = OrderBy(CHAT_SPACES_ADMIN_ORDERBY_CHOICE_MAP)
|
||||||
pfilter = ''
|
pfilter = ''
|
||||||
|
kwargs = {}
|
||||||
|
if not useAdminAccess:
|
||||||
|
api = API.CHAT_SPACES
|
||||||
|
function = 'list'
|
||||||
|
else:
|
||||||
|
api = API.CHAT_SPACES_ADMIN
|
||||||
|
function = 'search'
|
||||||
|
kwargs['useAdminAccess'] = True
|
||||||
|
kwargs['query'] = 'customer = "customers/my_customer" AND spaceType = "SPACE"'
|
||||||
while Cmd.ArgumentsRemaining():
|
while Cmd.ArgumentsRemaining():
|
||||||
myarg = getArgument()
|
myarg = getArgument()
|
||||||
if csvPF and myarg == 'todrive':
|
if csvPF and myarg == 'todrive':
|
||||||
csvPF.GetTodriveParameters()
|
csvPF.GetTodriveParameters()
|
||||||
elif myarg in {'type', 'types'}:
|
elif not useAdminAccess and myarg in {'type', 'types'}:
|
||||||
for ctype in getString(Cmd.OB_GROUP_ROLE_LIST).lower().replace(',', ' ').split():
|
for ctype in getString(Cmd.OB_GROUP_ROLE_LIST).lower().replace(',', ' ').split():
|
||||||
if ctype in CHAT_SPACE_TYPE_MAP:
|
if ctype in CHAT_SPACE_TYPE_MAP:
|
||||||
if pfilter:
|
if pfilter:
|
||||||
@@ -25493,23 +25523,30 @@ def printShowChatSpaces(users):
|
|||||||
pfilter += f'spaceType = "{CHAT_SPACE_TYPE_MAP[ctype]}"'
|
pfilter += f'spaceType = "{CHAT_SPACE_TYPE_MAP[ctype]}"'
|
||||||
else:
|
else:
|
||||||
invalidChoiceExit(ctype, CHAT_SPACE_TYPE_MAP, True)
|
invalidChoiceExit(ctype, CHAT_SPACE_TYPE_MAP, True)
|
||||||
|
elif useAdminAccess and myarg == 'orderby':
|
||||||
|
OBY.GetChoice()
|
||||||
|
elif useAdminAccess and myarg == 'query':
|
||||||
|
kwargs['query'] += ' AND '+ getString(Cmd.OB_QUERY)
|
||||||
else:
|
else:
|
||||||
FJQC.GetFormatJSONQuoteChar(myarg, True)
|
FJQC.GetFormatJSONQuoteChar(myarg, True)
|
||||||
if not pfilter:
|
if not useAdminAccess:
|
||||||
pfilter = None
|
if pfilter:
|
||||||
|
kwargs['filter'] = pfilter
|
||||||
|
else:
|
||||||
|
kwargs['orderBy'] = OBY.orderBy
|
||||||
i, count, users = getEntityArgument(users)
|
i, count, users = getEntityArgument(users)
|
||||||
for user in users:
|
for user in users:
|
||||||
i += 1
|
i += 1
|
||||||
user, chat, kvList = buildChatServiceObject(API.CHAT_SPACES, user, i, count)
|
user, chat, kvList = buildChatServiceObject(api, user, i, count)
|
||||||
if not chat:
|
if not chat:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
spaces = callGAPIpages(chat.spaces(), 'list', 'spaces',
|
spaces = callGAPIpages(chat.spaces(), function, 'spaces',
|
||||||
pageMessage=_getChatPageMessage(Ent.CHAT_SPACE, user, i, count, pfilter),
|
pageMessage=_getChatPageMessage(Ent.CHAT_SPACE, user, i, count, pfilter),
|
||||||
bailOnInternalError=True,
|
bailOnInternalError=True,
|
||||||
throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.INTERNAL_ERROR,
|
throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.INTERNAL_ERROR,
|
||||||
GAPI.PERMISSION_DENIED, GAPI.FAILED_PRECONDITION],
|
GAPI.PERMISSION_DENIED, GAPI.FAILED_PRECONDITION],
|
||||||
pageSize=CHAT_PAGE_SIZE, filter=pfilter)
|
pageSize=CHAT_PAGE_SIZE, **kwargs)
|
||||||
except (GAPI.notFound, GAPI.invalidArgument, GAPI.internalError,
|
except (GAPI.notFound, GAPI.invalidArgument, GAPI.internalError,
|
||||||
GAPI.permissionDenied, GAPI.failedPrecondition) as e:
|
GAPI.permissionDenied, GAPI.failedPrecondition) as e:
|
||||||
exitIfChatNotConfigured(chat, kvList, str(e), i, count)
|
exitIfChatNotConfigured(chat, kvList, str(e), i, count)
|
||||||
@@ -68552,6 +68589,7 @@ def printShowMessagesThreads(users, entityType):
|
|||||||
dateHeaderFormat = ''
|
dateHeaderFormat = ''
|
||||||
dateHeaderConvertTimezone = False
|
dateHeaderConvertTimezone = False
|
||||||
uploadAttachmentBody = {}
|
uploadAttachmentBody = {}
|
||||||
|
addCSVData = {}
|
||||||
parentParms = initDriveFileAttributes()
|
parentParms = initDriveFileAttributes()
|
||||||
while Cmd.ArgumentsRemaining():
|
while Cmd.ArgumentsRemaining():
|
||||||
myarg = getArgument()
|
myarg = getArgument()
|
||||||
@@ -68610,6 +68648,9 @@ def printShowMessagesThreads(users, entityType):
|
|||||||
dateHeaderConvertTimezone = getBoolean()
|
dateHeaderConvertTimezone = getBoolean()
|
||||||
if not dateHeaderFormat:
|
if not dateHeaderFormat:
|
||||||
dateHeaderFormat = RFC2822_TIME_FORMAT
|
dateHeaderFormat = RFC2822_TIME_FORMAT
|
||||||
|
elif myarg == 'addcsvdata':
|
||||||
|
k = getString(Cmd.OB_STRING)
|
||||||
|
addCSVData[k] = getString(Cmd.OB_STRING, minLen=0)
|
||||||
else:
|
else:
|
||||||
unknownArgumentExit()
|
unknownArgumentExit()
|
||||||
labelMatchPattern = parameters['labelMatchPattern']
|
labelMatchPattern = parameters['labelMatchPattern']
|
||||||
@@ -68634,11 +68675,15 @@ def printShowMessagesThreads(users, entityType):
|
|||||||
_callbacks = {'batch': _callbackCountLabels, 'process': _countMessages if entityType == Ent.MESSAGE else _countThreads}
|
_callbacks = {'batch': _callbackCountLabels, 'process': _countMessages if entityType == Ent.MESSAGE else _countThreads}
|
||||||
if show_size:
|
if show_size:
|
||||||
sortTitles.append('size')
|
sortTitles.append('size')
|
||||||
|
if addCSVData:
|
||||||
|
sortTitles.extend(sorted(addCSVData.keys()))
|
||||||
csvPF.SetTitles(sortTitles)
|
csvPF.SetTitles(sortTitles)
|
||||||
else:
|
else:
|
||||||
sortTitles = ['User', 'threadId', 'id']
|
sortTitles = ['User', 'threadId', 'id']
|
||||||
csvPF.SetTitles(sortTitles)
|
csvPF.SetTitles(sortTitles)
|
||||||
sortTitles.extend(defaultHeaders)
|
sortTitles.extend(defaultHeaders)
|
||||||
|
if addCSVData:
|
||||||
|
sortTitles.extend(sorted(addCSVData.keys()))
|
||||||
_callbacks = {'batch': _callbackPrint, 'process': _printMessage if entityType == Ent.MESSAGE else _printThread}
|
_callbacks = {'batch': _callbackPrint, 'process': _printMessage if entityType == Ent.MESSAGE else _printThread}
|
||||||
csvPF.SetSortTitles(sortTitles)
|
csvPF.SetSortTitles(sortTitles)
|
||||||
else:
|
else:
|
||||||
@@ -68670,6 +68715,8 @@ def printShowMessagesThreads(users, entityType):
|
|||||||
if not senderMatchPattern:
|
if not senderMatchPattern:
|
||||||
_initSenderLabelsMap(user)
|
_initSenderLabelsMap(user)
|
||||||
messageThreadCounts = {'User': user, parameters['listType']: 0, 'size': 0}
|
messageThreadCounts = {'User': user, parameters['listType']: 0, 'size': 0}
|
||||||
|
if addCSVData:
|
||||||
|
messageThreadCounts.update(addCSVData)
|
||||||
senderCounts = {}
|
senderCounts = {}
|
||||||
if save_attachments:
|
if save_attachments:
|
||||||
_, userName, _ = splitEmailAddressOrUID(user)
|
_, userName, _ = splitEmailAddressOrUID(user)
|
||||||
@@ -68700,14 +68747,14 @@ def printShowMessagesThreads(users, entityType):
|
|||||||
if jcount == 0:
|
if jcount == 0:
|
||||||
setSysExitRC(NO_ENTITIES_FOUND_RC)
|
setSysExitRC(NO_ENTITIES_FOUND_RC)
|
||||||
if countsOnly and not show_labels and not senderMatchPattern and not show_size:
|
if countsOnly and not show_labels and not senderMatchPattern and not show_size:
|
||||||
|
if not positiveCountsOnly or jcount > 0:
|
||||||
if not csvPF:
|
if not csvPF:
|
||||||
printEntityKVList([Ent.USER, user], [parameters['listType'], jcount], i, count)
|
printEntityKVList([Ent.USER, user], [parameters['listType'], jcount], i, count)
|
||||||
else:
|
else:
|
||||||
csvPF.WriteRow({'User': user, parameters['listType']: jcount})
|
row = {'User': user, parameters['listType']: jcount}
|
||||||
continue
|
if addCSVData:
|
||||||
if jcount == 0:
|
row.update(addCSVData)
|
||||||
if not csvPF:
|
csvPF.WriteRow(row)
|
||||||
entityNumEntitiesActionNotPerformedWarning([Ent.USER, user], entityType, jcount, Msg.NO_ENTITIES_MATCHED.format(Ent.Plural(entityType)), i, count)
|
|
||||||
continue
|
continue
|
||||||
if not csvPF and not countsOnly:
|
if not csvPF and not countsOnly:
|
||||||
if (parameters['messageEntity'] is not None or
|
if (parameters['messageEntity'] is not None or
|
||||||
@@ -68763,13 +68810,17 @@ def printShowMessagesThreads(users, entityType):
|
|||||||
if not show_size:
|
if not show_size:
|
||||||
for label in labelsMap.values():
|
for label in labelsMap.values():
|
||||||
label.pop('size', None)
|
label.pop('size', None)
|
||||||
|
if addCSVData:
|
||||||
|
row.update(addCSVData)
|
||||||
csvPF.WriteRowTitles(flattenJSON({'Labels': sorted(iter(labelsMap.values()), key=lambda k: k['name'])}, flattened=row))
|
csvPF.WriteRowTitles(flattenJSON({'Labels': sorted(iter(labelsMap.values()), key=lambda k: k['name'])}, flattened=row))
|
||||||
elif not senderMatchPattern:
|
elif not senderMatchPattern:
|
||||||
|
v = messageThreadCounts[parameters['listType']]
|
||||||
|
if not positiveCountsOnly or v > 0:
|
||||||
if not csvPF:
|
if not csvPF:
|
||||||
if not show_size:
|
if not show_size:
|
||||||
printEntityKVList([Ent.USER, user], [parameters['listType'], messageThreadCounts[parameters['listType']]], i, count)
|
printEntityKVList([Ent.USER, user], [parameters['listType'], v], i, count)
|
||||||
else:
|
else:
|
||||||
printEntityKVList([Ent.USER, user], [parameters['listType'], messageThreadCounts[parameters['listType']], 'size', messageThreadCounts['size']], i, count)
|
printEntityKVList([Ent.USER, user], [parameters['listType'], v, 'size', messageThreadCounts['size']], i, count)
|
||||||
else:
|
else:
|
||||||
if not show_size:
|
if not show_size:
|
||||||
messageThreadCounts.pop('size', None)
|
messageThreadCounts.pop('size', None)
|
||||||
@@ -68778,17 +68829,27 @@ def printShowMessagesThreads(users, entityType):
|
|||||||
if not show_size:
|
if not show_size:
|
||||||
if not csvPF:
|
if not csvPF:
|
||||||
for k, v in sorted(iter(senderCounts.items())):
|
for k, v in sorted(iter(senderCounts.items())):
|
||||||
|
if not positiveCountsOnly or v['count'] > 0:
|
||||||
printEntityKVList([Ent.USER, user, Ent.SENDER, k], [parameters['listType'], v['count']], i, count)
|
printEntityKVList([Ent.USER, user, Ent.SENDER, k], [parameters['listType'], v['count']], i, count)
|
||||||
else:
|
else:
|
||||||
for k, v in sorted(iter(senderCounts.items())):
|
for k, v in sorted(iter(senderCounts.items())):
|
||||||
csvPF.WriteRow({'User': user, 'Sender': k, parameters['listType']: v['count']})
|
if not positiveCountsOnly or v['count'] > 0:
|
||||||
|
row = {'User': user, 'Sender': k, parameters['listType']: v['count']}
|
||||||
|
if addCSVData:
|
||||||
|
row.update(addCSVData)
|
||||||
|
csvPF.WriteRow(row)
|
||||||
else:
|
else:
|
||||||
if not csvPF:
|
if not csvPF:
|
||||||
for k, v in sorted(iter(senderCounts.items())):
|
for k, v in sorted(iter(senderCounts.items())):
|
||||||
|
if not positiveCountsOnly or v['count'] > 0:
|
||||||
printEntityKVList([Ent.USER, user, Ent.SENDER, k], [parameters['listType'], v['count'], 'size', v['size']], i, count)
|
printEntityKVList([Ent.USER, user, Ent.SENDER, k], [parameters['listType'], v['count'], 'size', v['size']], i, count)
|
||||||
else:
|
else:
|
||||||
for k, v in sorted(iter(senderCounts.items())):
|
for k, v in sorted(iter(senderCounts.items())):
|
||||||
csvPF.WriteRow({'User': user, 'Sender': k, parameters['listType']: v['count'], 'size': v['size']})
|
if not positiveCountsOnly or v['count'] > 0:
|
||||||
|
row = {'User': user, 'Sender': k, parameters['listType']: v['count'], 'size': v['size']}
|
||||||
|
if addCSVData:
|
||||||
|
row.update(addCSVData)
|
||||||
|
csvPF.WriteRow(row)
|
||||||
if csvPF:
|
if csvPF:
|
||||||
if not countsOnly:
|
if not countsOnly:
|
||||||
csvPF.RemoveTitles(['SizeEstimate', 'LabelsCount', 'Labels', 'Snippet', 'Body'])
|
csvPF.RemoveTitles(['SizeEstimate', 'LabelsCount', 'Labels', 'Snippet', 'Body'])
|
||||||
@@ -68805,15 +68866,16 @@ def printShowMessagesThreads(users, entityType):
|
|||||||
else:
|
else:
|
||||||
csvPF.writeCSVfile('Message Counts' if not show_labels else 'Message Label Counts')
|
csvPF.writeCSVfile('Message Counts' if not show_labels else 'Message Label Counts')
|
||||||
|
|
||||||
# gam <UserTypeEntity> print message|messages
|
# gam <UserTypeEntity> print message|messages [todrive <ToDriveAttribute>*]
|
||||||
# (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])* [quick|notquick] [max_to_print <Number>] [includespamtrash])|(ids <MessageIDEntity>)
|
# (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])* [quick|notquick] [max_to_print <Number>] [includespamtrash])|(ids <MessageIDEntity>)
|
||||||
# [labelmatchpattern <RegularExpression>] [sendermatchpattern <RegularExpression>]
|
# [labelmatchpattern <RegularExpression>] [sendermatchpattern <RegularExpression>]
|
||||||
# [headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String>] [dateheaderconverttimezone [<Boolean>]]
|
# [headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String>] [dateheaderconverttimezone [<Boolean>]]
|
||||||
# [showlabels] [showbody] [showdate] [showsize] [showsnippet]
|
# [showlabels] [showbody] [showdate] [showsize] [showsnippet]
|
||||||
# [convertcrnl] [delimiter <Character>] [todrive <ToDriveAttribute>*]
|
# [convertcrnl] [delimiter <Character>]
|
||||||
# [countsonly|positivecountsonly] [useronly]
|
# [countsonly|positivecountsonly] [useronly]
|
||||||
# [[attachmentnamepattern <RegularExpression>]
|
# [[attachmentnamepattern <RegularExpression>]
|
||||||
# [showattachments [noshowtextplain]]]
|
# [showattachments [noshowtextplain]]]
|
||||||
|
# (addcsvdata <FieldName> <String>)*
|
||||||
# gam <UserTypeEntity> show message|messages
|
# gam <UserTypeEntity> show message|messages
|
||||||
# (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])* [quick|notquick] [max_to_show <Number>] [includespamtrash])|(ids <MessageIDEntity>)
|
# (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])* [quick|notquick] [max_to_show <Number>] [includespamtrash])|(ids <MessageIDEntity>)
|
||||||
# [labelmatchpattern <RegularExpression>] [sendermatchpattern <RegularExpression>]
|
# [labelmatchpattern <RegularExpression>] [sendermatchpattern <RegularExpression>]
|
||||||
@@ -68827,15 +68889,16 @@ def printShowMessagesThreads(users, entityType):
|
|||||||
def printShowMessages(users):
|
def printShowMessages(users):
|
||||||
printShowMessagesThreads(users, Ent.MESSAGE)
|
printShowMessagesThreads(users, Ent.MESSAGE)
|
||||||
|
|
||||||
# gam <UserTypeEntity> print thread|threads
|
# gam <UserTypeEntity> print thread|threads [todrive <ToDriveAttribute>*]
|
||||||
# (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])* [quick|notquick] [max_to_print <Number>] [includespamtrash])|(ids <ThreadIDEntity>)
|
# (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])* [quick|notquick] [max_to_print <Number>] [includespamtrash])|(ids <ThreadIDEntity>)
|
||||||
# [labelmatchpattern <RegularExpression>]
|
# [labelmatchpattern <RegularExpression>]
|
||||||
# [headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String>] [dateheaderconverttimezone [<Boolean>]]
|
# [headers all|<SMTPHeaderList>] [dateheaderformat iso|rfc2822|<String>] [dateheaderconverttimezone [<Boolean>]]
|
||||||
# [showlabels] [showbody] [showdate] [showsize] [showsnippet]
|
# [showlabels] [showbody] [showdate] [showsize] [showsnippet]
|
||||||
# [convertcrnl] [delimiter <Character>] [todrive <ToDriveAttribute>*]
|
# [convertcrnl] [delimiter <Character>]
|
||||||
# [countsonly|positivecountsonly] [useronly]
|
# [countsonly|positivecountsonly] [useronly]
|
||||||
# [[attachmentnamepattern <RegularExpression>]
|
# [[attachmentnamepattern <RegularExpression>]
|
||||||
# [showattachments [noshowtextplain]]]
|
# [showattachments [noshowtextplain]]]
|
||||||
|
# (addcsvdata <FieldName> <String>)*
|
||||||
# gam <UserTypeEntity> show thread|threads
|
# gam <UserTypeEntity> show thread|threads
|
||||||
# (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])* [quick|notquick] [max_to_show <Number>] [includespamtrash])|(ids <ThreadIDEntity>)
|
# (((query <QueryGmail> [querytime<String> <Date>]*) (matchlabel <LabelName>) [or|and])* [quick|notquick] [max_to_show <Number>] [includespamtrash])|(ids <ThreadIDEntity>)
|
||||||
# [labelmatchpattern <RegularExpression>]
|
# [labelmatchpattern <RegularExpression>]
|
||||||
|
|||||||
@@ -29,8 +29,10 @@ CBCM = 'cbcm'
|
|||||||
CHAT = 'chat'
|
CHAT = 'chat'
|
||||||
CHAT_EVENTS = 'chatevents'
|
CHAT_EVENTS = 'chatevents'
|
||||||
CHAT_MEMBERSHIPS = 'chatmemberships'
|
CHAT_MEMBERSHIPS = 'chatmemberships'
|
||||||
|
CHAT_MEMBERSHIPS_ADMIN = 'chatmembershipsadmin'
|
||||||
CHAT_MESSAGES = 'chatmessages'
|
CHAT_MESSAGES = 'chatmessages'
|
||||||
CHAT_SPACES = 'chatspaces'
|
CHAT_SPACES = 'chatspaces'
|
||||||
|
CHAT_SPACES_ADMIN = 'chatspacesadmin'
|
||||||
CHAT_SPACES_DELETE = 'chatspacesdelete'
|
CHAT_SPACES_DELETE = 'chatspacesdelete'
|
||||||
CHROMEMANAGEMENT = 'chromemanagement'
|
CHROMEMANAGEMENT = 'chromemanagement'
|
||||||
CHROMEMANAGEMENT_APPDETAILS = 'chromemanagementappdetails'
|
CHROMEMANAGEMENT_APPDETAILS = 'chromemanagementappdetails'
|
||||||
@@ -197,8 +199,10 @@ _INFO = {
|
|||||||
CHAT: {'name': 'Chat API', 'version': 'v1', 'v2discovery': True},
|
CHAT: {'name': 'Chat API', 'version': 'v1', 'v2discovery': True},
|
||||||
CHAT_EVENTS: {'name': 'Chat API - Events', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHAT},
|
CHAT_EVENTS: {'name': 'Chat API - Events', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHAT},
|
||||||
CHAT_MEMBERSHIPS: {'name': 'Chat API - Memberships', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHAT},
|
CHAT_MEMBERSHIPS: {'name': 'Chat API - Memberships', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHAT},
|
||||||
|
CHAT_MEMBERSHIPS_ADMIN: {'name': 'Chat API - Admin Memberships', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHAT},
|
||||||
CHAT_MESSAGES: {'name': 'Chat API - Messages', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHAT},
|
CHAT_MESSAGES: {'name': 'Chat API - Messages', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHAT},
|
||||||
CHAT_SPACES: {'name': 'Chat API - Spaces', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHAT},
|
CHAT_SPACES: {'name': 'Chat API - Spaces', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHAT},
|
||||||
|
CHAT_SPACES_ADMIN: {'name': 'Chat API - Admin Spaces', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHAT},
|
||||||
CHAT_SPACES_DELETE: {'name': 'Chat API - Spaces Delete', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHAT},
|
CHAT_SPACES_DELETE: {'name': 'Chat API - Spaces Delete', 'version': 'v1', 'v2discovery': True, 'mappedAPI': CHAT},
|
||||||
CLASSROOM: {'name': 'Classroom API', 'version': 'v1', 'v2discovery': True},
|
CLASSROOM: {'name': 'Classroom API', 'version': 'v1', 'v2discovery': True},
|
||||||
CHROMEMANAGEMENT: {'name': 'Chrome Management API', 'version': 'v1', 'v2discovery': True},
|
CHROMEMANAGEMENT: {'name': 'Chrome Management API', 'version': 'v1', 'v2discovery': True},
|
||||||
@@ -514,6 +518,10 @@ _SVCACCT_SCOPES = [
|
|||||||
'api': CHAT_MEMBERSHIPS,
|
'api': CHAT_MEMBERSHIPS,
|
||||||
'subscopes': READONLY,
|
'subscopes': READONLY,
|
||||||
'scope': 'https://www.googleapis.com/auth/chat.memberships'},
|
'scope': 'https://www.googleapis.com/auth/chat.memberships'},
|
||||||
|
{'name': 'Chat API - Admin Memberships',
|
||||||
|
'api': CHAT_MEMBERSHIPS_ADMIN,
|
||||||
|
'subscopes': READONLY,
|
||||||
|
'scope': 'https://www.googleapis.com/auth/chat.admin.memberships'},
|
||||||
{'name': 'Chat API - Messages',
|
{'name': 'Chat API - Messages',
|
||||||
'api': CHAT_MESSAGES,
|
'api': CHAT_MESSAGES,
|
||||||
'subscopes': READONLY,
|
'subscopes': READONLY,
|
||||||
@@ -522,6 +530,10 @@ _SVCACCT_SCOPES = [
|
|||||||
'api': CHAT_SPACES,
|
'api': CHAT_SPACES,
|
||||||
'subscopes': READONLY,
|
'subscopes': READONLY,
|
||||||
'scope': 'https://www.googleapis.com/auth/chat.spaces'},
|
'scope': 'https://www.googleapis.com/auth/chat.spaces'},
|
||||||
|
{'name': 'Chat API - Admin Spaces',
|
||||||
|
'api': CHAT_SPACES_ADMIN,
|
||||||
|
'subscopes': READONLY,
|
||||||
|
'scope': 'https://www.googleapis.com/auth/chat.admin.spaces'},
|
||||||
{'name': 'Chat API - Spaces Delete',
|
{'name': 'Chat API - Spaces Delete',
|
||||||
'api': CHAT_SPACES_DELETE,
|
'api': CHAT_SPACES_DELETE,
|
||||||
'subscopes': [],
|
'subscopes': [],
|
||||||
|
|||||||
@@ -171,6 +171,10 @@ RATE_CHECK_COUNT = 'rccn'
|
|||||||
RATE_CHECK_START = 'rcst'
|
RATE_CHECK_START = 'rcst'
|
||||||
# Section name from outer gam, passed to inner gams
|
# Section name from outer gam, passed to inner gams
|
||||||
SECTION = 'sect'
|
SECTION = 'sect'
|
||||||
|
# Enable/disable "Getting ... " messages
|
||||||
|
SHOW_GETTINGS = 'shog'
|
||||||
|
# Enable/disable NL at end of "Got ..." messages
|
||||||
|
SHOW_GETTINGS_GOT_NL = 'shgn'
|
||||||
# redirected files
|
# redirected files
|
||||||
SAVED_STDOUT = 'svso'
|
SAVED_STDOUT = 'svso'
|
||||||
STDERR = 'stde'
|
STDERR = 'stde'
|
||||||
@@ -287,6 +291,8 @@ Globals = {
|
|||||||
RATE_CHECK_COUNT: 0,
|
RATE_CHECK_COUNT: 0,
|
||||||
RATE_CHECK_START: 0,
|
RATE_CHECK_START: 0,
|
||||||
SECTION: None,
|
SECTION: None,
|
||||||
|
SHOW_GETTINGS: True,
|
||||||
|
SHOW_GETTINGS_GOT_NL: False,
|
||||||
SAVED_STDOUT: None,
|
SAVED_STDOUT: None,
|
||||||
STDERR: {},
|
STDERR: {},
|
||||||
STDOUT: {},
|
STDOUT: {},
|
||||||
|
|||||||
Reference in New Issue
Block a user