Show actual Shared Drive names for drives in other domains

This commit is contained in:
Ross Scroggs
2023-09-07 21:15:08 -07:00
parent c30931545f
commit c9023d4792
6 changed files with 36 additions and 32 deletions

View File

@@ -278,7 +278,7 @@ gam create|add course [id|alias <CourseAlias>] <CourseAttribute>*
[markdraftaspublished [<Boolean>]] [markdraftaspublished [<Boolean>]]
[markpublishedasdraft [<Boolean>]] [markpublishedasdraft [<Boolean>]]
[members none|all|students|teachers]] [members none|all|students|teachers]]
[logdrivefileids [<Boolean>>]] [logdrivefileids [<Boolean>]]
gam update course <CourseID> <CourseAttribute>+ gam update course <CourseID> <CourseAttribute>+
[copyfrom <CourseID> [copyfrom <CourseID>
@@ -292,7 +292,7 @@ gam update course <CourseID> <CourseAttribute>+
[markdraftaspublished [<Boolean>]] [markdraftaspublished [<Boolean>]]
[markpublishedasdraft [<Boolean>]] [markpublishedasdraft [<Boolean>]]
[members none|all|students|teachers]] [members none|all|students|teachers]]
[logdrivefileids [<Boolean>>]] [logdrivefileids [<Boolean>]]
gam update courses <CourseEntity> <CourseAttribute>+ gam update courses <CourseEntity> <CourseAttribute>+
[copyfrom <CourseID> [copyfrom <CourseID>
[announcementstates <CourseAnnouncementStateList>] [announcementstates <CourseAnnouncementStateList>]
@@ -305,7 +305,7 @@ gam update courses <CourseEntity> <CourseAttribute>+
[markdraftaspublished [<Boolean>]] [markdraftaspublished [<Boolean>]]
[markpublishedasdraft [<Boolean>]] [markpublishedasdraft [<Boolean>]]
[members none|all|students|teachers]] [members none|all|students|teachers]]
[logdrivefileids [<Boolean>>]] [logdrivefileids [<Boolean>]]
``` ```
`copyfrom <CourseID>` allows copying of course announcements, work, topics and members from one course to another. `copyfrom <CourseID>` allows copying of course announcements, work, topics and members from one course to another.
* Accouncements - By default, no course announcements are copied * Accouncements - By default, no course announcements are copied
@@ -335,7 +335,7 @@ gam update courses <CourseEntity> <CourseAttribute>+
* `members students` - Copy students * `members students` - Copy students
* `members teachers` - Copy teachers * `members teachers` - Copy teachers
When true, `logdrivefileids [<Boolean>>]` generates a CSV file with headers `courseId,ownerId,fileId' that When true, `logdrivefileids [<Boolean>]` generates a CSV file with headers `courseId,ownerId,fileId' that
lists all drive files in the course. lists all drive files in the course.
The Classroom API does not support course materials of type `form`, they will not be copied. The Classroom API does not support course materials of type `form`, they will not be copied.

View File

@@ -10,6 +10,11 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation. See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation.
### 6.63.13
Updated `gam <UserTypeEntity> print filelist ... showdrivename` and `gam <UserTypeEntity> show fileinfo <DriveFileEntity> ... showdrivename`
to show the actual name of Shared Drives in other domains rather than `Drive`.
### 6.63.12 ### 6.63.12
Updated commands that call the Reports API (including `gam info domain`) to handle a change Updated commands that call the Reports API (including `gam info domain`) to handle a change

View File

@@ -330,7 +330,7 @@ writes the credentials into the file oauth2.txt.
admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt
admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.63.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.10.8 64-bit final Python 3.10.8 64-bit final
MacOS High Sierra 10.13.6 x86_64 MacOS High Sierra 10.13.6 x86_64
@@ -972,7 +972,7 @@ writes the credentials into the file oauth2.txt.
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
C:\GAMADV-XTD3>gam version C:\GAMADV-XTD3>gam version
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.63.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.11.5 64-bit final Python 3.11.5 64-bit final
Windows-10-10.0.17134 AMD64 Windows-10-10.0.17134 AMD64

View File

