From c9023d47925fa3666517bd2fa4fd79426ba33597 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Thu, 7 Sep 2023 21:15:08 -0700 Subject: [PATCH] Show actual Shared Drive names for drives in other domains --- docs/Classroom-Courses.md | 8 +++--- docs/GamUpdates.md | 5 ++++ docs/How-to-Upgrade-from-Standard-GAM.md | 4 +-- docs/Version-and-Help.md | 12 ++++----- src/GamUpdate.txt | 5 ++++ src/gam/__init__.py | 34 ++++++++++-------------- 6 files changed, 36 insertions(+), 32 deletions(-) diff --git a/docs/Classroom-Courses.md b/docs/Classroom-Courses.md index a05cba43..ad5643cf 100644 --- a/docs/Classroom-Courses.md +++ b/docs/Classroom-Courses.md @@ -278,7 +278,7 @@ gam create|add course [id|alias ] * [markdraftaspublished []] [markpublishedasdraft []] [members none|all|students|teachers]] - [logdrivefileids [>]] + [logdrivefileids []] gam update course + [copyfrom @@ -292,7 +292,7 @@ gam update course + [markdraftaspublished []] [markpublishedasdraft []] [members none|all|students|teachers]] - [logdrivefileids [>]] + [logdrivefileids []] gam update courses + [copyfrom [announcementstates ] @@ -305,7 +305,7 @@ gam update courses + [markdraftaspublished []] [markpublishedasdraft []] [members none|all|students|teachers]] - [logdrivefileids [>]] + [logdrivefileids []] ``` `copyfrom ` allows copying of course announcements, work, topics and members from one course to another. * Accouncements - By default, no course announcements are copied @@ -335,7 +335,7 @@ gam update courses + * `members students` - Copy students * `members teachers` - Copy teachers -When true, `logdrivefileids [>]` generates a CSV file with headers `courseId,ownerId,fileId' that +When true, `logdrivefileids []` generates a CSV file with headers `courseId,ownerId,fileId' that lists all drive files in the course. The Classroom API does not support course materials of type `form`, they will not be copied. diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index c508e0dc..37672516 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -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. +### 6.63.13 + +Updated `gam print filelist ... showdrivename` and `gam show fileinfo ... showdrivename` +to show the actual name of Shared Drives in other domains rather than `Drive`. + ### 6.63.12 Updated commands that call the Reports API (including `gam info domain`) to handle a change diff --git a/docs/How-to-Upgrade-from-Standard-GAM.md b/docs/How-to-Upgrade-from-Standard-GAM.md index 68d38964..4eacc2c9 100644 --- a/docs/How-to-Upgrade-from-Standard-GAM.md +++ b/docs/How-to-Upgrade-from-Standard-GAM.md @@ -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$ ./gam version 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 Python 3.10.8 64-bit final 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>gam version 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 Python 3.11.5 64-bit final Windows-10-10.0.17134 AMD64 diff --git a/docs/Version-and-Help.md b/docs/Version-and-Help.md index 22599621..c46af6ae 100644 --- a/docs/Version-and-Help.md +++ b/docs/Version-and-Help.md @@ -3,7 +3,7 @@ Print the current version of Gam with details ``` 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 Python 3.11.5 64-bit final 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 ``` 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 Python 3.11.5 64-bit final 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 ``` 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 Python 3.11.5 64-bit final 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 Version Check: Current: 5.35.08 - Latest: 6.63.12 + Latest: 6.63.13 echo $? 1 ``` @@ -72,7 +72,7 @@ echo $? Print the current version number without details ``` gam version simple -6.63.12 +6.63.13 ``` 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 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 +GAM 6.63.13 - https://github.com/taers232c/GAMADV-XTD3 Ross Scroggs Python 3.11.5 64-bit final MacOS Monterey 12.6.6 x86_64 diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index 2a8f7f0b..912594ab 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,6 +2,11 @@ Merged GAM-Team version +6.63.13 + +Updated `gam print filelist ... showdrivename` and `gam show fileinfo ... showdrivename` +to show the actual name of Shared Drives in other domains rather than `Drive`. + 6.63.12 Updated commands that call the Reports API (including `gam info domain`) to handle a change diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 09e47b3a..d22a384f 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -3106,7 +3106,7 @@ GCS_FORMAT_MIME_TYPES = { 'gcshtml': MIMETYPE_TEXT_HTML, } -# gcscsv|gcshtml|gcsdoc > +# gcscsv|gcshtml|gcsdoc def getStorageFileData(gcsformat, returnData=True): mimeType = GCS_FORMAT_MIME_TYPES[gcsformat] bucket, s_object, bucketObject = getBucketObjectName() @@ -11251,7 +11251,7 @@ def doCreateGCPFolder(): # gam create project [admin ] [project ] # [appname ] [supportemail ] # [projectname ] [parent ] -# [saname ] [sadisplayname >] [sadescription ] +# [saname ] [sadisplayname ] [sadescription ] def doCreateProject(): _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)) @@ -11325,7 +11325,7 @@ def doCreateProject(): # gam use project [] [] # gam use project [admin ] [project ] -# [saname ] [sadisplayname >] [sadescription ] +# [saname ] [sadisplayname ] [sadescription ] def doUseProject(): _checkForExistingProjectFiles([GC.Values[GC.OAUTH2SERVICE_JSON], GC.Values[GC.CLIENT_SECRETS_JSON]]) _, httpObj, login_hint, _, projectInfo, svcAcctInfo = _getLoginHintProjectInfo(False) @@ -11529,7 +11529,7 @@ def doInfoCurrentProjectId(): printEntity([Ent.PROJECT_ID, _getCurrentProjectId()]) # gam create svcacct [[admin] ] [] -# [saname ] [sadisplayname >] [sadescription ] +# [saname ] [sadisplayname ] [sadescription ] def doCreateSvcAcct(): _checkForExistingProjectFiles([GC.Values[GC.OAUTH2SERVICE_JSON]]) _, httpObj, login_hint, projects = _getLoginHintProjects(createSvcAcctCmd=True) @@ -42847,7 +42847,6 @@ def doCreateInboundSSOAssignment(): body = {'customer': normalizeChannelCustomerID(GC.Values[GC.CUSTOMER_ID])} body = _getInboundSSOAssignmentArguments(ci, cd, body) kvlist = [Ent.INBOUND_SSO_ASSIGNMENT, body['customer']] - print(body) try: result = callGAPI(ci.inboundSsoAssignments(), 'create', throwReasons=GAPI.CISSO_CREATE_THROW_REASONS, @@ -43681,7 +43680,7 @@ class CourseAttributes(): # [copytopics []] # [markpublishedasdraft []] [markdraftaspublished []] # [members none|all|students|teachers]] -# [logdrivefileids [>]] +# [logdrivefileids []] def doCreateCourse(): croom = buildGAPIObject(API.CLASSROOM) courseAttributes = CourseAttributes(croom, False) @@ -43784,7 +43783,7 @@ def _doUpdateCourses(entityList): # [copytopics []] # [markpublishedasdraft []] [markdraftaspublished []] # [members none|all|students|teachers]] -# [logdrivefileids [>]] +# [logdrivefileids []] def doUpdateCourses(): _doUpdateCourses(getEntityList(Cmd.OB_COURSE_ENTITY, shlexSplit=True)) @@ -50287,17 +50286,12 @@ class DriveFileFields(): def orderBy(self): return self.OBY.orderBy - def SharedDriveName(self, driveId): + def SharedDriveName(self, drive, driveId): 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: - self.sharedDriveNames[driveId] = callGAPI(self.drive.drives(), 'get', - throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.NOT_FOUND], - useDomainAdminAccess=True, driveId=driveId, fields='name')['name'] + self.sharedDriveNames[driveId] = callGAPI(drive.drives(), 'get', + throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.NOT_FOUND], + useDomainAdminAccess=False, driveId=driveId, fields='name')['name'] except (GAPI.notFound, GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy): self.sharedDriveNames[driveId] = TEAM_DRIVE return self.sharedDriveNames[driveId] @@ -50459,9 +50453,9 @@ def showFileInfo(users): driveId = result.get('driveId') if driveId: 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: - result['driveName'] = DFF.SharedDriveName(driveId) + result['driveName'] = DFF.SharedDriveName(drive, driveId) if showNoParents: result.setdefault('parents', []) if getPermissionsForSharedDrives and driveId and 'permissions' not in result: @@ -51709,7 +51703,7 @@ FILECOUNT_SUMMARY_USER = 'Summary' # [((query ) | (fullquery ) | ) (querytime.*