From ae67319975018216ca8fe4033e138712c0ad9012 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Wed, 9 Oct 2024 20:34:51 -0700 Subject: [PATCH] Two updates Updated `gam claim|transfer ownership` to show `Got N Drive Files/Folders that matched query` messages as files/folders are being identified for processing. Added option `` to `gam create|update caalevel`. --- docs/Context-Aware-Access-Levels.md | 6 ++++-- docs/GamUpdates.md | 7 +++++++ docs/How-to-Upgrade-Legacy-GAM-to-GAM7.md | 8 ++++---- docs/Version-and-Help.md | 22 +++++++++++----------- src/GamCommands.txt | 4 ++-- src/GamUpdate.txt | 7 +++++++ src/gam/__init__.py | 20 +++++++++++++++----- 7 files changed, 50 insertions(+), 24 deletions(-) diff --git a/docs/Context-Aware-Access-Levels.md b/docs/Context-Aware-Access-Levels.md index 4cd5a44e..8fce793a 100644 --- a/docs/Context-Aware-Access-Levels.md +++ b/docs/Context-Aware-Access-Levels.md @@ -41,6 +41,8 @@ In order for GAM to manage CAA access levels, you need to grant your service acc ## Definitions ``` + ::= (json [charset ] ) | (json file [charset ]) | + ::= See: https://cloud.google.com/access-context-manager/docs/custom-access-level-spec @@ -144,7 +146,7 @@ basic ## Create an Access Level Create a new access level. CAA supports basic and custom conditions. ``` -gam create caalevel [description ] (basic +)|(custom ) +gam create caalevel [description ] (basic +)|(custom )| ``` ## Example @@ -166,7 +168,7 @@ gam create caalevel CORP_IPS basic condition ipsubnetworks 1.2.3.0/24,4.5.6.0/24 ## Update an Access Level Updates an existing access level. CAA supports basic and custom conditions. ``` -gam update caalevel [description ] (basic +)|(custom ) +gam update caalevel [description ] (basic +)|(custom )| ``` ## Examples diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index df0ca89d..d5f7fa19 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -10,6 +10,13 @@ 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.00.16 + +Updated `gam claim|transfer ownership` to show `Got N Drive Files/Folders that matched query` messages +as files/folders are being identified for processing. + +Added option `` to `gam create|update caalevel`. + ### 7.00.15 Added options `timestamp []` and `timeformat ` to `gam create|update drivefile` that allow diff --git a/docs/How-to-Upgrade-Legacy-GAM-to-GAM7.md b/docs/How-to-Upgrade-Legacy-GAM-to-GAM7.md index 07f20332..ad9c4662 100644 --- a/docs/How-to-Upgrade-Legacy-GAM-to-GAM7.md +++ b/docs/How-to-Upgrade-Legacy-GAM-to-GAM7.md @@ -251,9 +251,9 @@ 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.00.15 - https://github.com/GAM-team/GAM - pyinstaller +GAM 7.00.16 - https://github.com/GAM-team/GAM - pyinstaller GAM Team -Python 3.12.7 64-bit final +Python 3.13.0 64-bit final MacOS Sonoma 14.5 x86_64 Path: /Users/admin/bin/gam7 Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, customer_id: my_customer, domain: domain.com @@ -923,9 +923,9 @@ 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 -GAM7 7.00.15 - https://github.com/GAM-team/GAM - pythonsource +GAM7 7.00.16 - https://github.com/GAM-team/GAM - pythonsource GAM Team -Python 3.12.7 64-bit final +Python 3.13.0 64-bit final Windows-10-10.0.17134 AMD64 Path: C:\GAM7 Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, customer_id: my_customer, domain: domain.com diff --git a/docs/Version-and-Help.md b/docs/Version-and-Help.md index d57224a6..c8c83a9f 100644 --- a/docs/Version-and-Help.md +++ b/docs/Version-and-Help.md @@ -3,9 +3,9 @@ Print the current version of Gam with details ``` gam version -GAM 7.00.15 - https://github.com/GAM-team/GAM - pyinstaller +GAM 7.00.16 - https://github.com/GAM-team/GAM - pyinstaller GAM Team -Python 3.12.7 64-bit final +Python 3.13.0 64-bit final MacOS Sonoma 14.5 x86_64 Path: /Users/Admin/bin/gam7 Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, customer_id: my_customer, domain: domain.com @@ -15,9 +15,9 @@ 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.00.15 - https://github.com/GAM-team/GAM - pyinstaller +GAM 7.00.16 - https://github.com/GAM-team/GAM - pyinstaller GAM Team -Python 3.12.7 64-bit final +Python 3.13.0 64-bit final MacOS Sonoma 14.5 x86_64 Path: /Users/Admin/bin/gam7 Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, customer_id: my_customer, domain: domain.com @@ -27,9 +27,9 @@ 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.00.15 - https://github.com/GAM-team/GAM - pyinstaller +GAM 7.00.16 - https://github.com/GAM-team/GAM - pyinstaller GAM Team -Python 3.12.7 64-bit final +Python 3.13.0 64-bit final MacOS Sonoma 14.5 x86_64 Path: /Users/Admin/bin/gam7 Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, customer_id: my_customer, domain: domain.com @@ -37,7 +37,7 @@ Time: 2023-06-02T21:10:00-07:00 Your system time differs from admin.googleapis.com by less than 1 second OpenSSL 3.1.1 30 May 2023 cryptography 41.0.1 -filelock 3.12.7 +filelock 3.13.0 google-api-python-client 2.88.0 google-auth-httplib2 0.1.0 google-auth-oauthlib 1.0.0 @@ -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.00.15 + Latest: 7.00.16 echo $? 1 ``` @@ -72,7 +72,7 @@ echo $? Print the current version number without details ``` gam version simple -7.00.15 +7.00.16 ``` In Linux/MacOS you can do: ``` @@ -82,9 +82,9 @@ echo $VER Print the current version of Gam and address of this Wiki ``` gam help -GAM 7.00.15 - https://github.com/GAM-team/GAM +GAM 7.00.16 - https://github.com/GAM-team/GAM GAM Team -Python 3.12.7 64-bit final +Python 3.13.0 64-bit final MacOS Sonoma 14.5 x86_64 Path: /Users/Admin/bin/gam7 Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, customer_id: my_customer, domain: domain.com diff --git a/src/GamCommands.txt b/src/GamCommands.txt index 1a4a0e8b..942401fb 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -2770,8 +2770,8 @@ gam print chromesnvalidity [todrive *] (combiningfunction ) | (condition + endcondition) -gam create caalevel [description ] (basic +)|(custom ) -gam update caalevel [description ] (basic +)|(custom ) +gam create caalevel [description ] (basic +)|(custom )| +gam update caalevel [description ] (basic +)|(custom )| gam delete caalevel gam show caalevels [formatjson] diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index 137cabd5..5cd575fa 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -1,3 +1,10 @@ +7.00.16 + +Updated `gam claim|transfer ownership` to show `Got N Drive Files/Folders that matched query` messages +as files/folders are being identified for processing. + +Added option `` to `gam create|update caalevel`. + 7.00.15 Added options `timestamp []` and `timeformat ` to `gam create|update drivefile` that allow diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 51f36770..bb6144b3 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki """ __author__ = 'GAM Team ' -__version__ = '7.00.15' +__version__ = '7.00.16' __license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)' #pylint: disable=wrong-import-position @@ -61687,11 +61687,15 @@ def transferOwnership(users): _identifyFilesToTransfer(childEntry) def _identifyChildrenToTransfer(fileEntry, user, i, count): + q = WITH_PARENTS.format(fileEntry['id']) + setGettingAllEntityItemsForWhom(Ent.DRIVE_FILE_OR_FOLDER, user, query=q) + pageMessage = getPageMessageForWhom(clearLastGotMsgLen=False) try: children = callGAPIpages(drive.files(), 'list', 'files', + pageMessage=pageMessage, noFinalize=True, throwReasons=GAPI.DRIVE_USER_THROW_REASONS, retryReasons=[GAPI.UNKNOWN_ERROR], - orderBy=OBY.orderBy, q=WITH_PARENTS.format(fileEntry['id']), + orderBy=OBY.orderBy, q=q, fields='nextPageToken,files(id,name,parents,mimeType,ownedByMe,trashed)', pageSize=GC.Values[GC.DRIVE_MAX_RESULTS]) except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e: @@ -61972,11 +61976,15 @@ def claimOwnership(users): _identifyFilesToClaim(childEntry) def _identifyChildrenToClaim(fileEntry, user, i, count): + q = WITH_PARENTS.format(fileEntry['id']) + setGettingAllEntityItemsForWhom(Ent.DRIVE_FILE_OR_FOLDER, user, query=q) + pageMessage = getPageMessageForWhom(clearLastGotMsgLen=False) try: children = callGAPIpages(drive.files(), 'list', 'files', + pageMessage=pageMessage, noFinalize=True, throwReasons=GAPI.DRIVE_USER_THROW_REASONS, retryReasons=[GAPI.UNKNOWN_ERROR], - orderBy=OBY.orderBy, q=WITH_PARENTS.format(fileEntry['id']), + orderBy=OBY.orderBy, q=q, fields='nextPageToken,files(id,name,parents,mimeType,ownedByMe,trashed,owners(emailAddress,permissionId))', pageSize=GC.Values[GC.DRIVE_MAX_RESULTS]) except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e: @@ -74629,10 +74637,12 @@ def CAABuildLevel(body): body['custom'] = {'expr': {'expression': getString(Cmd.OB_STRING), 'title': 'expr'}} elif myarg == 'description': body['description'] = getString(Cmd.OB_STRING, minLen=0) + elif myarg == 'json': + body.update(getJSON(['name'])) else: unknownArgumentExit() -# gam create caalevel [description ] (basic +)|(custom ) +# gam create caalevel [description ] (basic +)|(custom )| def doCreateCAALevel(): caa = buildCAAServiceObject() ap_name = getAccessPolicy(caa) @@ -74652,7 +74662,7 @@ def doCreateCAALevel(): except GAPI.permissionDenied: CAARoleErrorExit(caa) -# gam update caalevel [description ] (basic +)|(custom ) +# gam update caalevel [description ] (basic +)|(custom )| def doUpdateCAALevel(): caa = buildCAAServiceObject() name = normalizeCAALevelName(caa, getString(Cmd.OB_ACCESS_LEVEL_NAME))