@@ -3,7 +3,7 @@
Print the current version of Gam with details Print the current version of Gam with details
``` ```
gam version gam version
GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.63.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.11.5 64-bit final Python 3.11.5 64-bit final
MacOS Monterey 12.6.6 x86_64 MacOS Monterey 12.6.6 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 Print the current version of Gam with details and time offset information
``` ```
gam version timeoffset gam version timeoffset
GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.63.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.11.5 64-bit final Python 3.11.5 64-bit final
MacOS Monterey 12.6.6 x86_64 MacOS Monterey 12.6.6 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 Print the current version of Gam with extended details and SSL information
``` ```
gam version extended gam version extended
GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.63.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.11.5 64-bit final Python 3.11.5 64-bit final
MacOS Monterey 12.6.6 x86_64 MacOS Monterey 12.6.6 x86_64
@@ -64,7 +64,7 @@ MacOS High Sierra 10.13.6 x86_64
Path: /Users/Admin/bin/gamadv-xtd3 Path: /Users/Admin/bin/gamadv-xtd3
Version Check: Version Check:
Current: 5.35.08 Current: 5.35.08
Latest: 6.63.12 Latest: 6.63.13
echo $? echo $?
1 1
``` ```
@@ -72,7 +72,7 @@ echo $?
Print the current version number without details Print the current version number without details
``` ```
gam version simple gam version simple
6.63.12 6.63.13
``` ```
In Linux/MacOS you can do: In Linux/MacOS you can do:
``` ```
@@ -82,7 +82,7 @@ echo $VER
Print the current version of Gam and address of this Wiki Print the current version of Gam and address of this Wiki
``` ```
gam help gam help
GAM 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 GAM 6.63.13 - https://github.com/taers232c/GAMADV-XTD3
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.11.5 64-bit final Python 3.11.5 64-bit final
MacOS Monterey 12.6.6 x86_64 MacOS Monterey 12.6.6 x86_64

View File

@@ -2,6 +2,11 @@
Merged GAM-Team version Merged GAM-Team version
6.63.13
Updated `gam <UserTypeEntity> print filelist ... showdrivename` and `gam <UserTypeEntity> show fileinfo <DriveFileEntity> ... showdrivename`
to show the actual name of Shared Drives in other domains rather than `Drive`.
6.63.12 6.63.12
Updated commands that call the Reports API (including `gam info domain`) to handle a change Updated commands that call the Reports API (including `gam info domain`) to handle a change

View File

