Enhanced gam create|print|show chromeprofilecommand

This commit is contained in:
Ross Scroggs
2025-07-12 20:59:36 -07:00
parent 5738cf5435
commit 0dd8e099c5
5 changed files with 149 additions and 60 deletions

View File

@@ -381,7 +381,7 @@ If an item contains spaces, it should be surrounded by ".
domain:<DomainName>|domain|default domain:<DomainName>|domain|default
<CalendarItem> ::= <EmailAddress> <CalendarItem> ::= <EmailAddress>
<ChannelCustomerID> ::= <String> <ChannelCustomerID> ::= <String>
<ChatEmojiName> ::= :<String>: <ChatEmojiName> ::= :[0-9a-z_-]+:
<ChatEmoji> ::= emojiname <ChatEmojiName> | customemojis/<String> <ChatEmoji> ::= emojiname <ChatEmojiName> | customemojis/<String>
<ChatMember> ::= spaces/<String>/members/<String> <ChatMember> ::= spaces/<String>/members/<String>
<ChatMessage> ::= spaces/<String>/messages/<String> <ChatMessage> ::= spaces/<String>/messages/<String>
@@ -533,7 +533,6 @@ If an item contains spaces, it should be surrounded by ".
<Password> ::= <String> <Password> ::= <String>
<PeopleResourceName> ::= people/<String> <PeopleResourceName> ::= people/<String>
<PrinterID> ::= <String> <PrinterID> ::= <String>
<ChromeProfileID> ::= <String>
<ProjectID> ::= <String> <ProjectID> ::= <String>
Must match this Python Regular Expression: [a-z][a-z0-9-]{4,28}[a-z0-9] Must match this Python Regular Expression: [a-z][a-z0-9-]{4,28}[a-z0-9]
<ProjectName> ::= <String> <ProjectName> ::= <String>
@@ -685,9 +684,15 @@ If an item contains spaces, it should be surrounded by ".
<CalendarACLScopeList> ::= "<CalendarACLScope>(,<CalendarACLScope>)*" <CalendarACLScopeList> ::= "<CalendarACLScope>(,<CalendarACLScope>)*"
<CalendarList> ::= "<CalendarItem>(,<CalendarItem>)*" <CalendarList> ::= "<CalendarItem>(,<CalendarItem>)*"
<ChatSpaceList> ::= "<ChatSpace>(,<ChatSpace>)*" <ChatSpaceList> ::= "<ChatSpace>(,<ChatSpace>)*"
<ChromeProfileNameList> ::= "<ChromeProfileName>(,<ChromeProfileName>)*"
<CIGroupAliasList> ::= "<CIGroupAlias>(,<CIGroupAlias>)*" <CIGroupAliasList> ::= "<CIGroupAlias>(,<CIGroupAlias>)*"
<CIGroupMemberTypeList> ::= "<CIGroupMemberType>(,<CIGroupMemberType>)*" <CIGroupMemberTypeList> ::= "<CIGroupMemberType>(,<CIGroupMemberType>)*"
<CIPolicyNameList> ::= "<CIPolicyName>(,<CIPolicyName>)*" <CIPolicyNameList> ::= "<CIPolicyName>(,<CIPolicyName>)*"
<ClassificationLabelIDList> ::= "<ClassificationLabelID>(,<ClassificationLabelID>)*"
<ClassificationLabelNameList> ::= "<ClassificationLabelName>(,<ClassificationLabelName>)*"
<ClassificationLabelPermissionNameList> ::= "<ClassificationLabelPermissionName>(,<ClassificationLabelPermissionName>)*"
<ClassificationLabelFieldIDList> ::= "<ClassificationLabelFieldID>(,<ClassificationLabelFieldID>)*"
<ClassificationLabelSelectionIDList> ::= "<ClassificationLabelSelectionID>(,<ClassificationLabelSelectionID>)*"
<ClassroomInvitationIDList> ::= "<ClassroomInvitationID>(,<ClassroomInvitationID>)*" <ClassroomInvitationIDList> ::= "<ClassroomInvitationID>(,<ClassroomInvitationID>)*"
<ContactGroupList> ::= "<ContactGroupItem>(,<ContactGroupItem>)*" <ContactGroupList> ::= "<ContactGroupItem>(,<ContactGroupItem>)*"
<ContactIDList> ::= "<ContactID>(,<ContactID>)*" <ContactIDList> ::= "<ContactID>(,<ContactID>)*"
@@ -1019,6 +1024,8 @@ Specify a collection of items by directly specifying them; the item type is dete
<CalendarACLScopeList> | <FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVDataSelector> <CalendarACLScopeList> | <FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVDataSelector>
<CalendarEntity> ::= <CalendarEntity> ::=
<CalendarList> | <FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVDataSelector> <CalendarList> | <FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVDataSelector>
<ChromeProfileNameEntity> ::=
<ChromeProfileNameList> | <FileSelector> | <CSVFileSelector>
<CIPolicyNameEntity> ::= <CIPolicyNameEntity> ::=
<CIPolicyNameList> | <FileSelector> | <CSVFileSelector> <CIPolicyNameList> | <FileSelector> | <CSVFileSelector>
<ClassificationLabelNameEntity> ::= <ClassificationLabelNameEntity> ::=
@@ -2222,6 +2229,11 @@ gam show chromeneedsattn
<ChromeProfilePermanentID> ::= <String> <ChromeProfilePermanentID> ::= <String>
<ChromeProfileName> ::= customers/<CustomerID>/profiles/<ChromeProfilePermanentID> | <ChromeProfilePermanentID> <ChromeProfileName> ::= customers/<CustomerID>/profiles/<ChromeProfilePermanentID> | <ChromeProfilePermanentID>
<ChromeProfileCommandName> ::= <ChomeProfileName>/commands/<String> <ChromeProfileCommandName> ::= <ChomeProfileName>/commands/<String>
<ChromeProfileNameList> ::= "<ChromeProfileName>(,<ChromeProfileName>)*"
<ChromeProfileNameEntity> ::=
<ChromeProfileNameList> |
(select <FileSelector>|<CSVFileSelector>) |
(filter <String> (filtertime<String> <Time>)* [orderby <ChromeProfileOrderByFieldName> [ascending|descending]])
<ChromeProfileFieldName> ::= <ChromeProfileFieldName> ::=
affiliationstate| affiliationstate|
@@ -2273,26 +2285,26 @@ gam delete chromeprofile <ChromeProfileName>
gam info chromeprofile <ChromeProfileName> gam info chromeprofile <ChromeProfileName>
<ChromeProfileFieldName>* [fields <ChromeProfileFieldNameList>] <ChromeProfileFieldName>* [fields <ChromeProfileFieldNameList>]
gam show chromeprofiles gam show chromeprofiles
[filtertime.* <Time>] [filter <String>] [filter <String> (filtertime<String> <Time>)*]
[orderby <ChromeProfileOrderByFieldName> [ascending|descending]] [orderby <ChromeProfileOrderByFieldName> [ascending|descending]]
<ChromeProfileFieldName>* [fields <ChromeProfileFieldNameList>] <ChromeProfileFieldName>* [fields <ChromeProfileFieldNameList>]
[formatjson] [formatjson]
gam print chromeprofiles [todrive <ToDriveAttribute>*] gam print chromeprofiles [todrive <ToDriveAttribute>*]
[filtertime.* <Time>] [filter <String>] [filter <String> (filtertime<String> <Time>)*]
[orderby <ChromeProfileOrderByFieldName> [ascending|descending]] [orderby <ChromeProfileOrderByFieldName> [ascending|descending]]
<ChromeProfileFieldName>* [fields <ChromeProfileFieldNameList>] <ChromeProfileFieldName>* [fields <ChromeProfileFieldNameList>]
[formatjson [quotechar <Character>]] [formatjson [quotechar <Character>]]
gam create chromeprofilecommand <ChromeProfileName> gam create chromeprofilecommand <ChromeProfileNameEntity>
[clearcache [<Boolean>]] [clearcookies [<Boolean>]] [clearcache [<Boolean>]] [clearcookies [<Boolean>]]
[formatjson] [formatjson]
gam info chromeprofilecommand <ChromeProfileCommandName> gam info chromeprofilecommand <ChromeProfileCommandName>
[formatjson] [formatjson]
gam show chromeprofilecommands <ChromeProfileName> gam show chromeprofilecommands <ChromeProfileNameEntity>
[formatjson] [formatjson]
gam print chromeprofilecommands <ChromeProfileName> [todrive <ToDriveAttribute>*] gam print chromeprofilecommands <ChromeProfileNameEntity> [todrive <ToDriveAttribute>*]
[formatjson [quotechar <Character>]] [formatjson [quotechar <Character>]]
# Chrome Versions Counts # Chrome Versions Counts
@@ -4511,7 +4523,7 @@ gam report <ActivityApplicationName> [todrive <ToDriveAttribute>*]
[(user all|<UserItem>)|(orgunit|org|ou <OrgUnitPath> [showorgunit])|(select <UserTypeEntity>)] [(user all|<UserItem>)|(orgunit|org|ou <OrgUnitPath> [showorgunit])|(select <UserTypeEntity>)]
[([start <Time>] [end <Time>])|(range <Time> <Time>)| [([start <Time>] [end <Time>])|(range <Time> <Time>)|
yesterday|today|thismonth|(previousmonths <Integer>)] yesterday|today|thismonth|(previousmonths <Integer>)]
[filtertime.<String> <Time>] [filter|filters <String>] [filter <String> (filtertime<String> <Time>)*]
[event|events <EventNameList>] [ip <String>] [event|events <EventNameList>] [ip <String>]
[groupidfilter <String>] [groupidfilter <String>]
[maxactivities <Number>] [maxevents <Number>] [maxresults <Number>] [maxactivities <Number>] [maxevents <Number>] [maxresults <Number>]
@@ -4558,7 +4570,7 @@ gam report users|user [todrive <ToDriveAttribute>*]
[(date <Date>)|(range <Date> <Date>)| [(date <Date>)|(range <Date> <Date>)|
yesterday|today|thismonth|(previousmonths <Integer>)] yesterday|today|thismonth|(previousmonths <Integer>)]
[(nodatechange | limitdatechanges <Integer>) | (fulldatarequired all|<UserServiceNameList>)] [(nodatechange | limitdatechanges <Integer>) | (fulldatarequired all|<UserServiceNameList>)]
[filtertime.* <Time>] [filter|filters <String>] [filter <String> (filtertime<String> <Time>)*]
[(fields|parameters <String>)|(services <UserServiceNameList>)] [(fields|parameters <String>)|(services <UserServiceNameList>)]
[aggregatebydate|aggregatebyuser [Boolean]] [aggregatebydate|aggregatebyuser [Boolean]]
[maxresults <Number>] [maxresults <Number>]
@@ -7486,10 +7498,10 @@ gam <UserTypeEntity> show forms <DriveFileEntity>
gam <UserTypeEntity> print formresponses <DriveFileEntity> [todrive <ToDriveAttribute>*] gam <UserTypeEntity> print formresponses <DriveFileEntity> [todrive <ToDriveAttribute>*]
(addcsvdata <FieldName> <String>)* (addcsvdata <FieldName> <String>)*
[filtertime.* <Time>] [filter <String>] [filter <String> (filtertime<String> <Time>)*]
[countsonly|(formatjson [quotechar <Character>])] [countsonly|(formatjson [quotechar <Character>])]
gam <UserTypeEntity> show formresponses <DriveFileEntity> gam <UserTypeEntity> show formresponses <DriveFileEntity>
[filtertime.* <Time>] [filter <String>] [filter <String> (filtertime<String> <Time>)*]
[countsonly|formatjson] [countsonly|formatjson]
# Users - Gmail - Forwarding # Users - Gmail - Forwarding

