mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-19 13:41:36 +00:00
Compare commits
28 Commits
v7.07.12
...
20250601.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3006d8dfe4 | ||
|
|
f9ed16e2e3 | ||
|
|
9999adfb3a | ||
|
|
f09a1e1bd6 | ||
|
|
a95da4e2ea | ||
|
|
fce8704f87 | ||
|
|
4d3b72900b | ||
|
|
fd81d56675 | ||
|
|
762d8479a4 | ||
|
|
6f19ec4f8c | ||
|
|
8af3bc60e6 | ||
|
|
e636a69431 | ||
|
|
673460e91d | ||
|
|
9862ad446f | ||
|
|
67f21ce650 | ||
|
|
e82baccbac | ||
|
|
c51b06a6c3 | ||
|
|
b7415cd63f | ||
|
|
f0f5803698 | ||
|
|
575fdea526 | ||
|
|
f8ee94bad8 | ||
|
|
4b6c8fb518 | ||
|
|
4f8c80dcab | ||
|
|
12f5c5e670 | ||
|
|
a1216b6782 | ||
|
|
05f4795bc3 | ||
|
|
e1ff1ba378 | ||
|
|
5b2804643e |
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -449,7 +449,7 @@ jobs:
|
||||
"$PYTHON" get-pip.py
|
||||
"$PYTHON" -m pip install --upgrade pip
|
||||
"$PYTHON" -m pip install --upgrade wheel
|
||||
"$PYTHON" -m pip install --upgrade setuptools
|
||||
"$PYTHON" -m pip install setuptools
|
||||
"$PYTHON" -m pip install --upgrade importlib-metadata
|
||||
"$PYTHON" -m pip install --upgrade setuptools-scm
|
||||
"$PYTHON" -m pip list
|
||||
|
||||
@@ -21,8 +21,8 @@ dependencies = [
|
||||
"lxml>=5.4.0",
|
||||
"passlib>=1.7.4",
|
||||
"pathvalidate>=3.2.3",
|
||||
"pyscard==2.2.1",
|
||||
"python-dateutil",
|
||||
"yubikey-manager>=5.6.1",
|
||||
]
|
||||
description = "CLI tool to manage Google Workspace"
|
||||
readme = "README.md"
|
||||
|
||||
@@ -1383,7 +1383,7 @@ gam show projects [[admin] <EmailAddress>] [all|<ProjectIDEntity>]
|
||||
[states all|active|deleterequested] [showiampolicies 0|1|3]
|
||||
gam print projects [[admin] <EmailAddress>] [all|<ProjectIDEntity>] [todrive <ToDriveAttribute>*]
|
||||
[states all|active|deleterequested] [showiampolicies 0|1|3 [onememberperrow]]
|
||||
[delimiter <Character>]] [[formatjson [quotechar <Character>]]
|
||||
[delimiter <Character>] [[formatjson [quotechar <Character>]]
|
||||
gam info currentprojectid
|
||||
|
||||
gam create|add svcacct [[admin] <EmailAddress>] [<ProjectIDEntity>]
|
||||
@@ -2396,12 +2396,14 @@ gam <CrOSTypeEntity> update <CrOSAttribute>+ [quickcrosmove [<Boolean>]] [nobatc
|
||||
autoupdatethrough|
|
||||
backlightinfo|
|
||||
bootmode|
|
||||
chromeostype|
|
||||
cpuinfo|
|
||||
cpustatusreports|
|
||||
deprovisionreason|
|
||||
devicefiles|
|
||||
deviceid|
|
||||
devicelicensetype|
|
||||
diskspaceusage|
|
||||
diskvolumereports|
|
||||
dockmacaddress|
|
||||
ethernetmacaddress|
|
||||
@@ -2409,6 +2411,7 @@ gam <CrOSTypeEntity> update <CrOSAttribute>+ [quickcrosmove [<Boolean>]] [nobatc
|
||||
extendedsupporteligible|
|
||||
extendedsupportstart|
|
||||
extendedsupportenabled|
|
||||
faninfo|
|
||||
firmwareversion|
|
||||
firstenrollmenttime|
|
||||
lastdeprovisiontimestamp|
|
||||
@@ -4116,7 +4119,7 @@ gam print devices [todrive <ToDriveAttribute>*]
|
||||
<DeviceFieldName>* [fields <DeviceFieldNameList>] [userfields <DeviceUserFieldNameList>]
|
||||
[orderby <DeviceOrderByFieldName> [ascending|descending]]
|
||||
[all|company|personal|nocompanydevices|nopersonaldevices]
|
||||
[nodeviceusers]
|
||||
[nodeviceusers|oneuserperrow]
|
||||
[formatjson [quotechar <Character>]]
|
||||
[showitemcountonly]
|
||||
|
||||
@@ -4816,6 +4819,16 @@ gam show shareddrives
|
||||
[fields <SharedDriveFieldNameList>] [noorgunits [<Boolean>]]
|
||||
[formatjson] [noorgunits [<Boolean>]]
|
||||
|
||||
gam print shareddriveorganizers [todrive <ToDriveAttribute>*]
|
||||
[shareddriveadminquery|query <QuerySharedDrive>]
|
||||
[orgunit|org|ou <OrgUnitPath>]
|
||||
[matchname <REMatchPattern>]
|
||||
[domainlist <DomainList>]
|
||||
[includetypes <OrganizerTypeList>]
|
||||
[oneorganizer [<Boolean>]]
|
||||
[shownorganizerdrives [false|true|only]]
|
||||
[includefileorganizers [<Boolean>]]
|
||||
[delimiter <Character>]
|
||||
gam print oushareddrives [todrive <ToDriveAttribute>*]
|
||||
[ou|org|orgunit <OrgUnitPath>]
|
||||
[formatjson [quotechar <Character>]]
|
||||
@@ -5260,7 +5273,8 @@ gam create vaultexport|export matter <MatterItem> [name <String>] corpus calenda
|
||||
[terms <String>] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>] [timezone <TimeZone>]
|
||||
[locationquery <StringList>] [peoplequery <StringList>] [minuswords <StringList>]
|
||||
[responsestatuses <AttendeeStatus>(,<AttendeeStatus>)*] [calendarversiondate <Date>|<Time>]
|
||||
[includeshareddrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>]
|
||||
[(includeshareddrives <Boolean>)|(shareddrivesoption included|included_if_account_is_not_a_member|not_included)]
|
||||
[driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>]
|
||||
[driveclientsideencryption any|encrypted|unencrypted]
|
||||
[includerooms <Boolean>]
|
||||
[excludedrafts <Boolean>] [mailclientsideencryption any|encrypted|unencrypted]
|
||||
@@ -5326,14 +5340,14 @@ gam create vaulthold|hold matter <MatterItem> [name <String>] corpus calendar|dr
|
||||
[query <QueryVaultCorpus>]
|
||||
[terms <String>] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
||||
[includerooms <Boolean>] [covereddata calllogs|textmessages|voicemails]
|
||||
[includeshareddrives|includeteamdrives <Boolean>]
|
||||
[includeshareddrives <Boolean>]
|
||||
[showdetails|returnidonly]
|
||||
gam update vaulthold|hold <HoldItem> matter <MatterItem>
|
||||
[([addaccounts|addgroups|addusers <EmailItemList>] [removeaccounts|removegroups|removeusers <EmailItemList>]) | (orgunit|org|ou <OrgUnit>)]
|
||||
[query <QueryVaultCorpus>]
|
||||
[terms <String>] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
||||
[includerooms <Boolean>] [covereddata calllogs|textmessages|voicemails]
|
||||
[includeshareddrives|includeteamdrives <Boolean>]
|
||||
[includeshareddrives <Boolean>]
|
||||
[showdetails]
|
||||
gam delete vaulthold|hold <HoldItem> matter <MatterItem>
|
||||
gam delete vaulthold|hold <MatterItem> <HoldItem>
|
||||
@@ -8322,6 +8336,17 @@ gam <UserTypeEntity> show shareddrives
|
||||
[fields <SharedDriveFieldNameList>] [noorgunits [<Boolean>]]
|
||||
[formatjson]
|
||||
|
||||
gam <UserTypeEntity> print shareddriveorganizers [todrive <ToDriveAttribute>*]
|
||||
[adminaccess|asadmin] [shareddriveadminquery|query <QuerySharedDrive>]
|
||||
[orgunit|org|ou <OrgUnitPath>]
|
||||
[matchname <REMatchPattern>]
|
||||
[domainlist <DomainList>]
|
||||
[includetypes <OrganizerTypeList>]
|
||||
[oneorganizer [<Boolean>]]
|
||||
[shownorganizerdrives [false|true|only]]
|
||||
[includefileorganizers [<Boolean>]]
|
||||
[delimiter <Character>]
|
||||
|
||||
# Users - Force Signout and Turn Off 2-Step Verification
|
||||
|
||||
gam <UserTypeEntity> signout
|
||||
|
||||
@@ -1,3 +1,62 @@
|
||||
7.08.00
|
||||
|
||||
Added the following command that can be used instead of the `GetTeamDriveOrganizers.py` script.
|
||||
|
||||
```
|
||||
gam [<UserTypeEntity>] print shareddriveorganizers [todrive <ToDriveAttribute>*]
|
||||
[adminaccess|asadmin] [shareddriveadminquery|query <QuerySharedDrive>]
|
||||
[orgunit|org|ou <OrgUnitPath>]
|
||||
[matchname <REMatchPattern>]
|
||||
[domainlist <DomainList>]
|
||||
[includetypes <OrganizerTypeList>]
|
||||
[oneorganizer [<Boolean>]]
|
||||
[shownorganizerdrives [false|true|only]]
|
||||
[includefileorganizers [<Boolean>]]
|
||||
[delimiter <Character>]
|
||||
```
|
||||
The command defaults match the script defaults:
|
||||
* `domainlist` - All domains
|
||||
* `includetypes` - user,groups
|
||||
* `oneorganizer` - False
|
||||
* `shownoorganizerdrives` - True
|
||||
* `includefileorganizers` - False
|
||||
|
||||
For example, to get a single organizer from your domain for all Shared Drives including no organizer drives:
|
||||
```
|
||||
gam redirect csv ./TeamDriveOrganizers.csv print shareddriveorganizers domainlist mydomain.com includetypes user oneorganizer shownoorganizerdrives
|
||||
```
|
||||
|
||||
7.07.17
|
||||
|
||||
Added option `oneuserperrow` to `gam print devices` to have each of a
|
||||
device's users displayed on a separate row with all of the other device fields.
|
||||
|
||||
7.07.16
|
||||
|
||||
Added `chromeostype`, `diskspaceusage` and `faninfo` to `<CrOSFieldName>` for use in `gam info|print cros`.
|
||||
|
||||
Fixed bugs/cleaned output in `gam info|print cros`.
|
||||
|
||||
7.07.15
|
||||
|
||||
Added option `shareddrivesoption included|included_if_account_is_not_a_member|not_included` to `gam create vaultexport`.
|
||||
|
||||
The previous option `includeshareddrives <Boolean>` is mapped as follows:
|
||||
* `includeshareddrives false` - `shareddrivesoption included_if_account_is_not_a_member`
|
||||
* `includeshareddrives true` - `shareddrivesoption included`
|
||||
|
||||
7.07.14
|
||||
|
||||
Update `gam setup chat` output to include the following that shows the actual Cloud Pub/Sub Topic Name.
|
||||
```
|
||||
You'll use projects/<ProjectID>/topics/no-topic in Connection settings Cloud Pub/Sub Topic Name
|
||||
```
|
||||
|
||||
7.07.13
|
||||
|
||||
Added option `showitemcountonly` to `gam [<UserTypeEntity>] print|show shareddrives` that causes GAM to display the
|
||||
number of Shared Drives on stdout; no CSV file is written.
|
||||
|
||||
7.07.12
|
||||
|
||||
Fixed bug in `gam print|show oushareddrives` that caused a trap.
|
||||
|
||||
@@ -38,6 +38,10 @@ hiddenimports = [
|
||||
'gam.gamlib.yubikey',
|
||||
]
|
||||
|
||||
excludes = [
|
||||
'pkg_resources',
|
||||
]
|
||||
|
||||
runtime_hooks = []
|
||||
a = Analysis(
|
||||
['gam/__main__.py'],
|
||||
@@ -48,7 +52,7 @@ a = Analysis(
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=runtime_hooks,
|
||||
excludes=[],
|
||||
excludes=excludes,
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=None,
|
||||
|
||||
@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
|
||||
"""
|
||||
|
||||
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
||||
__version__ = '7.07.12'
|
||||
__version__ = '7.08.00'
|
||||
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
||||
|
||||
#pylint: disable=wrong-import-position
|
||||
@@ -17102,11 +17102,11 @@ DATA_TRANSFER_SORT_TITLES = ['id', 'requestTime', 'oldOwnerUserEmail', 'newOwner
|
||||
|
||||
# gam print datatransfers|transfers [todrive <ToDriveAttribute>*]
|
||||
# [olduser|oldowner <UserItem>] [newuser|newowner <UserItem>]
|
||||
# [status <String>] [delimiter <Character>]]
|
||||
# [status <String>] [delimiter <Character>]
|
||||
# (addcsvdata <FieldName> <String>)*
|
||||
# gam show datatransfers|transfers
|
||||
# [olduser|oldowner <UserItem>] [newuser|newowner <UserItem>]
|
||||
# [status <String>] [delimiter <Character>]]
|
||||
# [status <String>] [delimiter <Character>]
|
||||
def doPrintShowDataTransfers():
|
||||
dt = buildGAPIObject(API.DATATRANSFER)
|
||||
apps = getTransferApplications(dt)
|
||||
@@ -23759,12 +23759,14 @@ CROS_FIELDS_CHOICE_MAP = {
|
||||
'autoupdatethrough': 'autoUpdateThrough',
|
||||
'backlightinfo': 'backlightInfo',
|
||||
'bootmode': 'bootMode',
|
||||
'chromeostype': 'chromeOsType',
|
||||
'cpuinfo': 'cpuInfo',
|
||||
'cpustatusreports': 'cpuStatusReports',
|
||||
'deprovisionreason': 'deprovisionReason',
|
||||
'devicefiles': ['deviceFiles.type', 'deviceFiles.createTime'],
|
||||
'deviceid': 'deviceId',
|
||||
'devicelicensetype': 'deviceLicenseType',
|
||||
'diskspaceusage': 'diskSpaceUsage',
|
||||
'diskvolumereports': 'diskVolumeReports',
|
||||
'dockmacaddress': 'dockMacAddress',
|
||||
'ethernetmacaddress': 'ethernetMacAddress',
|
||||
@@ -23772,6 +23774,7 @@ CROS_FIELDS_CHOICE_MAP = {
|
||||
'extendedsupporteligible': 'extendedSupportEligible',
|
||||
'extendedsupportstart': 'extendedSupportStart',
|
||||
'extendedsupportenabled': 'extendedSupportEnabled',
|
||||
'faninfo': 'fanInfo',
|
||||
'firmwareversion': 'firmwareVersion',
|
||||
'firstenrollmenttime': 'firstEnrollmentTime',
|
||||
'lastdeprovisiontimestamp': 'lastDeprovisionTimestamp',
|
||||
@@ -23819,6 +23822,7 @@ CROS_SCALAR_PROPERTY_PRINT_ORDER = [
|
||||
'notes',
|
||||
'serialNumber',
|
||||
'status',
|
||||
'chromeOsType',
|
||||
'deviceLicenseType',
|
||||
'model',
|
||||
'firmwareVersion',
|
||||
@@ -23839,6 +23843,7 @@ CROS_SCALAR_PROPERTY_PRINT_ORDER = [
|
||||
'manufactureDate',
|
||||
'supportEndDate',
|
||||
'autoUpdateExpiration',
|
||||
'autoUpdateThrough',
|
||||
'willAutoRenew',
|
||||
]
|
||||
|
||||
@@ -23863,8 +23868,11 @@ CROS_TIME_OBJECTS = {
|
||||
'lastDeprovisionTimestamp',
|
||||
'lastEnrollmentTime',
|
||||
'lastSync',
|
||||
'rebootTime',
|
||||
'reportTime',
|
||||
'supportEndDate',
|
||||
'updateTime',
|
||||
'updateCheckTime',
|
||||
}
|
||||
CROS_FIELDS_WITH_CRS_NLS = {'notes'}
|
||||
CROS_START_ARGUMENTS = ['start', 'startdate', 'oldestdate']
|
||||
@@ -23981,13 +23989,13 @@ def infoCrOSDevices(entityList):
|
||||
printKeyValueWithCRsNLs(up, cros[up])
|
||||
else:
|
||||
printKeyValueList([up, formatLocalTime(cros[up])])
|
||||
up = 'tpmVersionInfo'
|
||||
if up in cros:
|
||||
printKeyValueList([up, ''])
|
||||
Ind.Increment()
|
||||
for key, value in sorted(iter(cros[up].items())):
|
||||
printKeyValueList([key, value])
|
||||
Ind.Decrement()
|
||||
for up in ['diskSpaceUsage', 'osUpdateStatus', 'tpmVersionInfo']:
|
||||
if up in cros:
|
||||
printKeyValueList([up, ''])
|
||||
Ind.Increment()
|
||||
for key, value in sorted(iter(cros[up].items())):
|
||||
printKeyValueList([key, value])
|
||||
Ind.Decrement()
|
||||
if not noLists:
|
||||
activeTimeRanges = _filterActiveTimeRanges(cros, True, listLimit, startDate, endDate, activeTimeRangesOrder)
|
||||
if activeTimeRanges:
|
||||
@@ -24041,6 +24049,9 @@ def infoCrOSDevices(entityList):
|
||||
entityActionNotPerformedWarning([Ent.CROS_DEVICE, deviceId, Ent.DEVICE_FILE, downloadfile],
|
||||
Msg.NO_ENTITIES_FOUND.format(Ent.Plural(Ent.DEVICE_FILE)), i, count)
|
||||
Act.Set(Act.INFO)
|
||||
cpuInfo = _filterBasicList(cros, 'cpuInfo', True, listLimit)
|
||||
if cpuInfo:
|
||||
showJSON('cpuInfo', cpuInfo, dictObjectsKey={'cpuInfo': 'model'})
|
||||
cpuStatusReports = _filterCPUStatusReports(cros, True, listLimit, startTime, endTime)
|
||||
if cpuStatusReports:
|
||||
printKeyValueList(['cpuStatusReports'])
|
||||
@@ -24058,6 +24069,12 @@ def infoCrOSDevices(entityList):
|
||||
printKeyValueList(['cpuUtilizationPercentageInfo', cpuStatusReport['cpuUtilizationPercentageInfo']])
|
||||
Ind.Decrement()
|
||||
Ind.Decrement()
|
||||
backlightInfo = _filterBasicList(cros, 'backLightInfo', True, listLimit)
|
||||
if backlightInfo:
|
||||
showJSON('backlightInfo', backlightInfo, dictObjectsKey={'backlightInfo': 'path'})
|
||||
fanInfo = _filterBasicList(cros, 'fanInfo', True, listLimit)
|
||||
if fanInfo:
|
||||
showJSON('fanInfo', fanInfo)
|
||||
diskVolumeReports = _filterBasicList(cros, 'diskVolumeReports', True, listLimit)
|
||||
if diskVolumeReports:
|
||||
printKeyValueList(['diskVolumeReports'])
|
||||
@@ -24284,7 +24301,7 @@ CROS_ENTITIES_MAP = {
|
||||
}
|
||||
|
||||
CROS_INDEXED_TITLES = ['activeTimeRanges', 'recentUsers', 'deviceFiles',
|
||||
'cpuStatusReports', 'diskVolumeReports', 'lastKnownNetwork', 'screenshotFiles', 'systemRamFreeReports']
|
||||
'cpuStatusReports', 'cpuInfo', 'backlightInfo', 'fanInfo', 'diskVolumeReports', 'lastKnownNetwork', 'screenshotFiles', 'systemRamFreeReports']
|
||||
|
||||
# gam print cros [todrive <ToDriveAttribute>*]
|
||||
# [(query <QueryCrOS>)|(queries <QueryCrOSList>) [querytime<String> <Time>]
|
||||
@@ -24331,12 +24348,15 @@ def doPrintCrOSDevices(entityList=None):
|
||||
if not noLists and not selectedLists:
|
||||
csvPF.WriteRowTitles(flattenJSON(cros, listLimit=listLimit, timeObjects=CROS_TIME_OBJECTS))
|
||||
return
|
||||
attrib = 'tpmVersionInfo'
|
||||
if attrib in cros:
|
||||
for key, value in sorted(iter(cros[attrib].items())):
|
||||
attribKey = f'{attrib}{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{key}'
|
||||
cros[attribKey] = value
|
||||
cros.pop(attrib)
|
||||
for attrib in ['diskSpaceUsage', 'osUpdateStatus', 'tpmVersionInfo']:
|
||||
if attrib in cros:
|
||||
for key, value in sorted(iter(cros[attrib].items())):
|
||||
attribKey = f'{attrib}{GC.Values[GC.CSV_OUTPUT_SUBFIELD_DELIMITER]}{key}'
|
||||
if key not in CROS_TIME_OBJECTS:
|
||||
cros[attribKey] = value
|
||||
else:
|
||||
cros[attribKey] = formatLocalTime(value)
|
||||
cros.pop(attrib)
|
||||
activeTimeRanges = _filterActiveTimeRanges(cros, selectedLists.get('activeTimeRanges', False), listLimit, startDate, endDate, activeTimeRangesOrder)
|
||||
recentUsers = _filterRecentUsers(cros, selectedLists.get('recentUsers', False), listLimit)
|
||||
deviceFiles = _filterDeviceFiles(cros, selectedLists.get('deviceFiles', False), listLimit, startTime, endTime)
|
||||
@@ -24350,8 +24370,10 @@ def doPrintCrOSDevices(entityList=None):
|
||||
return
|
||||
row = {}
|
||||
for attrib in cros:
|
||||
if attrib not in {'kind', 'etag', 'tpmVersionInfo', 'recentUsers', 'activeTimeRanges',
|
||||
'deviceFiles', 'cpuStatusReports', 'diskVolumeReports', 'lastKnownNetwork', 'screenshotFiles', 'systemRamFreeReports'}:
|
||||
if attrib in {'cpuInfo', 'backlightInfo', 'fanInfo'}:
|
||||
flattenJSON({attrib: cros[attrib]}, flattened=row)
|
||||
elif attrib not in {'kind', 'etag', 'diskSpaceUsage', 'osUpdateStatus', 'tpmVersionInfo', 'activeTimeRanges', 'recentUsers',
|
||||
'deviceFiles', 'cpuStatusReports', 'diskVolumeReports', 'lastKnownNetwork', 'screenshotFiles', 'systemRamFreeReports'}:
|
||||
if attrib not in CROS_TIME_OBJECTS:
|
||||
row[attrib] = cros[attrib]
|
||||
else:
|
||||
@@ -25949,7 +25971,7 @@ def _printChatItem(user, citem, parent, entityType, csvPF, FJQC, addCSVData=None
|
||||
def doSetupChat():
|
||||
checkForExtraneousArguments()
|
||||
_, chat , _ = buildChatServiceObject()
|
||||
writeStdout(Msg.TO_SET_UP_GOOGLE_CHAT.format(setupChatURL(chat)))
|
||||
writeStdout(Msg.TO_SET_UP_GOOGLE_CHAT.format(setupChatURL(chat), GM.Globals[GM.OAUTH2SERVICE_JSON_DATA]['project_id']))
|
||||
|
||||
def getSpaceName(myarg):
|
||||
if myarg == 'space':
|
||||
@@ -29565,7 +29587,7 @@ DEVICE_ORDERBY_CHOICE_MAP = {
|
||||
# <DeviceFieldName>* [fields <DeviceFieldNameList>] [userfields <DeviceUserFieldNameList>]
|
||||
# [orderby <DeviceOrderByFieldName> [ascending|descending]]
|
||||
# [all|company|personal|nocompanydevices|nopersonaldevices]
|
||||
# [nodeviceusers]
|
||||
# [nodeviceusers|oneuserperrow]
|
||||
# [formatjson [quotechar <Character>]]
|
||||
# [showitemcountonly]
|
||||
def doPrintCIDevices():
|
||||
@@ -29581,7 +29603,7 @@ def doPrintCIDevices():
|
||||
queries = [None]
|
||||
view, entityType = DEVICE_VIEW_CHOICE_MAP['all']
|
||||
getDeviceUsers = True
|
||||
showItemCountOnly = False
|
||||
oneUserPerRow = showItemCountOnly = False
|
||||
while Cmd.ArgumentsRemaining():
|
||||
myarg = getArgument()
|
||||
if csvPF and myarg == 'todrive':
|
||||
@@ -29596,6 +29618,8 @@ def doPrintCIDevices():
|
||||
view, entityType = DEVICE_VIEW_CHOICE_MAP[myarg]
|
||||
elif myarg == 'nodeviceusers':
|
||||
getDeviceUsers = False
|
||||
elif myarg in {'oneuserperrow', 'oneitemperrow'}:
|
||||
getDeviceUsers = oneUserPerRow = True
|
||||
elif getFieldsList(myarg, DEVICE_FIELDS_CHOICE_MAP, fieldsList, initialField='name'):
|
||||
pass
|
||||
elif getFieldsList(myarg, DEVICEUSER_FIELDS_CHOICE_MAP, userFieldsList, initialField='name', fieldsArg='userfields'):
|
||||
@@ -29609,6 +29633,8 @@ def doPrintCIDevices():
|
||||
fields = getItemFieldsFromFieldsList('devices', fieldsList)
|
||||
userFields = getItemFieldsFromFieldsList('deviceUsers', userFieldsList)
|
||||
substituteQueryTimes(queries, queryTimes)
|
||||
if FJQC.formatJSON and oneUserPerRow:
|
||||
csvPF.SetJSONTitles(['name', 'user.name', 'JSON'])
|
||||
itemCount = 0
|
||||
for query in queries:
|
||||
printGettingAllAccountEntities(entityType, query)
|
||||
@@ -29650,13 +29676,26 @@ def doPrintCIDevices():
|
||||
except (GAPI.invalid, GAPI.invalidArgument, GAPI.permissionDenied) as e:
|
||||
entityActionFailedWarning([entityType, None], str(e))
|
||||
for device in devices:
|
||||
row = flattenJSON(device, timeObjects=DEVICE_TIME_OBJECTS)
|
||||
if not FJQC.formatJSON:
|
||||
csvPF.WriteRowTitles(row)
|
||||
elif csvPF.CheckRowTitles(row):
|
||||
csvPF.WriteRowNoFilter({'name': device['name'],
|
||||
'JSON': json.dumps(cleanJSON(device, timeObjects=DEVICE_TIME_OBJECTS),
|
||||
ensure_ascii=False, sort_keys=True)})
|
||||
if not oneUserPerRow or 'users' not in device:
|
||||
row = flattenJSON(device, timeObjects=DEVICE_TIME_OBJECTS)
|
||||
if not FJQC.formatJSON:
|
||||
csvPF.WriteRowTitles(row)
|
||||
elif csvPF.CheckRowTitles(row):
|
||||
csvPF.WriteRowNoFilter({'name': device['name'],
|
||||
'JSON': json.dumps(cleanJSON(device, timeObjects=DEVICE_TIME_OBJECTS),
|
||||
ensure_ascii=False, sort_keys=True)})
|
||||
else:
|
||||
deviceUsers = device.pop('users')
|
||||
baserow = flattenJSON(device, timeObjects=DEVICE_TIME_OBJECTS)
|
||||
for deviceUser in deviceUsers:
|
||||
row = flattenJSON({'user': deviceUser}, flattened=baserow.copy(), timeObjects=DEVICE_TIME_OBJECTS)
|
||||
if not FJQC.formatJSON:
|
||||
csvPF.WriteRowTitles(row)
|
||||
elif csvPF.CheckRowTitles(row):
|
||||
device['user'] = deviceUser
|
||||
csvPF.WriteRowNoFilter({'name': device['name'], 'user.name': deviceUser['name'],
|
||||
'JSON': json.dumps(cleanJSON(device, timeObjects=DEVICE_TIME_OBJECTS),
|
||||
ensure_ascii=False, sort_keys=True)})
|
||||
if showItemCountOnly:
|
||||
writeStdout(f'{itemCount}\n')
|
||||
return
|
||||
@@ -40817,6 +40856,11 @@ VAULT_RESPONSE_STATUS_MAP = {
|
||||
'needsaction': 'ATTENDEE_RESPONSE_NEEDS_ACTION',
|
||||
'tentative': 'ATTENDEE_RESPONSE_TENTATIVE',
|
||||
}
|
||||
VAULT_SHARED_DRIVES_OPTION_MAP = {
|
||||
'included': 'INCLUDED',
|
||||
'includedifaccountisnotamember': 'INCLUDED_IF_ACCOUNT_IS_NOT_A_MEMBER',
|
||||
'notincluded': 'NOT_INCLUDED',
|
||||
}
|
||||
VAULT_VOICE_COVERED_DATA_MAP = {
|
||||
'calllogs': 'CALL_LOGS',
|
||||
'textmessages': 'TEXT_MESSAGES',
|
||||
@@ -40875,7 +40919,7 @@ VAULT_QUERY_ARGS = [
|
||||
# calendar
|
||||
'locationquery', 'peoplequery', 'minuswords', 'responsestatuses', 'caldendarversiondate',
|
||||
# drive
|
||||
'driveclientsideencryption', 'driveversiondate', 'includeshareddrives', 'includeteamdrives',
|
||||
'driveclientsideencryption', 'driveversiondate', 'includeshareddrives', 'includeteamdrives', 'shareddrivesoption',
|
||||
# hangoutsChat
|
||||
'includerooms',
|
||||
# mail
|
||||
@@ -40945,7 +40989,9 @@ def _buildVaultQuery(myarg, query, corpusArgumentMap):
|
||||
elif myarg == 'driveversiondate':
|
||||
query.setdefault('driveOptions', {})['versionDate'] = getTimeOrDeltaFromNow()
|
||||
elif myarg in {'includeshareddrives', 'includeteamdrives'}:
|
||||
query.setdefault('driveOptions', {})['includeSharedDrives'] = getBoolean()
|
||||
query.setdefault('driveOptions', {})['sharedDrivesOption'] = 'INCLUDED' if getBoolean() else 'INCLUDED_IF_ACCOUNT_IS_NOT_A_MEMBER'
|
||||
elif myarg == 'shareddrivesoption':
|
||||
query.setdefault('driveOptions', {})['sharedDrivesOption'] = getChoice(VAULT_SHARED_DRIVES_OPTION_MAP, mapChoice=True)
|
||||
elif myarg == 'driveclientsideencryption':
|
||||
query.setdefault('driveOptions', {})['clientSideEncryptedOption'] = getChoice(VAULT_CSE_OPTION_MAP, mapChoice=True)
|
||||
# hangoutsChat
|
||||
@@ -40979,7 +41025,8 @@ def _validateVaultQuery(body, corpusArgumentMap):
|
||||
# [terms <String>] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>] [timezone <TimeZone>]
|
||||
# [locationquery <StringList>] [peoplequery <StringList>] [minuswords <StringList>]
|
||||
# [responsestatuses <AttendeeStatus>(,<AttendeeStatus>)*] [calendarversiondate <Date>|<Time>]
|
||||
# [includeshareddrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>]
|
||||
# [(includeshareddrives <Boolean>)|(shareddrivesoption included|included_if_account_is_not_a_member|not_included)]
|
||||
# [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>]
|
||||
# [driveclientsideencryption any|encrypted|unencrypted]
|
||||
# [includerooms <Boolean>]
|
||||
# [excludedrafts <Boolean>] [mailclientsideencryption any|encrypted|unencrypted]
|
||||
@@ -41050,7 +41097,7 @@ def doCreateVaultExport():
|
||||
try:
|
||||
export = callGAPI(v.matters().exports(), 'create',
|
||||
throwReasons=[GAPI.ALREADY_EXISTS, GAPI.BAD_REQUEST, GAPI.BACKEND_ERROR, GAPI.INVALID_ARGUMENT,
|
||||
GAPI.INVALID, GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN, GAPI.QUOTA_EXCEEDED],
|
||||
GAPI.INVALID, GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN, GAPI.QUOTA_EXCEEDED, GAPI.NOT_FOUND],
|
||||
matterId=matterId, body=body)
|
||||
if not returnIdOnly:
|
||||
entityActionPerformed([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_EXPORT, formatVaultNameId(export['name'], export['id'])])
|
||||
@@ -41059,7 +41106,7 @@ def doCreateVaultExport():
|
||||
else:
|
||||
writeStdout(f'{export["id"]}\n')
|
||||
except (GAPI.alreadyExists, GAPI.badRequest, GAPI.backendError, GAPI.invalidArgument,
|
||||
GAPI.invalid, GAPI.failedPrecondition, GAPI.forbidden, GAPI.quotaExceeded) as e:
|
||||
GAPI.invalid, GAPI.failedPrecondition, GAPI.forbidden, GAPI.quotaExceeded, GAPI.notFound) as e:
|
||||
entityActionFailedWarning([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_EXPORT, body.get('name')], str(e))
|
||||
|
||||
# gam delete vaultexport|export <ExportItem> matter <MatterItem>
|
||||
@@ -41573,7 +41620,7 @@ def _setHoldQuery(body, queryParameters):
|
||||
# [terms <String>] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
||||
# [includerooms <Boolean>]
|
||||
# [covereddata calllogs|textmessages|voicemails]
|
||||
# [includeshareddrives|includeteamdrives <Boolean>]
|
||||
# [includeshareddrives <Boolean>]
|
||||
# [showdetails|returnidonly]
|
||||
def doCreateVaultHold():
|
||||
v = buildGAPIObject(API.VAULT)
|
||||
@@ -41639,7 +41686,7 @@ def doCreateVaultHold():
|
||||
# [terms <String>] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
||||
# [includerooms <Boolean>]
|
||||
# [covereddata calllogs|textmessages|voicemails]
|
||||
# [includeshareddrives|includeteamdrives <Boolean>]
|
||||
# [includeshareddrives <Boolean>]
|
||||
# [showdetails]
|
||||
def doUpdateVaultHold():
|
||||
v = buildGAPIObject(API.VAULT)
|
||||
@@ -59838,6 +59885,7 @@ def copyDriveFile(users):
|
||||
# Source at root of Shared Drive?
|
||||
sourceMimeType = source['mimeType']
|
||||
if sourceMimeType == MIMETYPE_GA_FOLDER and source.get('driveId') and source['name'] == TEAM_DRIVE and not source.get('parents', []):
|
||||
copyMoveOptions['sourceIsMyDriveSharedDrive'] = True
|
||||
source['name'] = _getSharedDriveNameFromId(drive, source['driveId'])
|
||||
sourceName = source['name']
|
||||
sourceNameId = f"{sourceName}({source['id']})"
|
||||
@@ -65416,12 +65464,14 @@ SHAREDDRIVE_ACL_ROLES_MAP = {
|
||||
# (role|roles <SharedDriveACLRoleList>)*
|
||||
# [fields <SharedDriveFieldNameList>] [noorgunits [<Boolean>]]
|
||||
# [guiroles [<Boolean>]] [formatjson [quotechar <Character>]]
|
||||
# [showitemcountonly]
|
||||
# gam <UserTypeEntity> show shareddrives
|
||||
# [asadmin [shareddriveadminquery|query <QuerySharedDrive>]]
|
||||
# [matchname <REMatchPattrn>] [orgunit|org|ou <OrgUnitPath>]
|
||||
# (role|roles <SharedDriveACLRoleLIst>)*
|
||||
# [fields <SharedDriveFieldNameList>] [noorgunits [<Boolean>]]
|
||||
# [guiroles [<Boolean>]] [formatjson]
|
||||
# [showitemcountonly]
|
||||
def printShowSharedDrives(users, useDomainAdminAccess=False):
|
||||
def stripNonShowFields(shareddrive):
|
||||
if orgUnitIdToPathMap:
|
||||
@@ -65445,7 +65495,7 @@ def printShowSharedDrives(users, useDomainAdminAccess=False):
|
||||
SHAREDDRIVE_FIELDS_CHOICE_MAP.update(SHAREDDRIVE_LIST_FIELDS_CHOICE_MAP)
|
||||
showOrgUnitPaths = True
|
||||
orgUnitIdToPathMap = None
|
||||
guiRoles = False
|
||||
guiRoles = showItemCountOnly = False
|
||||
while Cmd.ArgumentsRemaining():
|
||||
myarg = getArgument()
|
||||
if csvPF and myarg == 'todrive':
|
||||
@@ -65475,6 +65525,9 @@ def printShowSharedDrives(users, useDomainAdminAccess=False):
|
||||
showOrgUnitPaths = not getBoolean()
|
||||
elif myarg == 'guiroles':
|
||||
guiRoles = getBoolean()
|
||||
elif myarg == 'showitemcountonly':
|
||||
showItemCountOnly = True
|
||||
showOrgUnitPaths = False
|
||||
else:
|
||||
FJQC.GetFormatJSONQuoteChar(myarg, True)
|
||||
if query and not useDomainAdminAccess:
|
||||
@@ -65544,6 +65597,9 @@ def printShowSharedDrives(users, useDomainAdminAccess=False):
|
||||
jcount = len(matchedFeed)
|
||||
if jcount == 0:
|
||||
setSysExitRC(NO_ENTITIES_FOUND_RC)
|
||||
if showItemCountOnly:
|
||||
writeStdout(f'{jcount}\n')
|
||||
return
|
||||
if not csvPF:
|
||||
if not FJQC.formatJSON:
|
||||
entityPerformActionNumItems([Ent.USER, user], jcount, Ent.SHAREDDRIVE, i, count)
|
||||
@@ -65574,9 +65630,11 @@ def doPrintShowSharedDrives():
|
||||
# gam print oushareddrives [todrive <ToDriveAttribute>*]
|
||||
# [ou|org|orgunit <OrgUnitPath>]
|
||||
# [formatjson [quotechar <Character>]]
|
||||
# [showitemcountonly]
|
||||
# gam show oushareddrives
|
||||
# [ou|org|orgunit <OrgUnitPath>]
|
||||
# [formatjson]
|
||||
# [showitemcountonly]
|
||||
def doPrintShowOrgunitSharedDrives():
|
||||
def _getOrgUnitSharedDriveInfo(shareddrive):
|
||||
shareddrive['driveId'] = shareddrive['name'].rsplit(';')[1]
|
||||
@@ -65605,12 +65663,15 @@ def doPrintShowOrgunitSharedDrives():
|
||||
csvPF = CSVPrintFile(['name', 'type', 'member', 'memberUri', 'driveId', 'driveName', 'orgUnitPath']) if Act.csvFormat() else None
|
||||
FJQC = FormatJSONQuoteChar(csvPF)
|
||||
orgUnitPath = '/'
|
||||
showItemCountOnly = False
|
||||
while Cmd.ArgumentsRemaining():
|
||||
myarg = getArgument()
|
||||
if csvPF and myarg == 'todrive':
|
||||
csvPF.GetTodriveParameters()
|
||||
elif myarg in {'ou', 'org', 'orgunit'}:
|
||||
orgUnitPath = getString(Cmd.OB_ORGUNIT_ITEM)
|
||||
elif myarg == 'showitemcountonly':
|
||||
showItemCountOnly = True
|
||||
else:
|
||||
FJQC.GetFormatJSONQuoteChar(myarg, True)
|
||||
if csvPF and FJQC.formatJSON:
|
||||
@@ -65625,6 +65686,9 @@ def doPrintShowOrgunitSharedDrives():
|
||||
jcount = len(sds)
|
||||
if jcount == 0:
|
||||
setSysExitRC(NO_ENTITIES_FOUND_RC)
|
||||
if showItemCountOnly:
|
||||
writeStdout(f'{jcount}\n')
|
||||
return
|
||||
if not csvPF:
|
||||
if not FJQC.formatJSON:
|
||||
entityPerformActionNumItems([Ent.ORGANIZATIONAL_UNIT, orgUnitPath], jcount, Ent.SHAREDDRIVE)
|
||||
@@ -65986,6 +66050,159 @@ def printShowSharedDriveACLs(users, useDomainAdminAccess=False):
|
||||
def doPrintShowSharedDriveACLs():
|
||||
printShowSharedDriveACLs([_getAdminEmail()], True)
|
||||
|
||||
PRINT_ORGANIZER_TYPES = {'group', 'user'}
|
||||
|
||||
# gam [<UserTypeEntity>] print shareddriveorganizers [todrive <ToDriveAttribute>*]
|
||||
# [adminaccess|asadmin] [shareddriveadminquery|query <QuerySharedDrive>]
|
||||
# [matchname <REMatchPattern>] [orgunit|org|ou <OrgUnitPath>]
|
||||
# [domainlist <DomainList>]
|
||||
# [includetypes user|group]
|
||||
# [oneorganizer [<Boolean>]]
|
||||
# [shownorganizerdrives false|true|only]
|
||||
# [includefileorganizers [<Boolean>]]
|
||||
# [delimiter <Character>]
|
||||
def printSharedDriveOrganizers(users, useDomainAdminAccess=False):
|
||||
csvPF = CSVPrintFile(['id', 'name', 'organizers', 'createdTime'], 'sortall')
|
||||
delimiter = GC.Values[GC.CSV_OUTPUT_FIELD_DELIMITER]
|
||||
roles = set(['organizer'])
|
||||
includeTypes = set()
|
||||
showNoOrganizerDrives = SHOW_NO_PERMISSIONS_DRIVES_CHOICE_MAP['false']
|
||||
fieldsList = ['role', 'type', 'emailAddress']
|
||||
cd = orgUnitId = query = matchPattern = None
|
||||
domainList = []
|
||||
oneOrganizer = False
|
||||
while Cmd.ArgumentsRemaining():
|
||||
myarg = getArgument()
|
||||
if csvPF and myarg == 'todrive':
|
||||
csvPF.GetTodriveParameters()
|
||||
elif myarg == 'delimiter':
|
||||
delimiter = getCharacter()
|
||||
elif myarg in {'teamdriveadminquery', 'shareddriveadminquery', 'query'}:
|
||||
queryLocation = Cmd.Location()
|
||||
query = getString(Cmd.OB_QUERY, minLen=0) or None
|
||||
if query:
|
||||
query = mapQueryRelativeTimes(query, ['createdTime'])
|
||||
elif myarg == 'matchname':
|
||||
matchPattern = getREPattern(re.IGNORECASE)
|
||||
elif myarg in {'ou', 'org', 'orgunit'}:
|
||||
orgLocation = Cmd.Location()
|
||||
if cd is None:
|
||||
cd = buildGAPIObject(API.DIRECTORY)
|
||||
orgUnitPath, orgUnitId = getOrgUnitId(cd)
|
||||
orgUnitId = orgUnitId[3:]
|
||||
orgUnitInfo = {'orgUnit': orgUnitPath, 'orgUnitId': orgUnitId}
|
||||
elif myarg in ADMIN_ACCESS_OPTIONS:
|
||||
useDomainAdminAccess = True
|
||||
elif myarg == 'domainlist':
|
||||
domainList = set(getString(Cmd.OB_DOMAIN_NAME_LIST).replace(',', ' ').lower().split())
|
||||
elif myarg == 'includetypes':
|
||||
for itype in getString(Cmd.OB_ORGANIZER_TYPE_LIST).lower().replace(',', ' ').split():
|
||||
if itype in PRINT_ORGANIZER_TYPES:
|
||||
includeTypes.add(itype)
|
||||
else:
|
||||
invalidChoiceExit(itype, PRINT_ORGANIZER_TYPES, True)
|
||||
elif myarg == 'oneorganizer':
|
||||
oneOrganizer = getBoolean()
|
||||
elif myarg == 'shownoorganizerdrives':
|
||||
showNoOrganizerDrives = getChoice(SHOW_NO_PERMISSIONS_DRIVES_CHOICE_MAP, defaultChoice=1, mapChoice=True)
|
||||
elif myarg in {'includefileorganizers', 'includecontentmanagers'}:
|
||||
if getBoolean():
|
||||
roles.add('fileOrganizer')
|
||||
else:
|
||||
unknownArgumentExit()
|
||||
if query and not useDomainAdminAccess:
|
||||
Cmd.SetLocation(queryLocation-1)
|
||||
usageErrorExit(Msg.ONLY_ADMINISTRATORS_CAN_PERFORM_SHARED_DRIVE_QUERIES)
|
||||
if orgUnitId is not None:
|
||||
if not useDomainAdminAccess:
|
||||
Cmd.SetLocation(orgLocation-1)
|
||||
usageErrorExit(Msg.ONLY_ADMINISTRATORS_CAN_SPECIFY_SHARED_DRIVE_ORGUNIT)
|
||||
csvPF.AddTitles(['orgUnit', 'orgUnitId'])
|
||||
if not includeTypes:
|
||||
includeTypes = PRINT_ORGANIZER_TYPES
|
||||
fields = getItemFieldsFromFieldsList('permissions', fieldsList, True)
|
||||
i, count, users = getEntityArgument(users)
|
||||
for user in users:
|
||||
i += 1
|
||||
user, drive = buildGAPIServiceObject(API.DRIVE3, user, i, count)
|
||||
if not drive:
|
||||
continue
|
||||
if useDomainAdminAccess:
|
||||
printGettingAllAccountEntities(Ent.SHAREDDRIVE, query)
|
||||
pageMessage = getPageMessage()
|
||||
else:
|
||||
printGettingAllEntityItemsForWhom(Ent.SHAREDDRIVE, user, i, count, query)
|
||||
pageMessage = getPageMessageForWhom()
|
||||
try:
|
||||
feed = callGAPIpages(drive.drives(), 'list', 'drives',
|
||||
pageMessage=pageMessage,
|
||||
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.INVALID_QUERY, GAPI.INVALID,
|
||||
GAPI.QUERY_REQUIRES_ADMIN_CREDENTIALS,
|
||||
GAPI.NO_LIST_TEAMDRIVES_ADMINISTRATOR_PRIVILEGE,
|
||||
GAPI.FILE_NOT_FOUND],
|
||||
q=query, useDomainAdminAccess=useDomainAdminAccess,
|
||||
fields='nextPageToken,drives(id,name,createdTime,orgUnitId)', pageSize=100)
|
||||
except (GAPI.invalidQuery, GAPI.invalid, GAPI.queryRequiresAdminCredentials,
|
||||
GAPI.noListTeamDrivesAdministratorPrivilege, GAPI.fileNotFound) as e:
|
||||
entityActionFailedWarning([Ent.USER, user, Ent.SHAREDDRIVE, None], str(e), i, count)
|
||||
continue
|
||||
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
||||
userDriveServiceNotEnabledWarning(user, str(e), i, count)
|
||||
continue
|
||||
matchFeed = []
|
||||
jcount = len(feed)
|
||||
j = 0
|
||||
for shareddrive in feed:
|
||||
j += 1
|
||||
if ((matchPattern is not None and matchPattern.match(shareddrive['name']) is None) or
|
||||
(orgUnitId is not None and orgUnitId != shareddrive.get('orgUnitId'))):
|
||||
continue
|
||||
printGettingAllEntityItemsForWhom(Ent.PERMISSION, shareddrive['name'], j, jcount)
|
||||
shareddrive['createdTime'] = formatLocalTime(shareddrive['createdTime'])
|
||||
shareddrive['organizers'] = []
|
||||
try:
|
||||
permissions = callGAPIpages(drive.permissions(), 'list', 'permissions',
|
||||
pageMessage=getPageMessageForWhom(),
|
||||
throwReasons=GAPI.DRIVE3_GET_ACL_REASONS,
|
||||
retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS,
|
||||
useDomainAdminAccess=useDomainAdminAccess,
|
||||
fileId=shareddrive['id'], fields=fields, supportsAllDrives=True)
|
||||
for permission in permissions:
|
||||
if permission['type'] in includeTypes and permission['role'] in roles:
|
||||
if domainList:
|
||||
_, domain = permission['emailAddress'].lower().split('@', 1)
|
||||
if domain not in domainList:
|
||||
continue
|
||||
shareddrive['organizers'].append(permission['emailAddress'])
|
||||
if oneOrganizer:
|
||||
break
|
||||
if not shareddrive['organizers']:
|
||||
if showNoOrganizerDrives == 0: # no organizers and showNoOrganizerDrives False - ignore
|
||||
continue
|
||||
matchFeed.append(shareddrive) # no organizers and showNoOrganizerDrives Only/True - keep
|
||||
continue
|
||||
if showNoOrganizerDrives < 0: # organizers and showNoOrganizerDrives Only/True - ignore
|
||||
continue
|
||||
matchFeed.append(shareddrive)
|
||||
except (GAPI.fileNotFound, GAPI.forbidden, GAPI.internalError,
|
||||
GAPI.insufficientAdministratorPrivileges, GAPI.insufficientFilePermissions,
|
||||
GAPI.unknownError, GAPI.invalid):
|
||||
pass
|
||||
if len(matchFeed) == 0:
|
||||
setSysExitRC(NO_ENTITIES_FOUND_RC)
|
||||
for shareddrive in matchFeed:
|
||||
row = {'id': shareddrive['id'], 'name': shareddrive['name'],
|
||||
'organizers': delimiter.join(shareddrive['organizers']),
|
||||
'createdTime': shareddrive['createdTime']}
|
||||
if orgUnitId:
|
||||
row.update(orgUnitInfo)
|
||||
csvPF.WriteRowTitles(row)
|
||||
if csvPF:
|
||||
csvPF.writeCSVfile('SharedDrive Organizers')
|
||||
|
||||
def doPrintSharedDriveOrganizers():
|
||||
printSharedDriveOrganizers([_getAdminEmail()], True)
|
||||
|
||||
LOOKERSTUDIO_ASSETTYPE_CHOICE_MAP = {
|
||||
'report': ['REPORT'],
|
||||
'datasource': ['DATA_SOURCE'],
|
||||
@@ -75872,6 +76089,7 @@ MAIN_COMMANDS_WITH_OBJECTS = {
|
||||
Cmd.ARG_SCHEMA: doPrintShowUserSchemas,
|
||||
Cmd.ARG_SHAREDDRIVE: doPrintShowSharedDrives,
|
||||
Cmd.ARG_SHAREDDRIVEACLS: doPrintShowSharedDriveACLs,
|
||||
Cmd.ARG_SHAREDDRIVEORGANIZERS: doPrintSharedDriveOrganizers,
|
||||
Cmd.ARG_SITE: deprecatedDomainSites,
|
||||
Cmd.ARG_SITEACL: deprecatedDomainSites,
|
||||
Cmd.ARG_SITEACTIVITY: deprecatedDomainSites,
|
||||
@@ -76220,6 +76438,7 @@ MAIN_COMMANDS_OBJ_ALIASES = {
|
||||
Cmd.ARG_TEAMDRIVES: Cmd.ARG_SHAREDDRIVE,
|
||||
Cmd.ARG_TEAMDRIVEACLS: Cmd.ARG_SHAREDDRIVEACLS,
|
||||
Cmd.ARG_TEAMDRIVEINFO: Cmd.ARG_SHAREDDRIVEINFO,
|
||||
Cmd.ARG_TEAMDRIVEORGANIZERS: Cmd.ARG_SHAREDDRIVEORGANIZERS,
|
||||
Cmd.ARG_TEAMDRIVETHEMES: Cmd.ARG_SHAREDDRIVETHEMES,
|
||||
Cmd.ARG_TOKENS: Cmd.ARG_TOKEN,
|
||||
Cmd.ARG_TRANSFER: Cmd.ARG_DATATRANSFER,
|
||||
@@ -76912,6 +77131,7 @@ USER_COMMANDS_WITH_OBJECTS = {
|
||||
Cmd.ARG_SENDAS: printShowSendAs,
|
||||
Cmd.ARG_SHAREDDRIVE: printShowSharedDrives,
|
||||
Cmd.ARG_SHAREDDRIVEACLS: printShowSharedDriveACLs,
|
||||
Cmd.ARG_SHAREDDRIVEORGANIZERS: printSharedDriveOrganizers,
|
||||
Cmd.ARG_SHEET: infoPrintShowSheets,
|
||||
Cmd.ARG_SHEETRANGE: printShowSheetRanges,
|
||||
Cmd.ARG_SIGNATURE: printShowSignature,
|
||||
@@ -77269,6 +77489,7 @@ USER_COMMANDS_OBJ_ALIASES = {
|
||||
Cmd.ARG_TEAMDRIVES: Cmd.ARG_SHAREDDRIVE,
|
||||
Cmd.ARG_TEAMDRIVEACLS: Cmd.ARG_SHAREDDRIVEACLS,
|
||||
Cmd.ARG_TEAMDRIVEINFO: Cmd.ARG_SHAREDDRIVEINFO,
|
||||
Cmd.ARG_TEAMDRIVEORGANIZERS: Cmd.ARG_SHAREDDRIVEORGANIZERS,
|
||||
Cmd.ARG_TEAMDRIVETHEMES: Cmd.ARG_SHAREDDRIVETHEMES,
|
||||
Cmd.ARG_THREADS: Cmd.ARG_THREAD,
|
||||
Cmd.ARG_TOKENS: Cmd.ARG_TOKEN,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (C) 2024 Ross Scroggs All Rights Reserved.
|
||||
# Copyright (C) 2025 Ross Scroggs All Rights Reserved.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
@@ -755,6 +755,7 @@ class GamCLArgs():
|
||||
ARG_SHAREDDRIVES = 'shareddrives'
|
||||
ARG_SHAREDDRIVEACLS = 'shareddriveacls'
|
||||
ARG_SHAREDDRIVEINFO = 'shareddriveinfo'
|
||||
ARG_SHAREDDRIVEORGANIZERS = 'shareddriveorganizers'
|
||||
ARG_SHAREDDRIVETHEMES = 'shareddrivethemes'
|
||||
ARG_SHEET = 'sheet'
|
||||
ARG_SHEETS = 'sheets'
|
||||
@@ -784,6 +785,7 @@ class GamCLArgs():
|
||||
ARG_TEAMDRIVES = 'teamdrives'
|
||||
ARG_TEAMDRIVEACLS = 'teamdriveacls'
|
||||
ARG_TEAMDRIVEINFO = 'teamdriveinfo'
|
||||
ARG_TEAMDRIVEORGANIZERS = 'teamdriveorganizers'
|
||||
ARG_TEAMDRIVETHEMES = 'teamdrivethemes'
|
||||
ARG_THREAD = 'thread'
|
||||
ARG_THREADS = 'threads'
|
||||
@@ -964,6 +966,7 @@ class GamCLArgs():
|
||||
OB_MOBILE_ENTITY = 'MobileEntity'
|
||||
OB_NETWORK_ID = 'networkID'
|
||||
OB_NAME = 'Name'
|
||||
OB_ORGANIZER_TYPE_LIST = 'OrganizerTypeList'
|
||||
OB_ORGUNIT_ENTITY = 'OrgUnitEntity'
|
||||
OB_ORGUNIT_ITEM = 'OrgUnitItem'
|
||||
OB_ORGUNIT_PATH = 'OrgUnitPath'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (C) 2024 Ross Scroggs All Rights Reserved.
|
||||
# Copyright (C) 2025 Ross Scroggs All Rights Reserved.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
@@ -504,13 +504,15 @@ TO = 'To'
|
||||
TO_LC = 'to'
|
||||
TO_MAXIMUM_OF = 'to maximum of'
|
||||
TO_SET_UP_GOOGLE_CHAT = """
|
||||
To set up Google Chat for your API project, please go to:
|
||||
To set up Google Chat for your current project, please go to:
|
||||
|
||||
{0}
|
||||
|
||||
and follow the instructions at:
|
||||
|
||||
https://github.com/GAM-team/GAM/wiki/Chat-Bot#set-up-a-chat-bot
|
||||
|
||||
You'll use projects/{1}/topics/no-topic in Connection settings Cloud Pub/Sub Topic Name
|
||||
"""
|
||||
TOTAL_ITEMS_IN_ENTITY = 'Total {0} in {1}'
|
||||
TRIMMED_MESSAGE_FROM_LENGTH_TO_MAXIMUM = 'Trimmed message of length {0} to maximum length {1}'
|
||||
|
||||
@@ -10,6 +10,5 @@ httplib2>=0.22.0
|
||||
lxml>=5.4.0
|
||||
passlib>=1.7.4
|
||||
pathvalidate>=3.2.3
|
||||
pyscard==2.2.1
|
||||
python-dateutil
|
||||
yubikey-manager>=5.6.1
|
||||
|
||||
@@ -37,7 +37,6 @@ install_requires =
|
||||
lxml >= 5.4.0
|
||||
passlib >= 1.7.4
|
||||
pathvalidate >= 3.2.3
|
||||
pyscard == 2.2.1
|
||||
python-dateutil
|
||||
yubikey-manager >= 5.6.1
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Chat Bot
|
||||
|
||||
- [Introduction](#introduction)
|
||||
- [Set up a Chat Bot](#set-up-a-chat-bot)
|
||||
- [API documentation](#api-documentation)
|
||||
- [Definitions](#definitions)
|
||||
- [Set up a Chat Bot](#set-up-a-chat-bot)
|
||||
- [Display Rooms and Chats to which your Bot belongs](#display-rooms-and-chats-to-which-your-bot-belongs)
|
||||
- [Display Members of a Room or Chat](#display-members-of-a-room-or-chat)
|
||||
- [Create a Chat Message](#create-a-chat-message)
|
||||
@@ -10,6 +10,43 @@
|
||||
- [Delete a Chat Message](#delete-a-chat-message)
|
||||
- [Display a Chat Message](#display-a-chat-message)
|
||||
|
||||
## Introduction
|
||||
To use these commands you must update your service account authorization.
|
||||
```
|
||||
gam user user@domain.com update serviceaccount
|
||||
|
||||
[*] 4) Chat API - Memberships (supports readonly)
|
||||
[*] 5) Chat API - Memberships Admin (supports readonly)
|
||||
[*] 6) Chat API - Messages (supports readonly)
|
||||
[*] 7) Chat API - Spaces (supports readonly)
|
||||
[*] 8) Chat API - Spaces Admin (supports readonly)
|
||||
[*] 9) Chat API - Spaces Delete
|
||||
[*] 10) Chat API - Spaces Delete Admin
|
||||
```
|
||||
|
||||
Added `use_chat_admin_access` Boolean variable to `gam.cfg`.
|
||||
```
|
||||
* When False, GAM uses user access when making all Chat API calls. For calls that support admin access,
|
||||
this can be overridden with the asadmin command line option.
|
||||
* When True, GAM uses admin access for Chat API calls that support admin access; other calls will use user access.
|
||||
* Default: False
|
||||
```
|
||||
|
||||
Google requires that you have a Chat Bot configured in order to use the Chat API; set up a Chat Bot as described in the next section.
|
||||
|
||||
## Set up a Chat Bot
|
||||
GAM is capable of acting as a Chat Bot and sending messages to Chat Rooms or direct messages to users.
|
||||
|
||||
Even if you're not going to use GAM as a Chat Bot, you have to configure a Chat Bot as it is required by the Chat API in [Users - Chat](Users-Chat).
|
||||
|
||||
* Run the command `gam setup chat`; it will point you to a URL to configure your Chat Bot.
|
||||
* Enter an App name and Description of your choosing.
|
||||
* For the Avatar URL you can use `https://dummyimage.com/384x256/4d4d4d/0011ff.png&text=+GAM` or a public URL to an image of your own choosing.
|
||||
* In Functionality, uncheck both "Receive 1:1 messages" and "Join spaces and group conversations"
|
||||
* In Connection settings, choose "Cloud Pub/Sub" and enter `projects/<ProjectID>/topics/no-topic` for the Topic Name. Replace `<ProjectID>` with your GAM project ID. GAM doesn't yet listen to pub/sub so this option is not used.
|
||||
* In Visibility, uncheck "Make this Chat app available to specific people and groups in Domain Workspace".
|
||||
* Click Save.
|
||||
|
||||
## API documentation
|
||||
* https://developers.google.com/chat/concepts
|
||||
* https://developers.google.com/chat/reference/rest
|
||||
@@ -102,19 +139,6 @@
|
||||
<ChatMessageFieldNameList> ::= "<ChatMessageFieldName>(,<ChatMessageFieldName>)*"
|
||||
```
|
||||
|
||||
## Set up a Chat Bot
|
||||
Since GAM 6.04.00, GAM is capable of acting as a Chat Bot and sending messages to Chat Rooms or direct messages to users. You first need to configure your Chat Bot.
|
||||
|
||||
* Run the command `gam setup chat`; it will point you to a URL to configure your Chat Bot.
|
||||
* Enter an App name and Description of your choosing.
|
||||
* For the Avatar URL you can use `https://dummyimage.com/384x256/4d4d4d/0011ff.png&text=+GAM` or a public URL to an image of your own choosing.
|
||||
* In Functionality, uncheck both "Receive 1:1 messages" and "Join spaces and group conversations"
|
||||
* In Connection settings, choose "Cloud Pub/Sub" and enter `projects/<ProjectID>/topics/no-topic` for the topic name. Replace `<ProjectID>` with your GAM project ID. GAM doesn't yet listen to pub/sub so this option is not used.
|
||||
* In Visibility, uncheck "Make this Chat app available to specific people and groups in Domain Workspace".
|
||||
* Click Save.
|
||||
|
||||
----
|
||||
|
||||
## Display Rooms and Chats to which your Bot belongs
|
||||
Display the spaces to which your Chat Bot can send messages.
|
||||
A space can be a direct message to a user, a chat group or a chat room.
|
||||
|
||||
@@ -106,12 +106,14 @@ The second form is backwards compatible with Legacy GAM and selection with `<CrO
|
||||
autoupdatethrough|
|
||||
backlightinfo|
|
||||
bootmode|
|
||||
chromeostype|
|
||||
cpuinfo|
|
||||
cpustatusreports|
|
||||
deprovisionreason|
|
||||
devicefiles|
|
||||
deviceid|
|
||||
devicelicensetype|
|
||||
diskspaceusage|
|
||||
diskvolumereports|
|
||||
dockmacaddress|
|
||||
ethernetmacaddress|
|
||||
@@ -119,6 +121,7 @@ The second form is backwards compatible with Legacy GAM and selection with `<CrO
|
||||
extendedsupporteligible|
|
||||
extendedsupportstart|
|
||||
extendedsupportenabled|
|
||||
faninfo|
|
||||
firmwareversion|
|
||||
firstenrollmenttime|
|
||||
lastdeprovisiontimestamp|
|
||||
|
||||
@@ -210,7 +210,7 @@ gam print devices [todrive <ToDriveAttribute>*]
|
||||
<DeviceFieldName>* [fields <DeviceFieldNameList>] [userfields <DeviceUserFieldNameList>]
|
||||
[orderby <DeviceOrderByFieldName> [ascending|descending]]
|
||||
[all|company|personal|nocompanydevices|nopersonaldevices]
|
||||
[nodeviceusers]
|
||||
[nodeviceusers|oneuserperrow]
|
||||
[formatjson [quotechar <Character>]]
|
||||
```
|
||||
By default, all devices are displayed; use the query options to limit the display.
|
||||
@@ -231,6 +231,9 @@ Select the view of devices to display:
|
||||
By default, Gam makes additional API calls to display the device users for the devices;
|
||||
use `nodeviceuser` to suppress making the additional calls.
|
||||
|
||||
By default, when device users are displayed, they are all displayed on one row;
|
||||
use `oneuserperrow` to have each of a device's users displayed on a separate row with all of the other device fields.
|
||||
|
||||
By default, Gam displays the information as columns of fields; the following option causes the output to be in JSON format,
|
||||
* `formatjson` - Display the fields in JSON format.
|
||||
|
||||
|
||||
@@ -10,6 +10,43 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
|
||||
|
||||
See [Downloads-Installs-GAM7](https://github.com/GAM-team/GAM/wiki/Downloads-Installs) for Windows or other options, including manual installation
|
||||
|
||||
### 7.07.17
|
||||
|
||||
Added option `oneuserperrow` to `gam print devices` to have each of a
|
||||
device's users displayed on a separate row with all of the other device fields.
|
||||
|
||||
### 7.07.16
|
||||
|
||||
Added `chromeostype`, `diskspaceusage` and `faninfo` to `<CrOSFieldName>` for use in `gam info|print cros`.
|
||||
|
||||
Fixed bugs/cleaned output in `gam info|print cros`.
|
||||
|
||||
### 7.07.15
|
||||
|
||||
Added option `shareddrivesoption included|included_if_account_is_not_a_member|not_included` to `gam create vaultexport`.
|
||||
|
||||
The previous option `includeshareddrives <Boolean>` is mapped as follows:
|
||||
* `includeshareddrives false` - `shareddrivesoption included_if_account_is_not_a_member`
|
||||
* `includeshareddrives true` - `shareddrivesoption included`
|
||||
|
||||
### 7.07.14
|
||||
|
||||
Update `gam setup chat` output to include the following that shows the actual Cloud Pub/Sub Topic Name.
|
||||
```
|
||||
You'll use projects/<ProjectID>/topics/no-topic in Connection settings Cloud Pub/Sub Topic Name
|
||||
```
|
||||
|
||||
### 7.07.13
|
||||
|
||||
Added option `showitemcountonly` to `gam [<UserTypeEntity>] print|show shareddrives` that causes GAM to display the
|
||||
number of Shared Drives on stdout; no CSV file is written.
|
||||
|
||||
### 7.07.12
|
||||
|
||||
Fixed bug in `gam print|show oushareddrives` that caused a trap.
|
||||
|
||||
Improved getting Shared Drive names from IDs when accessing Shared Drives in external workspaces.
|
||||
|
||||
### 7.07.11
|
||||
|
||||
Updated `gam calendars <CalendarEntity> update events` and `gam <UserTypeEntity> update events <UserCalendarEntity>`
|
||||
|
||||
@@ -251,7 +251,7 @@ writes the credentials into the file oauth2.txt.
|
||||
admin@server:/Users/admin$ rm -f /Users/admin/GAMConfig/oauth2.txt
|
||||
admin@server:/Users/admin$ gam version
|
||||
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
|
||||
GAM 7.07.11 - https://github.com/GAM-team/GAM - pyinstaller
|
||||
GAM 7.07.17 - https://github.com/GAM-team/GAM - pyinstaller
|
||||
GAM Team <google-apps-manager@googlegroups.com>
|
||||
Python 3.13.3 64-bit final
|
||||
MacOS Sequoia 15.5 x86_64
|
||||
@@ -989,7 +989,7 @@ writes the credentials into the file oauth2.txt.
|
||||
C:\>del C:\GAMConfig\oauth2.txt
|
||||
C:\>gam version
|
||||
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
|
||||
GAM 7.07.11 - https://github.com/GAM-team/GAM - pythonsource
|
||||
GAM 7.07.17 - https://github.com/GAM-team/GAM - pythonsource
|
||||
GAM Team <google-apps-manager@googlegroups.com>
|
||||
Python 3.13.3 64-bit final
|
||||
Windows-10-10.0.17134 AMD64
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
- [Delete a Shared Drive](#delete-a-shared-drive)
|
||||
- [Change Shared Drive visibility](#change-shared-drive-visibility)
|
||||
- [Display Shared Drives](#display-shared-drives)
|
||||
- [Display List of Shared Drives in an Organizational Unit other than /](#display-list-of-shared-drives-in-an-organizational-unit-other-than-)
|
||||
- [Display Shared Drive Counts](#display-shared-drive-counts)
|
||||
- [Display List of Shared Drives in an Organizational Unit](#display-list-of-shared-drives-in-an-organizational-unit)
|
||||
- [Display Count of Shared Drives in an Organizational Unit](#display-count-of-shared-drives-in-an-organizational-unit)
|
||||
- [Display all Shared Drives with no members](#display-all-shared-drives-with-no-members)
|
||||
- [Display all Shared Drives with no organizers](#display-all-shared-drives-with-no-organizers)
|
||||
- [Display all Shared Drives with a specific organizer](#display-all-shared-drives-with-a-specific-organizer)
|
||||
@@ -29,6 +30,7 @@
|
||||
- [Display ACLs for Shared Drives with all organizers outside of your domain](#display-acls-for-shared-drives-with-all-organizers-outside-of-your-domain)
|
||||
- [Display ACLs for Shared Drives with all ACLs outside of your domain](#display-acls-for-shared-drives-with-all-acls-outside-of-your-domain)
|
||||
- [Clean up scammed Shared Drives](#clean-up-scammed-shared-drives)
|
||||
- [Delete old empty Shared Drives](#delete-old-empty-shared-drives)
|
||||
|
||||
## API documentation
|
||||
* [Drive API - Drives](https://developers.google.com/drive/api/reference/rest/v3/drives)
|
||||
@@ -416,6 +418,36 @@ gam print teamdrives query "memberCount = 0"
|
||||
gam print teamdrives query "organizerCount = 0"
|
||||
```
|
||||
|
||||
## Display Shared Drive Counts
|
||||
Display the number of Shared Drives.
|
||||
```
|
||||
gam [<UserTypeEntity>] show|print shareddrives
|
||||
[adminaccess|asadmin] [teamdriveadminquery|query <QueryTeamDrive>]
|
||||
[matchname <REMatchPattern>] [orgunit|org|ou <OrgUnitPath>]
|
||||
showitemcountonly
|
||||
```
|
||||
By default, all Shared Drives are counted; use the following options to select a subset of Shared Drives:
|
||||
* `teamdriveadminquery|query <QueryTeamDrive>` - Use a query to select Shared Drives
|
||||
* `matchname <REMatchPattern>` - Retrieve Shared Drives with names that match a pattern.
|
||||
* `orgunit|org|ou <OrgUnitPath>` - Only Shared Drives in the specified Org Unit are selected
|
||||
|
||||
Example
|
||||
```
|
||||
$ gam print shareddrives showitemcountonly
|
||||
Getting all Shared Drives, may take some time on a large Google Workspace Account...
|
||||
Got 12 Shared Drives...
|
||||
12
|
||||
```
|
||||
The `Getting` and `Got` messages are written to stderr, the count is writtem to stdout.
|
||||
|
||||
To retrieve the count with `showitemcountonly`:
|
||||
```
|
||||
Linux/MacOS
|
||||
count=$(gam print shareddrives showitemcountonly)
|
||||
Windows PowerShell
|
||||
count = & gam print shareddrives showitemcountonly
|
||||
```
|
||||
|
||||
## Display all Shared Drives with a specific organizer
|
||||
Substitute actual email address for `organizer@domain.com`.
|
||||
```
|
||||
@@ -428,18 +460,9 @@ Substitute actual email address for `organizer@domain.com`.
|
||||
gam config csv_output_header_filter "id,name" print teamdriveacls pm emailaddress organizer@domain.com role organizer em pma skip pmselect
|
||||
```
|
||||
|
||||
## Display List of Shared Drives in an Organizational Unit other than /
|
||||
Get the orgUnitID of OU / and use it (without the id:) in the print|show command. Adjust fields as desired.
|
||||
```
|
||||
gam info ou / nousers
|
||||
gam show teamdrives query "orgUnitId!='00gjdgxs2p9cxyz'" fields id,name,orgunit,createdtime
|
||||
gam print teamdrives query "orgUnitId!='00gjdgxs2p9cxyz'" fields id,name,orgunit,createdtime
|
||||
```
|
||||
|
||||
## Display List of Shared Drives in an Organizational Unit
|
||||
Get the orgUnitID of the desired OU and use it (without the id:) in the print|show command. Adjust fields as desired.
|
||||
```
|
||||
gam info ou <OrgUnitPath> nousers
|
||||
gam show teamdrives query "orgUnitId='03ph8a2z21rexy'" fields id,name,orgunit,createdtime
|
||||
gam print teamdrives query "orgUnitId='03ph8a2z21rexy'" fields id,name,orgunit,createdtime
|
||||
```
|
||||
@@ -453,6 +476,31 @@ gam print oushareddrives [todrive <ToDriveAttribute>*]
|
||||
[formatjson [quotechar <Character>]]
|
||||
```
|
||||
|
||||
## Display Count of Shared Drives in an Organizational Unit
|
||||
```
|
||||
gam print|show oushareddrives
|
||||
[ou|org|orgunit <OrgUnitPath>]
|
||||
showitemcountonly
|
||||
```
|
||||
`<OrgUnitPath>` defaults to `"/"`.
|
||||
|
||||
Example
|
||||
```
|
||||
$ gam print oushareddrives showitemcountonly
|
||||
Getting all Shared Drives for /, may take some time on a large Organizational Unit...
|
||||
Got 9 Shared Drives for /...
|
||||
9
|
||||
```
|
||||
The `Getting` and `Got` messages are written to stderr, the count is writtem to stdout.
|
||||
|
||||
To retrieve the count with `showitemcountonly`:
|
||||
```
|
||||
Linux/MacOS
|
||||
count=$(gam print oushareddrives showitemcountonly)
|
||||
Windows PowerShell
|
||||
count = & gam print oushareddrives showitemcountonly
|
||||
```
|
||||
|
||||
## Manage Shared Drive access
|
||||
These commands are used to manage the ACLs on Shared Drives themselves, not the files/folders on the Shared Drives.
|
||||
|
||||
@@ -744,3 +792,37 @@ This is not reversible, proceed with caution.
|
||||
```
|
||||
gam redirect stdout ./DeleteSharedDrives.txt multiprocess redirect stderr stdout csv ./SharedDriveACLsAllExternal.csv gam delete teamdrive "~id" allowitemdeletion
|
||||
```
|
||||
|
||||
## Delete old empty Shared Drives
|
||||
```
|
||||
# Get a list of Shared Drives created before one year ago; alter date<-1y as required
|
||||
gam config csv_output_row_filter "createdTime:date<-1y" redirect csv ./TeamDrives.csv print teamdrives fields id,name,createdtime
|
||||
|
||||
# You'll need a list of Shared Drive IDs and organizers; get ACLs for Shared Drives from above
|
||||
gam redirect csv ./TeamDriveACLs.csv multiprocess csv ./TeamDrives.csv gam print drivefileacls "~id" fields id,emailaddress,role,type,deleted
|
||||
|
||||
# Customize script: https://github.com/taers232c/GAM-Scripts3/blob/master/GetTeamDriveOrganizers.py
|
||||
DOMAIN_LIST = ['yourdomain.org']
|
||||
|
||||
INCLUDE_TYPES = {
|
||||
'user': True,
|
||||
'group': False,
|
||||
}
|
||||
|
||||
ONE_ORGANIZER = True
|
||||
SHOW_NO_ORGANIZER_DRIVES = True
|
||||
INCLUDE_FILE_ORGANIZERS = False
|
||||
|
||||
# Run script
|
||||
python GetTeamDriveOrganizers.py TeamDriveACLs.csv TeamDrives.csv TeamDriveOrganizers.csv
|
||||
|
||||
# Inspect TeamDriveOrganizers.csv, you'll have to deal with Shared Drives with no organizer/manager
|
||||
|
||||
# Get old empty Shared Drives
|
||||
gam config num_threads 10 csv_input_row_filter "organizers:regex:^.+$" csv_output_row_filter "Total:count=0" redirect csv ./OldEmptySharedDrives.csv multiprocess redirect stderr - multiprocess csv ./TeamDriveOrganizers.csv gam user "~organizers" print filecounts select teamdriveid "~id" showsize
|
||||
|
||||
# Inspect OldEmptySharedDrives.csv, if you're confident of the results, proceed
|
||||
|
||||
# Delete old empty Shared Drives
|
||||
gam redirect stdout ./DeleteOldEmptySharedDrives.txt multiprocess redirect stderr stdout csv ./OldEmptySharedDrives.csv gam user "~User" delete shareddrive "~id"
|
||||
```
|
||||
@@ -15,8 +15,6 @@
|
||||
- [Bulk Operations](#bulk-operations)
|
||||
|
||||
## Introduction
|
||||
These features were added in version 6.60.00.
|
||||
|
||||
To use these commands you must update your service account authorization.
|
||||
```
|
||||
gam user user@domain.com update serviceaccount
|
||||
@@ -46,8 +44,8 @@ Google requires that you have a Chat Bot configured in order to use the Chat API
|
||||
* Enter an App name and Description of your choosing.
|
||||
* For the Avatar URL you can use `https://dummyimage.com/384x256/4d4d4d/0011ff.png&text=+GAM` or a public URL to an image of your own choosing.
|
||||
* In Functionality, uncheck both "Receive 1:1 messages" and "Join spaces and group conversations"
|
||||
* In Connection settings, choose "Cloud Pub/Sub" and enter `projects/<ProjectID>/topics/no-topic` for the topic name. Replace `<ProjectID>` with your GAM project ID. GAM doesn't yet listen to pub/sub so this option is not used.
|
||||
* In Visibility, uncheck "Make this Chat app available to specific people and groups in Domain Workspace".
|
||||
* In Connection settings, choose "Cloud Pub/Sub" and enter `projects/<ProjectID>/topics/no-topic` for the Topic Name. Replace `<ProjectID>` with your GAM project ID. GAM doesn't yet listen to pub/sub so this option is not used.
|
||||
* In Visibility, uncheck "Make this Chat app available to specific people and groups in Domain Workspace".
|
||||
* Click Save.
|
||||
|
||||
## API documentation
|
||||
|
||||
@@ -662,7 +662,7 @@ When moving a folder you can use the `retainsourcefolders` option to cause GAM t
|
||||
Moving a Drive folder to a Shared Drive is not directly supported by the API; GAM has to make a copy of the folder on the Shared Drive and
|
||||
recursively adjust the files/folders within it to point to the new parent folder. Once the original folder is emptied, it is deleted unless `retainsourcefolders` is specified.
|
||||
|
||||
### Move content of a Shared Drive to another Shared Drive
|
||||
## Move content of a Shared Drive to another Shared Drive
|
||||
Suppose you have a source Shared Drive with ID 0AC_1AB with multiple files and folders, and want to move all of its content to the target Shared Drive with ID 0AE_9ZX.
|
||||
|
||||
The following command will change the parents of the top level files and folders from 0AC_1AB to 0AE_9ZX; the sub files and folders will move along with their top level folder.
|
||||
@@ -676,3 +676,19 @@ If you want the source Shared Drive with ID 0AC_1AB to be contained in a top lev
|
||||
```
|
||||
gam user user@domain.com move drivefile teamdriveid 0AC_1AB teamdriveparentid 0AE_9ZX
|
||||
```
|
||||
|
||||
### Inter-workspace moves
|
||||
Due to a restructuring, you want to move data from Shared Drive A in domaina.com to Shared Drive B in domainb.com.
|
||||
* Shared Drive A in domaina.com has the following unchecked: `Allow people outside of Domain A to access files`
|
||||
* Shared Drive B in domainb.com has the following checked: `Allow people outside of Domain B to access files`
|
||||
* `user@domaina.com` is a manager of both Shared Drives.
|
||||
|
||||
```
|
||||
$ gam user user@domaina move drivefile teamdriveid <SharedDriveAID> teamdriveparentid <SharedDriveBID> mergewithparent
|
||||
User: user@domaina.com, Move 1 Drive File/Folder
|
||||
User: user@domaina.com, Drive Folder: Shared Drive A(<SharedDriveAID>), Move(Merge) contents with Drive Folder: Shared Drive B(<SharedDriveBID>)
|
||||
User: user@domaina.com, Drive File: Filename(<FileID>), Move Failed: Bad Request. User message: "shareOutNotPermitted"
|
||||
...
|
||||
User: user@domaina.com, Drive Folder: Shared Drive A(<SharedDriveAID>), Retained
|
||||
```
|
||||
To get this to work, you must check `Allow people outside of Domain A to access files` on Shared Drive A in domaina.com
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
- [Manage file permissions/sharing](#manage-file-permissionssharing)
|
||||
- [Display file permissions/sharing](#display-file-permissionssharing)
|
||||
- [Delete all ACLs except owner from a file](#delete-all-acls-except-owner-from-a-file)
|
||||
- [Delete all ACLs except owner from a user's My Drive](#delete-all-acls-except-owner-from-a-users-my-drive)
|
||||
- [Change shares to User1 to shares to User2](#change-shares-to-user1-to-shares-to-user2)
|
||||
- [Map All ACLs from an old domain to a new domain](#map-all-acls-from-an-old-domain-to-a-new-domain)
|
||||
|
||||
@@ -318,13 +319,23 @@ gam redirect csv ./TeamDriveACLs.csv multiprocess csv ./TeamDrives.csv gam print
|
||||
## Delete all ACLs except owner from a file
|
||||
Get the current ACLs.
|
||||
```
|
||||
gam redirect csv ./Permissions.csv user <UserItem> print drivefileacls <DriveFileID> oneitemperrow
|
||||
gam redirect csv ./Permissions.csv user user@domain.com print drivefileacls <DriveFileID> oneitemperrow
|
||||
```
|
||||
Inspect Permissions.csv, verify that you want to proceed.
|
||||
```
|
||||
gam config csv_input_row_drop_filter "permission.role:regex:(owner)|(organizer)" csv ./Permissions.csv gam user "~Owner" delete drivefileacl "~id" "id:~~permission.id~~"
|
||||
```
|
||||
|
||||
## Delete all ACLs except owner from a user's My Drive
|
||||
Get the current ACLs.
|
||||
```
|
||||
gam redirect csv ./Permissions.csv user user@domain.com print filelist fields id,name,mimetype,basicpermissions pm not role owner em pmfilter oneitemperrow
|
||||
```
|
||||
Inspect Permissions.csv, verify that you want to proceed.
|
||||
```
|
||||
gam redirect stdout ./DeletePermissions.txt multiprocess redirect stderr stdout csv Permissions.csv.csv gam user "~Owner" delete drivefileacls "~id" "id:~~permission.id~~"
|
||||
```
|
||||
|
||||
## Change shares to User1 to shares to User2
|
||||
```
|
||||
# Get files shared to User1
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# Users - Gmail - Delegates
|
||||
- [Notes](#notes)
|
||||
- [API documentation](#api-documentation)
|
||||
- [Definitions](#definitions)
|
||||
- [Aliases](#aliases)
|
||||
@@ -8,6 +9,11 @@
|
||||
- [Display Gmail delegates](#display-gmail-delegates)
|
||||
- [Delete all delegates for a user](#delete-all-delegates-for-a-user)
|
||||
|
||||
## Notes
|
||||
|
||||
To use Gmail delegation, the delegator and delagatee must be in org units where
|
||||
mail delegation is enabled. In the admin console, go to Apps/Google Workspace/Gmail/User Settings.
|
||||
|
||||
## API documentation
|
||||
* [Gmail API - Delegates](https://developers.google.com/gmail/api/v1/reference/users.settings.delegates)
|
||||
* [Delegation Notes](https://support.google.com/a/answer/7223765)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
- [Delete a Shared Drive](#delete-a-shared-drive)
|
||||
- [Change Shared Drive visibility](#change-shared-drive-visibility)
|
||||
- [Display Shared Drives](#display-shared-drives)
|
||||
- [Display Shared Drive Counts](#display-shared-drive-counts)
|
||||
- [Manage Shared Drive access](#manage-shared-drive-access)
|
||||
- [Display Shared Drive access](#display-shared-drive-access)
|
||||
- [Display Shared Drive access for specific Shared Drives](#display-shared-drive-access-for-specific-shared-drives)
|
||||
@@ -356,6 +357,35 @@ When using the `formatjson` option, double quotes are used extensively in the da
|
||||
The `quotechar <Character>` option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output.
|
||||
`quotechar` defaults to `gam.cfg/csv_output_quote_char`. When uploading CSV files to Google, double quote `"` should be used.
|
||||
|
||||
## Display Shared Drive Counts
|
||||
Display the number of Shared Drives.
|
||||
```
|
||||
gam <UserTypeEntity> show|print shareddrives
|
||||
[teamdriveadminquery|query <QueryTeamDrive>]
|
||||
[matchname <REMatchPattern>] [orgunit|org|ou <OrgUnitPath>]
|
||||
showitemcountonly
|
||||
```
|
||||
By default, all Shared Drives are counted; use the following options to select a subset of Shared Drives:
|
||||
* `teamdriveadminquery|query <QueryTeamDrive>` - Use a query to select Shared Drives
|
||||
* `matchname <REMatchPattern>` - Retrieve Shared Drives with names that match a pattern.
|
||||
* `orgunit|org|ou <OrgUnitPath>` - Only Shared Drives in the specified Org Unit are selected
|
||||
|
||||
Example
|
||||
```
|
||||
$ gam user user@domain.com print shareddrives showitemcountonly
|
||||
Getting all Shared Drives for user@domain.com
|
||||
Got 4 Shared Drives for user@domain.com ...
|
||||
4
|
||||
```
|
||||
The `Getting` and `Got` messages are written to stderr, the count is writtem to stdout.
|
||||
|
||||
To retrieve the count with `showitemcountonly`:
|
||||
```
|
||||
Linux/MacOS
|
||||
count=$(gam user user@domain.com print shareddrives showitemcountonly)
|
||||
Windows PowerShell
|
||||
count = & gam user user@domain.com print shareddrives showitemcountonly
|
||||
```
|
||||
## Manage Shared Drive access
|
||||
These commands must be issued by a user with Shared Drive permission role organizer.
|
||||
### Process single ACLs.
|
||||
|
||||
@@ -243,7 +243,8 @@ gam create vaultexport|export matter <MatterItem> [name <String>] corpus calenda
|
||||
[terms <String>] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>] [timezone <TimeZone>]
|
||||
[locationquery <StringList>] [peoplequery <StringList>] [minuswords <StringList>]
|
||||
[responsestatuses <AttendeeStatus>(,<AttendeeStatus>)*] [calendarversiondate <Date>|<Time>]
|
||||
[includeshareddrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>]
|
||||
[(includeshareddrives <Boolean>)|(shareddrivesoption included|included_if_account_is_not_a_member|not_included)]
|
||||
[driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>]
|
||||
[driveclientsideencryption any|encrypted|unencrypted]
|
||||
[includerooms <Boolean>]
|
||||
[excludedrafts <Boolean>] [mailclientsideencryption any|encrypted|unencrypted]
|
||||
@@ -315,8 +316,11 @@ For `corpus calendar`, you can specify the format of the exported data:
|
||||
|
||||
For `corpus drive`, you can specify advanced search options:
|
||||
* `driveversiondate <Date>|<Time>` - Search the versions of the Drive file as of the reference date. These timestamps are in GMT and rounded down to the given date.
|
||||
* `includeshareddrives False` - Do not include Shared Drives in the search, this is the default.
|
||||
* `includeshareddrives True` - Include Shared Drives in the search.
|
||||
* `includeshareddrives False` - Mapped to `sharedrivesoption included_if_account_is_not_a_member`
|
||||
* `includeshareddrives True` - Mapped to `sharedrivesoption included`
|
||||
* `sharedrivesoption included` - Resources in shared drives are included in the search
|
||||
* `sharedrivesoption included_if_account_is_not_a_member` - Resources in shared drives where account is not a member are included in the search, this is the default
|
||||
* `sharedrivesoption not_included` - Resources in shared drives are not included in the search
|
||||
* `driveclientsideencryption any` - Include both client-side encrypted and unencrypted content in search, this is the default.
|
||||
* `driveclientsideencryption encrypted` - Include client-side encrypted content only in search.
|
||||
* `driveclientsideencryption unencrypted` - Include client-side unencrypted content only in search.
|
||||
@@ -599,7 +603,7 @@ gam create vaulthold|hold matter <MatterItem> [name <String>] corpus calendar|dr
|
||||
[terms <String>] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
||||
[includerooms <Boolean>]
|
||||
[covereddata calllogs|textmessages|voicemails]
|
||||
[includeshareddrives|includeteamdrives <Boolean>]
|
||||
[includeshareddrives <Boolean>]
|
||||
[showdetails|returnidonly]
|
||||
```
|
||||
Specify the name of the hold:
|
||||
@@ -621,8 +625,8 @@ Specify the search method, this option is required:
|
||||
The `query <QueryVaultCorpus>` option can still be used but it is much simpler to use the following options.
|
||||
|
||||
For `corpus drive`, you can specify advanced search options:
|
||||
* `includeshareddrives False` - Do not include Shared Drives in the search, this is the default.
|
||||
* `includeshareddrives True` - Include Shared Drives in the search.
|
||||
* `includeshareddrives False` - Files in shared drives are not included in the hold, this is the default
|
||||
* `includeshareddrives True` - Files in shared drives are included in the hold
|
||||
|
||||
For `corpus mail`, you can specify search terms to limit the search.
|
||||
* `terms <String>` - [Vault search](https://support.google.com/vault/answer/2474474)
|
||||
@@ -652,12 +656,12 @@ gam update vaulthold|hold <HoldItem> matter <MatterItem>
|
||||
[terms <String>] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
|
||||
[includerooms <Boolean>]
|
||||
[covereddata calllogs|textmessages|voicemails]
|
||||
[includeshareddrives|includeteamdrives <Boolean>]
|
||||
[includeshareddrives <Boolean>]
|
||||
[showdetails]
|
||||
```
|
||||
For a hold with `corpus drive`, you can specify advanced search options:
|
||||
* `includeshareddrives False` - Do not include Shared Drives in the search, this is the default.
|
||||
* `includeshareddrives True` - Include Shared Drives in the search.
|
||||
* `includeshareddrives False` - Files in shared drives are not included in the hold, this is the default
|
||||
* `includeshareddrives True` - Files in shared drives are included in the hold
|
||||
|
||||
For a hold with `corpus mail`, you can specify search terms to limit the search.
|
||||
* `terms <String>` - [Vault search](https://support.google.com/vault/answer/2474474)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Print the current version of Gam with details
|
||||
```
|
||||
gam version
|
||||
GAM 7.07.11 - https://github.com/GAM-team/GAM - pyinstaller
|
||||
GAM 7.07.17 - https://github.com/GAM-team/GAM - pyinstaller
|
||||
GAM Team <google-apps-manager@googlegroups.com>
|
||||
Python 3.13.3 64-bit final
|
||||
MacOS Sequoia 15.5 x86_64
|
||||
@@ -15,7 +15,7 @@ Time: 2023-06-02T21:10:00-07:00
|
||||
Print the current version of Gam with details and time offset information
|
||||
```
|
||||
gam version timeoffset
|
||||
GAM 7.07.11 - https://github.com/GAM-team/GAM - pyinstaller
|
||||
GAM 7.07.17 - https://github.com/GAM-team/GAM - pyinstaller
|
||||
GAM Team <google-apps-manager@googlegroups.com>
|
||||
Python 3.13.3 64-bit final
|
||||
MacOS Sequoia 15.5 x86_64
|
||||
@@ -27,7 +27,7 @@ Your system time differs from www.googleapis.com by less than 1 second
|
||||
Print the current version of Gam with extended details and SSL information
|
||||
```
|
||||
gam version extended
|
||||
GAM 7.07.11 - https://github.com/GAM-team/GAM - pyinstaller
|
||||
GAM 7.07.17 - https://github.com/GAM-team/GAM - pyinstaller
|
||||
GAM Team <google-apps-manager@googlegroups.com>
|
||||
Python 3.13.3 64-bit final
|
||||
MacOS Sequoia 15.5 x86_64
|
||||
@@ -64,7 +64,7 @@ MacOS High Sierra 10.13.6 x86_64
|
||||
Path: /Users/Admin/bin/gam7
|
||||
Version Check:
|
||||
Current: 5.35.08
|
||||
Latest: 7.07.11
|
||||
Latest: 7.07.17
|
||||
echo $?
|
||||
1
|
||||
```
|
||||
@@ -72,7 +72,7 @@ echo $?
|
||||
Print the current version number without details
|
||||
```
|
||||
gam version simple
|
||||
7.07.11
|
||||
7.07.17
|
||||
```
|
||||
In Linux/MacOS you can do:
|
||||
```
|
||||
@@ -82,7 +82,7 @@ echo $VER
|
||||
Print the current version of Gam and address of this Wiki
|
||||
```
|
||||
gam help
|
||||
GAM 7.07.11 - https://github.com/GAM-team/GAM
|
||||
GAM 7.07.17 - https://github.com/GAM-team/GAM
|
||||
GAM Team <google-apps-manager@googlegroups.com>
|
||||
Python 3.13.3 64-bit final
|
||||
MacOS Sequoia 15.5 x86_64
|
||||
|
||||
Reference in New Issue
Block a user