@@ -3106,7 +3106,7 @@ GCS_FORMAT_MIME_TYPES = {
'gcshtml': MIMETYPE_TEXT_HTML, 'gcshtml': MIMETYPE_TEXT_HTML,
} }
# gcscsv|gcshtml|gcsdoc <StorageBucketObjectName>> # gcscsv|gcshtml|gcsdoc <StorageBucketObjectName>
def getStorageFileData(gcsformat, returnData=True): def getStorageFileData(gcsformat, returnData=True):
mimeType = GCS_FORMAT_MIME_TYPES[gcsformat] mimeType = GCS_FORMAT_MIME_TYPES[gcsformat]
bucket, s_object, bucketObject = getBucketObjectName() bucket, s_object, bucketObject = getBucketObjectName()
@@ -11251,7 +11251,7 @@ def doCreateGCPFolder():
# gam create project [admin <EmailAddress>] [project <ProjectID>] # gam create project [admin <EmailAddress>] [project <ProjectID>]
# [appname <String>] [supportemail <EmailAddress>] # [appname <String>] [supportemail <EmailAddress>]
# [projectname <ProjectName>] [parent <String>] # [projectname <ProjectName>] [parent <String>]
# [saname <ServiceAccountName>] [sadisplayname <ServiceAccountDisplayName>>] [sadescription <ServiceAccountDescription>] # [saname <ServiceAccountName>] [sadisplayname <ServiceAccountDisplayName>] [sadescription <ServiceAccountDescription>]
def doCreateProject(): def doCreateProject():
_checkForExistingProjectFiles([GC.Values[GC.OAUTH2SERVICE_JSON], GC.Values[GC.CLIENT_SECRETS_JSON]]) _checkForExistingProjectFiles([GC.Values[GC.OAUTH2SERVICE_JSON], GC.Values[GC.CLIENT_SECRETS_JSON]])
sys.stdout.write(Msg.TRUST_GAM_CLIENT_ID.format(GAM_PROJECT_CREATION, GAM_PROJECT_CREATION_CLIENT_ID)) sys.stdout.write(Msg.TRUST_GAM_CLIENT_ID.format(GAM_PROJECT_CREATION, GAM_PROJECT_CREATION_CLIENT_ID))
@@ -11325,7 +11325,7 @@ def doCreateProject():
# gam use project [<EmailAddress>] [<ProjectID>] # gam use project [<EmailAddress>] [<ProjectID>]
# gam use project [admin <EmailAddress>] [project <ProjectID>] # gam use project [admin <EmailAddress>] [project <ProjectID>]
# [saname <ServiceAccountName>] [sadisplayname <ServiceAccountDisplayName>>] [sadescription <ServiceAccountDescription>] # [saname <ServiceAccountName>] [sadisplayname <ServiceAccountDisplayName>] [sadescription <ServiceAccountDescription>]
def doUseProject(): def doUseProject():
_checkForExistingProjectFiles([GC.Values[GC.OAUTH2SERVICE_JSON], GC.Values[GC.CLIENT_SECRETS_JSON]]) _checkForExistingProjectFiles([GC.Values[GC.OAUTH2SERVICE_JSON], GC.Values[GC.CLIENT_SECRETS_JSON]])
_, httpObj, login_hint, _, projectInfo, svcAcctInfo = _getLoginHintProjectInfo(False) _, httpObj, login_hint, _, projectInfo, svcAcctInfo = _getLoginHintProjectInfo(False)
@@ -11529,7 +11529,7 @@ def doInfoCurrentProjectId():
printEntity([Ent.PROJECT_ID, _getCurrentProjectId()]) printEntity([Ent.PROJECT_ID, _getCurrentProjectId()])
# gam create svcacct [[admin] <EmailAddress>] [<ProjectIDEntity>] # gam create svcacct [[admin] <EmailAddress>] [<ProjectIDEntity>]
# [saname <ServiceAccountName>] [sadisplayname <ServiceAccountDisplayName>>] [sadescription <ServiceAccountDescription>] # [saname <ServiceAccountName>] [sadisplayname <ServiceAccountDisplayName>] [sadescription <ServiceAccountDescription>]
def doCreateSvcAcct(): def doCreateSvcAcct():
_checkForExistingProjectFiles([GC.Values[GC.OAUTH2SERVICE_JSON]]) _checkForExistingProjectFiles([GC.Values[GC.OAUTH2SERVICE_JSON]])
_, httpObj, login_hint, projects = _getLoginHintProjects(createSvcAcctCmd=True) _, httpObj, login_hint, projects = _getLoginHintProjects(createSvcAcctCmd=True)
@@ -42847,7 +42847,6 @@ def doCreateInboundSSOAssignment():
body = {'customer': normalizeChannelCustomerID(GC.Values[GC.CUSTOMER_ID])} body = {'customer': normalizeChannelCustomerID(GC.Values[GC.CUSTOMER_ID])}
body = _getInboundSSOAssignmentArguments(ci, cd, body) body = _getInboundSSOAssignmentArguments(ci, cd, body)
kvlist = [Ent.INBOUND_SSO_ASSIGNMENT, body['customer']] kvlist = [Ent.INBOUND_SSO_ASSIGNMENT, body['customer']]
print(body)
try: try:
result = callGAPI(ci.inboundSsoAssignments(), 'create', result = callGAPI(ci.inboundSsoAssignments(), 'create',
throwReasons=GAPI.CISSO_CREATE_THROW_REASONS, throwReasons=GAPI.CISSO_CREATE_THROW_REASONS,
@@ -43681,7 +43680,7 @@ class CourseAttributes():
# [copytopics [<Boolean>]] # [copytopics [<Boolean>]]
# [markpublishedasdraft [<Boolean>]] [markdraftaspublished [<Boolean>]] # [markpublishedasdraft [<Boolean>]] [markdraftaspublished [<Boolean>]]
# [members none|all|students|teachers]] # [members none|all|students|teachers]]
# [logdrivefileids [<Boolean>>]] # [logdrivefileids [<Boolean>]]
def doCreateCourse(): def doCreateCourse():
croom = buildGAPIObject(API.CLASSROOM) croom = buildGAPIObject(API.CLASSROOM)
courseAttributes = CourseAttributes(croom, False) courseAttributes = CourseAttributes(croom, False)
@@ -43784,7 +43783,7 @@ def _doUpdateCourses(entityList):
# [copytopics [<Boolean>]] # [copytopics [<Boolean>]]
# [markpublishedasdraft [<Boolean>]] [markdraftaspublished [<Boolean>]] # [markpublishedasdraft [<Boolean>]] [markdraftaspublished [<Boolean>]]
# [members none|all|students|teachers]] # [members none|all|students|teachers]]
# [logdrivefileids [<Boolean>>]] # [logdrivefileids [<Boolean>]]
def doUpdateCourses(): def doUpdateCourses():
_doUpdateCourses(getEntityList(Cmd.OB_COURSE_ENTITY, shlexSplit=True)) _doUpdateCourses(getEntityList(Cmd.OB_COURSE_ENTITY, shlexSplit=True))
@@ -50287,17 +50286,12 @@ class DriveFileFields():
def orderBy(self): def orderBy(self):
return self.OBY.orderBy return self.OBY.orderBy
def SharedDriveName(self, driveId): def SharedDriveName(self, drive, driveId):
if driveId not in self.sharedDriveNames: if driveId not in self.sharedDriveNames:
if not self.drive:
_, self.drive = buildGAPIServiceObject(API.DRIVE3, _getAdminEmail())
if not self.drive:
self.sharedDriveNames[driveId] = TEAM_DRIVE
return TEAM_DRIVE
try: try:
self.sharedDriveNames[driveId] = callGAPI(self.drive.drives(), 'get', self.sharedDriveNames[driveId] = callGAPI(drive.drives(), 'get',
throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.NOT_FOUND], throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.NOT_FOUND],
useDomainAdminAccess=True, driveId=driveId, fields='name')['name'] useDomainAdminAccess=False, driveId=driveId, fields='name')['name']
except (GAPI.notFound, GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy): except (GAPI.notFound, GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy):
self.sharedDriveNames[driveId] = TEAM_DRIVE self.sharedDriveNames[driveId] = TEAM_DRIVE
return self.sharedDriveNames[driveId] return self.sharedDriveNames[driveId]
@@ -50459,9 +50453,9 @@ def showFileInfo(users):
driveId = result.get('driveId') driveId = result.get('driveId')
if driveId: if driveId:
if result['mimeType'] == MIMETYPE_GA_FOLDER and result['name'] == TEAM_DRIVE: if result['mimeType'] == MIMETYPE_GA_FOLDER and result['name'] == TEAM_DRIVE:
result['name'] = DFF.SharedDriveName(driveId) result['name'] = DFF.SharedDriveName(drive, driveId)
if DFF.showSharedDriveNames: if DFF.showSharedDriveNames:
result['driveName'] = DFF.SharedDriveName(driveId) result['driveName'] = DFF.SharedDriveName(drive, driveId)
if showNoParents: if showNoParents:
result.setdefault('parents', []) result.setdefault('parents', [])
if getPermissionsForSharedDrives and driveId and 'permissions' not in result: if getPermissionsForSharedDrives and driveId and 'permissions' not in result:
@@ -51709,7 +51703,7 @@ FILECOUNT_SUMMARY_USER = 'Summary'
# [((query <QueryDriveFile>) | (fullquery <QueryDriveFile>) | <DriveFileQueryShortcut>) (querytime.* <Time>)*] # [((query <QueryDriveFile>) | (fullquery <QueryDriveFile>) | <DriveFileQueryShortcut>) (querytime.* <Time>)*]
# [choose <DriveFileNameEntity>|<DriveFileEntityShortcut>] # [choose <DriveFileNameEntity>|<DriveFileEntityShortcut>]
# [corpora <CorporaAttribute>] # [corpora <CorporaAttribute>]
# [select <DriveFileEntity>> [selectsubquery <QueryDriveFile>] # [select <DriveFileEntity> [selectsubquery <QueryDriveFile>]
# [(norecursion [<Boolean>])|(depth <Number>)] [showparent]] # [(norecursion [<Boolean>])|(depth <Number>)] [showparent]]
# [anyowner|(showownedby any|me|others)] # [anyowner|(showownedby any|me|others)]
# [showmimetype [not] <MimeTypeList>] [minimumfilesize <Integer>] [maximumfilesize <Integer>] # [showmimetype [not] <MimeTypeList>] [minimumfilesize <Integer>] [maximumfilesize <Integer>]
@@ -51797,7 +51791,7 @@ def printFileList(users):
if not pmselect and 'permissions' in fileInfo: if not pmselect and 'permissions' in fileInfo:
fileInfo['permissions'] = DLP.GetFileMatchingPermission(fileInfo) fileInfo['permissions'] = DLP.GetFileMatchingPermission(fileInfo)
if DFF.showSharedDriveNames and driveId: if DFF.showSharedDriveNames and driveId:
fileInfo['driveName'] = DFF.SharedDriveName(driveId) fileInfo['driveName'] = DFF.SharedDriveName(drive, driveId)
if filepath: if filepath:
if not FJQC.formatJSON or not addPathsToJSON: if not FJQC.formatJSON or not addPathsToJSON:
addFilePathsToRow(drive, fileTree, fileInfo, filePathInfo, csvPF, row, fullpath=fullpath, showDepth=showDepth) addFilePathsToRow(drive, fileTree, fileInfo, filePathInfo, csvPF, row, fullpath=fullpath, showDepth=showDepth)