View File

@@ -1,3 +1,19 @@
7.13.01
Enhanced `gam create|print|show chromeprofilecommand` to allow specification
of multiple Chrome browser profiles rather than just one.
```
<ChromeProfilePermanentID> ::= <String>
<ChromeProfileName> ::= customers/<CustomerID>/profiles/<ChromeProfilePermanentID> | <ChromeProfilePermanentID>
<ChromeProfileNameList> ::= "<ChromeProfileName>(,<ChromeProfileName>)*"
<ChromeProfileNameEntity> ::=
<ChromeProfileNameList> |
(select <FileSelector>|<CSVFileSelector>) |
(filter <String> (filtertime<String> <Time>)* [orderby <ChromeProfileOrderByFieldName> [ascending|descending]])
gam create|print_show chromeprofilecommand <ChromeProfileNameEntity>
```
7.13.00 7.13.00
Added commands that send remote commands to Chrome browser profiles and display the results; Added commands that send remote commands to Chrome browser profiles and display the results;
@@ -12807,7 +12823,7 @@ gam <UserTypeEntity> update teamdrive <TeamDriveEntity> [adminaccess|asadmin] [n
Updated gam report users to support new orgUnitID argument in Reports API. Updated gam report users to support new orgUnitID argument in Reports API.
gam report users|user [todrive <ToDriveAttribute>*] [date <Date>] [nodatechange | (fulldatarequired all|<ReportsAppList>)] gam report users|user [todrive <ToDriveAttribute>*] [date <Date>] [nodatechange | (fulldatarequired all|<ReportsAppList>)]
[(user all|<UserItem>)|(orgunit|org|ou <OrgUnitPath>)|(select <UserTypeEntity>)] (filtertime.* <Time>)* [filter|filters <String>] [fields|parameters <String>] [(user all|<UserItem>)|(orgunit|org|ou <OrgUnitPath>)|(select <UserTypeEntity>)] (filtertime<String> <Time>)* [filter|filters <String>] [fields|parameters <String>]
[maxactivities <Number>] [maxresults <Number>] [maxactivities <Number>] [maxresults <Number>]
Select the users for whom information is desired. Select the users for whom information is desired.
@@ -13398,15 +13414,15 @@ gam print cros query "sync:#querytime1#.." querytime1 -30d
For example, to print information about CrOS devices synced between 45 days ago and 30 days ago: For example, to print information about CrOS devices synced between 45 days ago and 30 days ago:
gam print cros query "sync:#querytime1#..#querytime2#" querytime1 -45d querytime2 -30d gam print cros query "sync:#querytime1#..#querytime2#" querytime1 -45d querytime2 -30d
Added filtertime.* <Time> option to gam report to allow times, usually relative, to be substituted into the filter <String> option. Added filtertime<String> <Time> option to gam report to allow times, usually relative, to be substituted into the filter <String> option.
The filtertime.* value replaces the string #filtertime.*# in the filter <String>. The filtertime<String> value replaces the string #filtertime<String># in the filter <String>.
The characters following filtertime can be any combination of lowercase letters and numbers. The characters following filtertime can be any combination of lowercase letters and numbers.
gam report users|user [todrive <ToDriveAttribute>*] [date <Date>] [nodatechange | (fulldatarequired all|<ReportsAppList>)] gam report users|user [todrive <ToDriveAttribute>*] [date <Date>] [nodatechange | (fulldatarequired all|<ReportsAppList>)]
[(user all|<UserItem>)|(select <UserTypeEntity>)] (filtertime.* <Time>)* [filter|filters <String>] [fields|parameters <String>] [(user all|<UserItem>)|(select <UserTypeEntity>)] (filtertime<String> <Time>)* [filter|filters <String>] [fields|parameters <String>]
[maxactivities <Number>] [maxresults <Number>] [maxactivities <Number>] [maxresults <Number>]
gam report admin|calendar|calendars|drive|docs|doc|gplus|groups|group|logins|login|mobile|rules|tokens|token [todrive <ToDriveAttribute>*] [maxresults <Number>] [maxactivities <Number>] gam report admin|calendar|calendars|drive|docs|doc|gplus|groups|group|logins|login|mobile|rules|tokens|token [todrive <ToDriveAttribute>*] [maxresults <Number>] [maxactivities <Number>]
[([start <Time>] [end <Time>])|yesterday] [(user all|<UserItem>)|(select <UserTypeEntity>)] [([start <Time>] [end <Time>])|yesterday] [(user all|<UserItem>)|(select <UserTypeEntity>)]
[event <String>] (filtertime.* <Time>)* [filter|filters <String>] [ip <String>] [countsonly] [summary] [event <String>] (filtertime<String> <Time>)* [filter|filters <String>] [ip <String>] [countsonly] [summary]
For example, this command reports on the users that haven't logged in in the last 5 years. For example, this command reports on the users that haven't logged in in the last 5 years.
gam report users parameters accounts:last_login_time filters "accounts:last_login_time<#filtertime#" filtertime -5y gam report users parameters accounts:last_login_time filters "accounts:last_login_time<#filtertime#" filtertime -5y
@@ -13562,21 +13578,21 @@ Added units of years to <Date>, <DateTime> and <Time>; a year is 365 days. Added
never| never|
now|today now|today
Added filtertime <Time> option to gam report to allow times, usually relative, to be substituted into the filter <String> option. Added filtertime<String> <Time> option to gam report to allow times, usually relative, to be substituted into the filter <String> option.
If both filtertime and filter are specified, the filtertime value replaces the string #filtertime# in the filter <String>. If both filtertime<String> and filter are specified, the filtertime value replaces the string #filtertime<String># in the filter <String>.
gam report users|user [todrive <ToDriveAttribute>*] [date <Date>] [nodatechange | (fulldatarequired all|<ReportsAppList>)] gam report users|user [todrive <ToDriveAttribute>*] [date <Date>] [nodatechange | (fulldatarequired all|<ReportsAppList>)]
[(user all|<UserItem>)|(select <UserTypeEntity>)] [filtertime <Time>] [filter|filters <String>] [fields|parameters <String>] [(user all|<UserItem>)|(select <UserTypeEntity>)] [filtertime<String> <Time>] [filter|filters <String>] [fields|parameters <String>]
[maxactivities <Number>] [maxresults <Number>] [maxactivities <Number>] [maxresults <Number>]
gam report admin|calendar|calendars|drive|docs|doc|gplus|groups|group|logins|login|mobile|rules|tokens|token [todrive <ToDriveAttribute>*] [maxresults <Number>] [maxactivities <Number>] gam report admin|calendar|calendars|drive|docs|doc|gplus|groups|group|logins|login|mobile|rules|tokens|token [todrive <ToDriveAttribute>*] [maxresults <Number>] [maxactivities <Number>]
[([start <Time>] [end <Time>])|yesterday] [(user all|<UserItem>)|(select <UserTypeEntity>)] [([start <Time>] [end <Time>])|yesterday] [(user all|<UserItem>)|(select <UserTypeEntity>)]
[event <String>] [filtertime <Time>] [filter|filters <String>] [ip <String>] [countsonly] [summary] [event <String>] [filtertime<String> <Time>] [filter|filters <String>] [ip <String>] [countsonly] [summary]
For example, this command reports on the users that haven't logged in in the last 5 years. For example, this command reports on the users that haven't logged in in the last 5 years.
gam report users parameters accounts:last_login_time filters "accounts:last_login_time<#filtertime#" filtertime -5y gam report users parameters accounts:last_login_time filters "accounts:last_login_time<#filtertime5y#" filtertime5y -5y
For example, this command reports on the users that haven't ever logged in. For example, this command reports on the users that haven't ever logged in.
gam report users parameters accounts:last_login_time filters "accounts:last_login_time==#filtertime#" filtertime never gam report users parameters accounts:last_login_time filters "accounts:last_login_time==#filtertimeNever#" filtertimeNever never
4.60.14 4.60.14

View File

@@ -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.13.00' __version__ = '7.13.01'
__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
@@ -13641,7 +13641,7 @@ REPORT_ACTIVITIES_TIME_OBJECTS = {'time'}
# [(user all|<UserItem>)|(orgunit|org|ou <OrgUnitPath> [showorgunit])|(select <UserTypeEntity>)] # [(user all|<UserItem>)|(orgunit|org|ou <OrgUnitPath> [showorgunit])|(select <UserTypeEntity>)]
# [([start <Time>] [end <Time>])|(range <Time> <Time>)| # [([start <Time>] [end <Time>])|(range <Time> <Time>)|
# yesterday|today|thismonth|(previousmonths <Integer>)] # yesterday|today|thismonth|(previousmonths <Integer>)]
# [filtertime.* <Time>] [filter|filters <String>] # [filter <String> (filtertime<String> <Time>)*]
# [event|events <EventNameList>] [ip <String>] # [event|events <EventNameList>] [ip <String>]
# [groupidfilter <String>] # [groupidfilter <String>]
# [maxactivities <Number>] [maxevents <Number>] [maxresults <Number>] # [maxactivities <Number>] [maxevents <Number>] [maxresults <Number>]
@@ -13653,7 +13653,7 @@ REPORT_ACTIVITIES_TIME_OBJECTS = {'time'}
# [(date <Date>)|(range <Date> <Date>)| # [(date <Date>)|(range <Date> <Date>)|
# yesterday|today|thismonth|(previousmonths <Integer>)] # yesterday|today|thismonth|(previousmonths <Integer>)]
# [nodatechange | (fulldatarequired all|<UserServiceNameList>)] # [nodatechange | (fulldatarequired all|<UserServiceNameList>)]
# [filtertime.* <Time>] [filter|filters <String>] # [filter <String> (filtertime<String> <Time>)*]
# [(fields|parameters <String>)|(services <UserServiceNameList>)] # [(fields|parameters <String>)|(services <UserServiceNameList>)]
# [aggregatebydate|aggregatebyuser [Boolean]] # [aggregatebydate|aggregatebyuser [Boolean]]
# [maxresults <Number>] # [maxresults <Number>]
@@ -25491,7 +25491,7 @@ def doUpdateBrowsers():
checkEntityAFDNEorAccessErrorExit(None, Ent.CHROME_BROWSER, deviceId, i, count) checkEntityAFDNEorAccessErrorExit(None, Ent.CHROME_BROWSER, deviceId, i, count)
def _getChromeProfileName(): def _getChromeProfileName():
profileName = getString(Cmd.OB_CHROMEPROFILE_ID) profileName = getString(Cmd.OB_CHROMEPROFILE_NAME)
if not profileName.startswith('customers'): if not profileName.startswith('customers'):
customerId = _getCustomerId() customerId = _getCustomerId()
profileName = f'customers/{customerId}/profiles/{profileName}' profileName = f'customers/{customerId}/profiles/{profileName}'
@@ -25598,12 +25598,12 @@ CHROMEPROFILE_ORDERBY_CHOICE_MAP = {
} }
# gam show chromeprofiles # gam show chromeprofiles
# [filtertime.* <Time>] [filter <String>] # [filter <String> (filtertime<String> <Time>)*]
# [orderby <ChromeProfileOrderByFieldName> [ascending|descending]] # [orderby <ChromeProfileOrderByFieldName> [ascending|descending]]
# <ChromeProfileFieldName>* [fields <ChromeProfileFieldNameList>] # <ChromeProfileFieldName>* [fields <ChromeProfileFieldNameList>]
# [formatjson] # [formatjson]
# gam print chromeprofiles [todrive <ToDriveAttribute>*] # gam print chromeprofiles [todrive <ToDriveAttribute>*]
# [filtertime.* <Time>] [filter <String>] # [filter <String> (filtertime<String> <Time>)*]
# [orderby <ChromeProfileOrderByFieldName> [ascending|descending]] # [orderby <ChromeProfileOrderByFieldName> [ascending|descending]]
# <ChromeProfileFieldName>* [fields <ChromeProfileFieldNameList>] # <ChromeProfileFieldName>* [fields <ChromeProfileFieldNameList>]
# [formatjson [quotechar <Character>]] # [formatjson [quotechar <Character>]]
@@ -25641,7 +25641,7 @@ def doPrintShowChromeProfiles():
sortHeaders = True sortHeaders = True
else: else:
FJQC.GetFormatJSONQuoteChar(myarg, True) FJQC.GetFormatJSONQuoteChar(myarg, True)
if filterTimes and filter is not None: if filterTimes and cbfilter is not None:
for filterTimeName, filterTimeValue in iter(filterTimes.items()): for filterTimeName, filterTimeValue in iter(filterTimes.items()):
cbfilter = cbfilter.replace(f'#{filterTimeName}#', filterTimeValue) cbfilter = cbfilter.replace(f'#{filterTimeName}#', filterTimeValue)
fields = getItemFieldsFromFieldsList('chromeBrowserProfiles', fieldsList) fields = getItemFieldsFromFieldsList('chromeBrowserProfiles', fieldsList)
@@ -25676,6 +25676,55 @@ def doPrintShowChromeProfiles():
csvPF.SetSortTitles(['name', 'profileId']) csvPF.SetSortTitles(['name', 'profileId'])
csvPF.writeCSVfile('Chrome Profiles') csvPF.writeCSVfile('Chrome Profiles')
def _getChromeProfileNameList():
if not Cmd.PeekArgumentPresent(['select', 'filter', 'filters']):
return getString(Cmd.OB_CHROMEPROFILE_NAME_LIST).replace(',', ' ').split()
return []
def _initChromeProfileNameParameters():
cm = buildGAPIObject(API.CHROMEMANAGEMENT)
return (cm, {'profileNameList': _getChromeProfileNameList(), 'customerId': _getCustomerId(),
'cbfilter': None, 'filterTimes': {},
'OBY': OrderBy(CHROMEPROFILE_ORDERBY_CHOICE_MAP)})
def _getChromeProfileNameParameters(myarg, parameters):
if not parameters['cbfilter'] and myarg == 'select':
parameters['profileNameList'].extend(getEntityList(Cmd.OB_CHROMEPROFILE_NAME_LIST))
elif not parameters['profileNameList'] and myarg == 'orderby':
parameters['OBY'].GetChoice()
elif not parameters['profileNameList'] and myarg.startswith('filtertime'):
parameters['filterTimes'][myarg] = getTimeOrDeltaFromNow()
elif not parameters['profileNameList'] and myarg in {'filter', 'filters'}:
parameters['cbfilter'] = getString(Cmd.OB_STRING)
else:
return False
return True
def _getChromeProfileNameEntityForCommand(cm, parameters):
if parameters['cbfilter'] is None:
customerId = parameters['customerId']
for i, profileName in enumerate(parameters['profileNameList']):
if not profileName.startswith('customers'):
parameters['profileNameList'][i] = f'customers/{customerId}/profiles/{profileName}'
return
if parameters['filterTimes']:
for filterTimeName, filterTimeValue in iter(parameters['filterTimes'].items()):
parameters['cbfilter'] = parameters['cbfilter'].replace(f'#{filterTimeName}#', filterTimeValue)
printGettingAllAccountEntities(Ent.CHROME_PROFILE, parameters['cbfilter'])
pageMessage = getPageMessage()
try:
feed = yieldGAPIpages(cm.customers().profiles(), 'list', 'chromeBrowserProfiles',
pageMessage=pageMessage,
throwReasons=[GAPI.INVALID_ARGUMENT, GAPI.PERMISSION_DENIED],
parent=f'customers/{parameters["customerId"]}', pageSize=200,
filter=parameters['cbfilter'], orderBy=parameters['OBY'].orderBy,
fields='nextPageToken,chromeBrowserProfiles(name)')
for profiles in feed:
for profile in profiles:
parameters['profileNameList'].append(profile['name'])
except (GAPI.invalidArgument, GAPI.permissionDenied) as e:
entityActionFailedExit([Ent.CHROME_PROFILE, parameters['cbfilter']], str(e))
CHROMEPROFILECOMMAND_TIME_OBJECTS = { CHROMEPROFILECOMMAND_TIME_OBJECTS = {
'clientExecutionTime', 'clientExecutionTime',
'issueTime', 'issueTime',
@@ -25691,12 +25740,11 @@ def _showChromeProfileCommand(profcmd, FJQC, i=0, count=0):
showJSON(None, profcmd, timeObjects=CHROMEPROFILECOMMAND_TIME_OBJECTS) showJSON(None, profcmd, timeObjects=CHROMEPROFILECOMMAND_TIME_OBJECTS)
Ind.Decrement() Ind.Decrement()
# gam create chromeprofilecommand <ChromeProfileName> # gam create chromeprofilecommand <ChromeProfileNameEntity>
# [clearcache [<Boolean>]] [clearcookies [<Boolean>]] # [clearcache [<Boolean>]] [clearcookies [<Boolean>]]
# [formatjson] # [formatjson]
def doCreateChromeProfileCommand(): def doCreateChromeProfileCommand():
cm = buildGAPIObject(API.CHROMEMANAGEMENT) cm, parameters = _initChromeProfileNameParameters()
profileName = _getChromeProfileName()
body = {'commandType': 'clearBrowsingData', 'payload': {}} body = {'commandType': 'clearBrowsingData', 'payload': {}}
FJQC = FormatJSONQuoteChar() FJQC = FormatJSONQuoteChar()
while Cmd.ArgumentsRemaining(): while Cmd.ArgumentsRemaining():
@@ -25707,13 +25755,20 @@ def doCreateChromeProfileCommand():
body['payload']['clearCookies'] = getBoolean() body['payload']['clearCookies'] = getBoolean()
else: else:
FJQC.GetFormatJSON(myarg) FJQC.GetFormatJSON(myarg)
try: _getChromeProfileNameEntityForCommand(cm, parameters)
profcmd = callGAPI(cm.customers().profiles().commands(), 'create', count = len(parameters['profileNameList'])
throwReasons=[GAPI.INVALID_ARGUMENT, GAPI.NOT_FOUND, GAPI.PERMISSION_DENIED], i = 0
parent=profileName, body=body) for profileName in parameters['profileNameList']:
_showChromeProfileCommand(profcmd, FJQC) i +=1
except (GAPI.invalidArgument, GAPI.notFound, GAPI.permissionDenied) as e: try:
entityActionFailedExit([Ent.CHROME_PROFILE_COMMAND, profileName], str(e)) profcmd = callGAPI(cm.customers().profiles().commands(), 'create',
throwReasons=[GAPI.INVALID_ARGUMENT, GAPI.NOT_FOUND, GAPI.PERMISSION_DENIED],
parent=profileName, body=body)
_showChromeProfileCommand(profcmd, FJQC)
except (GAPI.notFound) as e:
entityActionFailedWarning([Ent.CHROME_PROFILE_COMMAND, profileName], str(e), i, count)
except (GAPI.invalidArgument, GAPI.permissionDenied) as e:
entityActionFailedExit([Ent.CHROME_PROFILE_COMMAND, profileName], str(e))
# gam info chromeprofilecommand <ChromeProfileCommandName> # gam info chromeprofilecommand <ChromeProfileCommandName>
# [formatjson] # [formatjson]
@@ -25732,9 +25787,9 @@ def doInfoChromeProfileCommand():
except (GAPI.invalidArgument, GAPI.notFound, GAPI.permissionDenied) as e: except (GAPI.invalidArgument, GAPI.notFound, GAPI.permissionDenied) as e:
entityActionFailedExit([Ent.CHROME_PROFILE, profileCommandName], str(e)) entityActionFailedExit([Ent.CHROME_PROFILE, profileCommandName], str(e))
# gam show chromeprofilecommands <ChromeProfileName> # gam show chromeprofilecommands <ChromeProfileNameEntity>
# [formatjson] # [formatjson]
# gam print chromeprofilecommands <ChromeProfileName> [todrive <ToDriveAttribute>*] # gam print chromeprofilecommands <ChromeProfilNameEntity> [todrive <ToDriveAttribute>*]
# [formatjson [quotechar <Character>]] # [formatjson [quotechar <Character>]]
def doPrintShowChromeProfileCommands(): def doPrintShowChromeProfileCommands():
def _printProfileCommand(profcmd): def _printProfileCommand(profcmd):
@@ -25746,28 +25801,31 @@ def doPrintShowChromeProfileCommands():
'JSON': json.dumps(cleanJSON(profcmd, timeObjects=CHROMEPROFILECOMMAND_TIME_OBJECTS), 'JSON': json.dumps(cleanJSON(profcmd, timeObjects=CHROMEPROFILECOMMAND_TIME_OBJECTS),
ensure_ascii=False, sort_keys=True)}) ensure_ascii=False, sort_keys=True)})
cm = buildGAPIObject(API.CHROMEMANAGEMENT)
csvPF = CSVPrintFile(['name']) if Act.csvFormat() else None csvPF = CSVPrintFile(['name']) if Act.csvFormat() else None
FJQC = FormatJSONQuoteChar(csvPF) FJQC = FormatJSONQuoteChar(csvPF)
profileName = _getChromeProfileName() cm, parameters = _initChromeProfileNameParameters()
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 _getChromeProfileNameParameters(myarg, parameters):
pass
else: else:
FJQC.GetFormatJSONQuoteChar(myarg, True) FJQC.GetFormatJSONQuoteChar(myarg, True)
printGettingEntityItemForWhom(Ent.CHROME_PROFILE_COMMAND, profileName) _getChromeProfileNameEntityForCommand(cm, parameters)
pageMessage = getPageMessage() count = len(parameters['profileNameList'])
try: i = 0
feed = yieldGAPIpages(cm.customers().profiles().commands(), 'list', 'chromeBrowserProfileCommands', for profileName in parameters['profileNameList']:
pageMessage=pageMessage, i +=1
throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.PERMISSION_DENIED], printGettingEntityItemForWhom(Ent.CHROME_PROFILE_COMMAND, profileName, i, count)
parent=profileName, pageSize=100) pageMessage = getPageMessage()
for profcmds in feed: try:
profcmds = callGAPIpages(cm.customers().profiles().commands(), 'list', 'chromeBrowserProfileCommands',
pageMessage=pageMessage,
throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.PERMISSION_DENIED],
parent=profileName, pageSize=100)
if not csvPF: if not csvPF:
jcount = len(profcmds) jcount = len(profcmds)
if not FJQC.formatJSON:
performActionNumItems(jcount, Ent.CHROME_PROFILE_COMMAND)
Ind.Increment() Ind.Increment()
j = 0 j = 0
for profcmd in profcmds: for profcmd in profcmds:
@@ -25777,8 +25835,10 @@ def doPrintShowChromeProfileCommands():
else: else:
for profcmd in profcmds: for profcmd in profcmds:
_printProfileCommand(profcmd) _printProfileCommand(profcmd)
except (GAPI.notFound, GAPI.invalidArgument, GAPI.permissionDenied) as e: except (GAPI.notFound) as e:
entityActionFailedExit([Ent.CHROME_PROFILE, profileName], str(e)) entityActionFailedWarning([Ent.CHROME_PROFILE, profileName], str(e), i, count)
except (GAPI.invalidArgument, GAPI.permissionDenied) as e:
entityActionFailedExit([Ent.CHROME_PROFILE, profileName], str(e))
if csvPF: if csvPF:
csvPF.writeCSVfile('Chrome Profile Commands') csvPF.writeCSVfile('Chrome Profile Commands')
@@ -73375,11 +73435,11 @@ def printShowForms(users):
FORM_RESPONSE_TIME_OBJECTS = {'createTime', 'lastSubmittedTime'} FORM_RESPONSE_TIME_OBJECTS = {'createTime', 'lastSubmittedTime'}
# gam <UserTypeEntity> print formresponses <DriveFileEntity> [todrive <ToDriveAttribute>*] # gam <UserTypeEntity> print formresponses <DriveFileEntity> [todrive <ToDriveAttribute>*]
# [filtertime.* <Time>] [filter <String>] # [filter <String> (filtertime<String> <Time>)*]
# (addcsvdata <FieldName> <String>)* # (addcsvdata <FieldName> <String>)*
# [countsonly|(formatjson [quotechar <Character>])] # [countsonly|(formatjson [quotechar <Character>])]
# gam <UserTypeEntity> show formresponses <DriveFileEntity> # gam <UserTypeEntity> show formresponses <DriveFileEntity>
# [filtertime.* <Time>] [filter <String>] # [filter <String> (filtertime<String> <Time>)*]
# [countsonly|formatjson] # [countsonly|formatjson]
def printShowFormResponses(users): def printShowFormResponses(users):
csvPF = CSVPrintFile(['User', 'formId', 'responseId', 'createTime', 'lastSubmittedTime', 'respondentEmail', 'totalScore'], csvPF = CSVPrintFile(['User', 'formId', 'responseId', 'createTime', 'lastSubmittedTime', 'respondentEmail', 'totalScore'],
@@ -73405,7 +73465,7 @@ def printShowFormResponses(users):
addCSVData[k] = getString(Cmd.OB_STRING, minLen=0) addCSVData[k] = getString(Cmd.OB_STRING, minLen=0)
else: else:
FJQC.GetFormatJSONQuoteChar(myarg, True) FJQC.GetFormatJSONQuoteChar(myarg, True)
if filterTimes and filter is not None: if filterTimes and frfilter is not None:
for filterTimeName, filterTimeValue in iter(filterTimes.items()): for filterTimeName, filterTimeValue in iter(filterTimes.items()):
frfilter = frfilter.replace(f'#{filterTimeName}#', filterTimeValue) frfilter = frfilter.replace(f'#{filterTimeName}#', filterTimeValue)
if csvPF: if csvPF:

View File

@@ -857,7 +857,8 @@ class GamCLArgs():
OB_CHAT_SPACE = 'ChatSpace' OB_CHAT_SPACE = 'ChatSpace'
OB_CHAT_SPACE_LIST = 'ChatSpaceList' OB_CHAT_SPACE_LIST = 'ChatSpaceList'
OB_CHAT_THREAD = 'ChatThread' OB_CHAT_THREAD = 'ChatThread'
OB_CHROMEPROFILE_ID = 'ChromeProfileId' OB_CHROMEPROFILE_NAME = 'ChromeProfileName'
OB_CHROMEPROFILE_NAME_LIST = 'ChromeProfileNameList'
OB_CHROME_VERSION = 'ChromeVersion' OB_CHROME_VERSION = 'ChromeVersion'
OB_CIDR_NETMASK = 'CIDRnetmask' OB_CIDR_NETMASK = 'CIDRnetmask'
OB_CIGROUP_ALIAS_LIST = "CIGroupAliasList" OB_CIGROUP_ALIAS_LIST = "CIGroupAliasList"

View File

@@ -1,7 +1,7 @@
[metadata] [metadata]
name = GAM for Google Workspace name = GAM for Google Workspace
#version = attr: gam.var.GAM_VERSION #version = attr: gam.var.GAM_VERSION
version = 7.12.02 version = 7.13.01
description = Command line management for Google Workspaces description = Command line management for Google Workspaces
long_description = file: readme.md long_description = file: readme.md
long_description_content_type = text/markdown long_description_content_type = text/markdown