From e26cda1d6b28cc6be3c8e54a5a3d062f638f3bcf Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Thu, 27 Jul 2023 09:49:30 -0700 Subject: [PATCH 01/14] Added option `contentrestrictions ownerrestricted []` to ``. --- docs/GamUpdates.md | 4 ++++ docs/Users-Drive-Files-Display.md | 8 ++++++++ docs/Users-Drive-Files-Manage.md | 3 +-- src/GamCommands.txt | 3 +++ src/GamUpdate.txt | 4 ++++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index eff4a4bd..d2e565a2 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -10,6 +10,10 @@ 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.61.15 + +Added option `contentrestrictions ownerrestricted []` to ``. + ### 6.61.14 Added `aggregatebyuser [Boolean]` option to `gam report user` to allow data aggregation for users across multiple dates. diff --git a/docs/Users-Drive-Files-Display.md b/docs/Users-Drive-Files-Display.md index 79bf09d1..d7b631cf 100644 --- a/docs/Users-Drive-Files-Display.md +++ b/docs/Users-Drive-Files-Display.md @@ -118,6 +118,14 @@ cantrashchildren| canuntrash + ::= + ownerrestricted| + readonly| + reason| + restrictinguser| + restrictiontime| + type + ::= labels.id| # modifiedByMe labels.revisionid| # copyRequiresWriterPermission diff --git a/docs/Users-Drive-Files-Manage.md b/docs/Users-Drive-Files-Manage.md index 762ef576..8779324a 100644 --- a/docs/Users-Drive-Files-Manage.md +++ b/docs/Users-Drive-Files-Manage.md @@ -108,8 +108,7 @@ ``` ``` ::= - (contentrestrictions readonly false)| - (contentrestrictions readonly true [reason ])| + (contentrestrictions (readonly false)|(readonly true [reason ]) [ownerrestricted []])| (copyrequireswriterpermission [])| (description )| (folderColorRgb )| diff --git a/src/GamCommands.txt b/src/GamCommands.txt index d98703a5..e425b02d 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -5833,6 +5833,7 @@ gam show datastudiopermissions | | | | ) ::= + (contentrestrictions ownerrestricted [])| (contentrestrictions readonly false)| (contentrestrictions readonly true [reason ])| (copyrequireswriterpermission [])| @@ -5905,6 +5906,7 @@ gam update drivefile [copy] [returnidonly|ret [charset ] [columndelimiter ] ::= + (contentrestrictions ownerrestricted [])| (contentrestrictions readonly false)| (contentrestrictions readonly true [reason ])| (copyrequireswriterpermission [])| @@ -6249,6 +6251,7 @@ gam collect orphans canuntrash ::= + ownerrestricted| readonly| reason| restrictinguser| diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index 499cd212..f03a0556 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,6 +2,10 @@ Merged GAM-Team version +6.61.15 + +Added option `contentrestrictions ownerrestricted []` to ``. + 6.61.14 Added `aggregatebyuser [Boolean]` option to `gam report user` to allow data aggregation for users across multiple dates. From 01aaff9b830f52297f889fd1f0923befdc4643e1 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Thu, 27 Jul 2023 10:00:54 -0700 Subject: [PATCH 02/14] Added option `contentrestrictions ownerrestricted []` to ``. --- src/GamCommands.txt | 8 ++------ src/GamUpdate.txt | 2 +- src/gam/__init__.py | 23 +++++++++++++---------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/GamCommands.txt b/src/GamCommands.txt index e425b02d..736661de 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -5833,9 +5833,7 @@ gam show datastudiopermissions | | | | ) ::= - (contentrestrictions ownerrestricted [])| - (contentrestrictions readonly false)| - (contentrestrictions readonly true [reason ])| + (contentrestrictions (readonly false)|(readonly true [reason ]) [ownerrestricted []])| (copyrequireswriterpermission [])| (description )| (folderColorRgb )| @@ -5906,9 +5904,7 @@ gam update drivefile [copy] [returnidonly|ret [charset ] [columndelimiter ] ::= - (contentrestrictions ownerrestricted [])| - (contentrestrictions readonly false)| - (contentrestrictions readonly true [reason ])| + (contentrestrictions (readonly false)|(readonly true [reason ]) [ownerrestricted []])| (copyrequireswriterpermission [])| (description )| ignoredefaultvisibility| diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index f03a0556..c315d708 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -11,7 +11,7 @@ Added option `contentrestrictions ownerrestricted []` to ` Date: Thu, 27 Jul 2023 14:08:23 -0700 Subject: [PATCH 03/14] Added the following license SKUs. +``` 1010060005 - Google Workspace Essentials Plus 1010020031 - Google Workspace Frontline Standard 1010340005 - Google Workspace Business Starter - Archived User 1010340006 - Google Workspace Business Standard - Archived User ``` --- docs/Licenses.md | 12 ++++++++---- src/GamUpdate.txt | 8 ++++++++ src/gam/gamlib/glskus.py | 10 +++++++++- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/docs/Licenses.md b/docs/Licenses.md index a1426411..e8ed52b3 100644 --- a/docs/Licenses.md +++ b/docs/Licenses.md @@ -66,17 +66,20 @@ | Google Voice Standard | 1010330004 | voicestandard | | Google Voice Starter | 1010330003 | voicestarter | | Google Workspace Business - Archived User | 1010340002 | gsuitebusinessarchived | -| Google Workspace Business Plus - Archived User | 1010340003 | wsbizplusarchived | | Google Workspace Business Plus | 1010020025 | wsbizplus | +| Google Workspace Business Plus - Archived User | 1010340003 | wsbizplusarchived | | Google Workspace Business Standard | 1010020028 | wsbizstan | +| Google Workspace Business Standard - Archived User | 1010340006 | wsbizstanarchived | | Google Workspace Business Starter | 1010020027 | wsbizstarter | +| Google Workspace Business Starter - Archived User | 1010340005 | wsbizstarterarchived | | Google Workspace Enterprise Essentials | 1010060003 | wsentess | -| Google Workspace Enterprise Plus - Archived User | 1010340001 | gsuiteenterprisearchived | | Google Workspace Enterprise Plus | 1010020020 | wsentplus | -| Google Workspace Enterprise Standard - Archived User | 1010340004 | wsentstanarchived | +| Google Workspace Enterprise Plus - Archived User | 1010340001 | gsuiteenterprisearchived | | Google Workspace Enterprise Standard | 1010020026 | wsentstan | +| Google Workspace Enterprise Standard - Archived User | 1010340004 | wsentstanarchived | | Google Workspace Enterprise Starter | 1010020029 | wsentstarter | | Google Workspace Essentials | 1010060001 | wsess | +| Google Workspace Essentials Plus | 1010060005 | wsessplus | | Google Workspace Government | Google-Apps-For-Government | gsuitegov | | Google Workspace for Education Plus (Extra Student) | 1010310010 | gwepstudent | | Google Workspace for Education Plus (Staff) | 1010310009 | gwepstaff | @@ -87,7 +90,8 @@ | Google Workspace for Education Standard (Staff) | 1010310006 | gwesstaff | | Google Workspace for Education Standard | 1010310005 | gwes | | Google Workspace for Education: Teaching and Learning Upgrade | 1010370001 | gwetlu | -| Google Workspace Frontline | 1010020030 | wsflw,workspacefrontline,workspacefrontlineworker | +| Google Workspace Frontline Starter | 1010020030 | wsflw | +| Google Workspace Frontline Standard | 1010020031 | wsflwstan | ## Definitions ``` diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index c315d708..bde6587a 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,6 +2,14 @@ Merged GAM-Team version +Added the following license SKUs. +``` +1010060005 - Google Workspace Essentials Plus +1010020031 - Google Workspace Frontline Standard +1010340005 - Google Workspace Business Starter - Archived User +1010340006 - Google Workspace Business Standard - Archived User +``` + 6.61.15 Added option `contentrestrictions ownerrestricted []` to ``. diff --git a/src/gam/gamlib/glskus.py b/src/gam/gamlib/glskus.py index 22a17866..663b8dbb 100644 --- a/src/gam/gamlib/glskus.py +++ b/src/gam/gamlib/glskus.py @@ -107,7 +107,9 @@ _SKUS = { '1010020029': { 'product': 'Google-Apps', 'aliases': ['wes', 'wsentstarter', 'workspaceenterprisestarter'], 'displayName': 'Workspace Enterprise Starter'}, '1010020030': { - 'product': 'Google-Apps', 'aliases': ['wsflw', 'workspacefrontline', 'workspacefrontlineworker'], 'displayName': 'Google Workspace Frontline'}, + 'product': 'Google-Apps', 'aliases': ['wsflw', 'workspacefrontline', 'workspacefrontlineworker'], 'displayName': 'Google Workspace Frontline Starter'}, + '1010020031`': { + 'product': 'Google-Apps', 'aliases': ['wsflwstan', 'workspacefrontlinestan', 'workspacefrontlineworkerstan'], 'displayName': 'Google Workspace Frontline Standard'}, '1010340001': { 'product': '101034', 'aliases': ['gseau', 'enterprisearchived', 'gsuiteenterprisearchived'], 'displayName': 'Google Workspace Enterprise Plus - Archived User'}, '1010340002': { @@ -116,12 +118,18 @@ _SKUS = { 'product': '101034', 'aliases': ['wsbizplusarchived', 'workspacebusinessplusarchived'], 'displayName': 'Google Workspace Business Plus - Archived User'}, '1010340004': { 'product': '101034', 'aliases': ['wsentstanarchived', 'workspaceenterprisestandardarchived'], 'displayName': 'Google Workspace Enterprise Standard - Archived User'}, + '1010340005': { + 'product': '101034', 'aliases': ['wsbizstarterarchived', 'workspacebusinessstarterarchived'], 'displayName': 'Google Workspace Business Starter - Archived User'}, + '1010340006': { + 'product': '101034', 'aliases': ['wsbizstanarchived', 'workspacebusinessstanarchived'], 'displayName': 'Google Workspace Business Standard - Archived User'}, '1010060001': { 'product': '101006', 'aliases': ['gsuiteessentials', 'essentials', 'd4e', 'driveenterprise', 'drive4enterprise', 'wsess', 'workspaceesentials'], 'displayName': 'Google Workspace Essentials'}, '1010060003': { 'product': 'Google-Apps', 'aliases': ['wsentess', 'workspaceenterpriseessentials'], 'displayName': 'Google Workspace Enterprise Essentials'}, + '1010060005': { + 'product': 'Google-Apps', 'aliases': ['wsessplus', 'workspaceessentialsplus'], 'displayName': 'Google Workspace Essentials Plus'}, 'Google-Drive-storage-20GB': { 'product': 'Google-Drive-storage', 'aliases': ['drive20gb', '20gb', 'googledrivestorage20gb'], 'displayName': 'Google Drive Storage 20GB'}, 'Google-Drive-storage-50GB': { From 5d036613570726109e4f0a4e0ccb93a0425b48ca Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Thu, 27 Jul 2023 14:59:09 -0700 Subject: [PATCH 04/14] Hold off on gam config --- src/gam-install.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gam-install.sh b/src/gam-install.sh index 7e7259b8..0f293a63 100755 --- a/src/gam-install.sh +++ b/src/gam-install.sh @@ -289,7 +289,7 @@ if [ "$upgrade_only" = true ]; then fi # Set config command -config_cmd="config no_browser false" +#config_cmd="config no_browser false" while true; do read -p "Can you run a full browser on this machine? (usually Y for MacOS, N for Linux if you SSH into this machine) " yn @@ -298,7 +298,8 @@ while true; do break ;; [Nn]*) - config_cmd="config no_browser true" +# config_cmd="config no_browser true" + touch "$target_dir/gam/nobrowser.txt" > /dev/null 2>&1 break ;; *) @@ -316,7 +317,8 @@ while true; do if [ "$adminuser" == "" ]; then read -p "Please enter your Google Workspace admin email address: " adminuser fi - "$target_dir/$target_gam" $config_cmd create project $adminuser +# "$target_dir/$target_gam" $config_cmd create project $adminuser + "$target_dir/$target_gam" create project $adminuser rc=$? if (( $rc == 0 )); then echo_green "Project creation complete." @@ -341,7 +343,8 @@ while $project_created; do read -p "Are you ready to authorize GAM to perform Google Workspace management operations as your admin account? (yes or no) " yn case $yn in [Yy]*) - "$target_dir/$target_gam" $config_cmd oauth create $adminuser +# "$target_dir/$target_gam" $config_cmd oauth create $adminuser + "$target_dir/$target_gam" oauth create $adminuser rc=$? if (( $rc == 0 )); then echo_green "Admin authorization complete." @@ -370,7 +373,8 @@ while $admin_authorized; do read -p "Please enter the email address of a regular Google Workspace user: " regularuser fi echo_yellow "Great! Checking service account scopes.This will fail the first time. Follow the steps to authorize and retry. It can take a few minutes for scopes to PASS after they've been authorized in the admin console." - "$target_dir/$target_gam" $config_cmd user $regularuser check serviceaccount +# "$target_dir/$target_gam" $config_cmd user $regularuser check serviceaccount + "$target_dir/$target_gam" user $regularuser check serviceaccount rc=$? if (( $rc == 0 )); then echo_green "Service account authorization complete." @@ -391,7 +395,8 @@ while $admin_authorized; do done echo_green "Here's information about your new GAM installation:" -"$target_dir/$target_gam" $config_cmd save version extended +#"$target_dir/$target_gam" $config_cmd save version extended +"$target_dir/$target_gam" version extended rc=$? if (( $rc != 0 )); then echo_red "ERROR: Failed running GAM for the first time with $rc. Please report this error to GAM mailing list. Exiting." From c4cca8cf421115b551c4b09b8c79949459b9ee70 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Fri, 28 Jul 2023 08:39:44 -0400 Subject: [PATCH 05/14] actions: self hosted arm64 runner, take 1 This will probably blow up, but the flames should look cool :-) --- .github/workflows/build.yml | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc79a82b..26829b87 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,8 +54,18 @@ jobs: - os: macos-12 jid: 5 goal: build + arch: x86_64 + openssl_archs: darwin64-x86_64 + - os: [self-hosted, macOS, ARM64] + jid: 7 + gaol: build + arch: aarch64 + openssl_archs: darwin64-arm64 + - os: [self-hosted, macOS, ARM64] + jid: 12 + gaol: build arch: universal2 - openssl_archs: darwin64-x86_64 darwin64-arm64 + openssl_archs: darwin64-arm64 darwin64-x86_64 - os: windows-2022 jid: 6 goal: build @@ -104,7 +114,7 @@ jobs: path: | bin.tar.xz src/cpython - key: gam-${{ matrix.jid }}-20230608 + key: gam-${{ matrix.jid }}-20230728 - name: Untar Cache archive if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit == 'true' @@ -167,14 +177,15 @@ jobs: sudo apt-get -qq --yes install swig libpcsclite-dev libxslt1-dev - name: MacOS install tools - if: runner.os == 'macOS' + if: runner.os == 'macOS' && runner.arch == 'x86_64' run: | # Install latest Rust curl $curl_retry -fsS -o rust.sh https://sh.rustup.rs bash ./rust.sh -y source $HOME/.cargo/env # needed for Rust to compile cryptography Python package for universal2 - rustup target add aarch64-apple-darwin + # not needed since MacOS ARM and universal will be on self-hosted + #rustup target add aarch64-apple-darwin - name: Windows Configure VCode uses: ilammy/msvc-dev-cmd@v1 @@ -248,7 +259,7 @@ jobs: git checkout "${LATEST_STABLE_TAG}" export COMPILED_OPENSSL_VERSION=${LATEST_STABLE_TAG:8} # Trim the openssl- prefix echo "COMPILED_OPENSSL_VERSION=${COMPILED_OPENSSL_VERSION}" >> $GITHUB_ENV - if [[ "${RUNNER_OS}" == "macOS" ]]; then + if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2"]]; then for openssl_arch in $openssl_archs; do ssldir="${OPENSSL_SOURCE_PATH}-${openssl_arch}" mkdir -v "${ssldir}" @@ -288,7 +299,7 @@ jobs: - name: Install OpenSSL if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | - if [[ "${RUNNER_OS}" == "macOS" ]]; then + if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2"]]; then for openssl_arch in $openssl_archs; do cd "${GITHUB_WORKSPACE}/src/openssl-${openssl_arch}" # install_sw saves us ages processing man pages :-) @@ -340,7 +351,7 @@ jobs: if: matrix.goal == 'build' && runner.os != 'Windows' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | cd "${PYTHON_SOURCE_PATH}" - if [[ "${RUNNER_OS}" == "macOS" ]]; then + if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2"]]; then extra_args=( "--enable-universalsdk" "--with-universal-archs=universal2" ) else extra_args=( ) @@ -430,7 +441,7 @@ jobs: run: | echo "before anything..." "${PYTHON}" -m pip list - if [[ "${RUNNER_OS}" == "macOS" ]]; then + if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2"]]; then # cffi is a dep of cryptography and doesn't ship # a universal2 wheel so we must build one ourself :-/ export CFLAGS="-arch x86_64 -arch arm64" @@ -522,6 +533,7 @@ jobs: cp -v cacerts.pem $gampath cp -v LICENSE $gampath cp -v GamCommands.txt $gampath + cp -v GamUpdate.txt $gampath if [[ "${RUNNER_OS}" == "Windows" ]]; then cp -v gam-setup.bat $gampath fi @@ -561,7 +573,7 @@ jobs: if: runner.os != 'Windows' && matrix.goal == 'build' run: | if [[ "${RUNNER_OS}" == "macOS" ]]; then - GAM_ARCHIVE="gam-${GAMVERSION}-macos-universal2.tar.xz" + GAM_ARCHIVE="gam-${GAMVERSION}-macos-${arch}.tar.xz" elif [[ "${RUNNER_OS}" == "Linux" ]]; then if [[ "${staticx}" == "yes" ]]; then libver="legacy" From a2cdc7ce31164cd0d57d4465dbdd6fd0d26e6cbe Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Fri, 28 Jul 2023 08:44:34 -0400 Subject: [PATCH 06/14] actions: fix bash condition That died quicker than I thought it would, man Bash is picky... --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 26829b87..1621fde7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -259,7 +259,7 @@ jobs: git checkout "${LATEST_STABLE_TAG}" export COMPILED_OPENSSL_VERSION=${LATEST_STABLE_TAG:8} # Trim the openssl- prefix echo "COMPILED_OPENSSL_VERSION=${COMPILED_OPENSSL_VERSION}" >> $GITHUB_ENV - if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2"]]; then + if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2" ]]; then for openssl_arch in $openssl_archs; do ssldir="${OPENSSL_SOURCE_PATH}-${openssl_arch}" mkdir -v "${ssldir}" @@ -299,7 +299,7 @@ jobs: - name: Install OpenSSL if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | - if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2"]]; then + if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2" ]]; then for openssl_arch in $openssl_archs; do cd "${GITHUB_WORKSPACE}/src/openssl-${openssl_arch}" # install_sw saves us ages processing man pages :-) @@ -351,7 +351,7 @@ jobs: if: matrix.goal == 'build' && runner.os != 'Windows' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | cd "${PYTHON_SOURCE_PATH}" - if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2"]]; then + if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2" ]]; then extra_args=( "--enable-universalsdk" "--with-universal-archs=universal2" ) else extra_args=( ) @@ -441,7 +441,7 @@ jobs: run: | echo "before anything..." "${PYTHON}" -m pip list - if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2"]]; then + if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2" ]]; then # cffi is a dep of cryptography and doesn't ship # a universal2 wheel so we must build one ourself :-/ export CFLAGS="-arch x86_64 -arch arm64" From cf78f4b397611ad56f5acefe5ba019876b2a0d2a Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Fri, 28 Jul 2023 09:14:51 -0400 Subject: [PATCH 07/14] actions: oh bash... --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1621fde7..874e2aa0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -259,7 +259,7 @@ jobs: git checkout "${LATEST_STABLE_TAG}" export COMPILED_OPENSSL_VERSION=${LATEST_STABLE_TAG:8} # Trim the openssl- prefix echo "COMPILED_OPENSSL_VERSION=${COMPILED_OPENSSL_VERSION}" >> $GITHUB_ENV - if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2" ]]; then + if ([ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2" ]); then for openssl_arch in $openssl_archs; do ssldir="${OPENSSL_SOURCE_PATH}-${openssl_arch}" mkdir -v "${ssldir}" @@ -299,7 +299,7 @@ jobs: - name: Install OpenSSL if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | - if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2" ]]; then + if ([ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2" ]); then for openssl_arch in $openssl_archs; do cd "${GITHUB_WORKSPACE}/src/openssl-${openssl_arch}" # install_sw saves us ages processing man pages :-) @@ -351,7 +351,7 @@ jobs: if: matrix.goal == 'build' && runner.os != 'Windows' && steps.cache-python-ssl.outputs.cache-hit != 'true' run: | cd "${PYTHON_SOURCE_PATH}" - if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2" ]]; then + if ([ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2" ]); then extra_args=( "--enable-universalsdk" "--with-universal-archs=universal2" ) else extra_args=( ) @@ -441,7 +441,7 @@ jobs: run: | echo "before anything..." "${PYTHON}" -m pip list - if [[ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2" ]]; then + if ([ "${RUNNER_OS}" == "macOS" ] && [ "$arch" == "universal2" ]); then # cffi is a dep of cryptography and doesn't ship # a universal2 wheel so we must build one ourself :-/ export CFLAGS="-arch x86_64 -arch arm64" From 8d5acc195c3e88239f2181e13aac627ae2e54b96 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Fri, 28 Jul 2023 09:17:41 -0400 Subject: [PATCH 08/14] actions: goal not gaol --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 874e2aa0..0942b5f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,12 +58,12 @@ jobs: openssl_archs: darwin64-x86_64 - os: [self-hosted, macOS, ARM64] jid: 7 - gaol: build + goal: build arch: aarch64 openssl_archs: darwin64-arm64 - os: [self-hosted, macOS, ARM64] jid: 12 - gaol: build + goal: build arch: universal2 openssl_archs: darwin64-arm64 darwin64-x86_64 - os: windows-2022 From b5f9b85324fb533be02aadc2a242ee4d4c86e04d Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Fri, 28 Jul 2023 09:57:12 -0400 Subject: [PATCH 09/14] pyinstaller spec: use $arch to determine if we need universal2 --- src/gam.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gam.spec b/src/gam.spec index 7d1e97b3..b8f497e7 100644 --- a/src/gam.spec +++ b/src/gam.spec @@ -44,7 +44,10 @@ pyz = PYZ(a.pure, # GAM with older versions anyway match platform: case "darwin": - target_arch = "universal2" + if getenv('arch') == 'universal2': + target_arch = "universal2" + else: + target_arch = None strip = True case "win32": target_arch = None From fa70d9cbedd0636d653297f07ebe9c6b468729c5 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Fri, 28 Jul 2023 15:29:19 -0700 Subject: [PATCH 10/14] Couple of small updates --- docs/GamUpdates.md | 21 +++++++++++++++++++++ src/GamUpdate.txt | 13 +++++++++++++ src/gam/__init__.py | 18 +++++++++++------- 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index d2e565a2..d2ce51ee 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -10,6 +10,27 @@ 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.61.17 + +Updated `gam print|show vaultexports|vaultholds|vaultqueries` to not set a non-zero return code +when a vault matter changes state from `OPEN` to `CLOSED|DELETED` while the command is being processed. + +Updated `gam create shareddrive ou|org|orgunit ` to handle the following error: +``` +ERROR: 403: permissionDenied - Request had insufficient authentication scopes. +``` +It's not clear what causes the error. + +6.61.16 + +Added the following license SKUs. +``` +1010060005 - Google Workspace Essentials Plus +1010020031 - Google Workspace Frontline Standard +1010340005 - Google Workspace Business Starter - Archived User +1010340006 - Google Workspace Business Standard - Archived User +``` + ### 6.61.15 Added option `contentrestrictions ownerrestricted []` to ``. diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index bde6587a..0f0b97a7 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,6 +2,19 @@ Merged GAM-Team version +6.61.17 + +Updated `gam print|show vaultexports|vaultholds|vaultqueries` to not set a non-zero return code +when a vault matter changes state from `OPEN` to `CLOSED|DELETED` while the command is being processed. + +Updated `gam create shareddrive ou|org|orgunit ` to handle the following error: +``` +ERROR: 403: permissionDenied - Request had insufficient authentication scopes. +``` +It's not clear what causes the error. + +6.61.16 + Added the following license SKUs. ``` 1010060005 - Google Workspace Essentials Plus diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 8371e8b7..098e2824 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -36803,10 +36803,13 @@ def warnMatterNotOpen(v, matter, matterNameId, j, jcount): matterId=matter['matterId'], view='BASIC', fields='state')['state'] except (GAPI.notFound, GAPI.forbidden): matter['state'] = 'Unknown' - printWarningMessage(DATA_NOT_AVALIABLE_RC, formatKeyValueList('', - Ent.FormatEntityValueList([Ent.VAULT_MATTER, matterNameId])+ - [Msg.MATTER_NOT_OPEN.format(matter['state'])], - currentCount(j, jcount))) + else: + setSysExitRC(DATA_NOT_AVALIABLE_RC) + message = formatKeyValueList('', + Ent.FormatEntityValueList([Ent.VAULT_MATTER, matterNameId])+ + [Msg.MATTER_NOT_OPEN.format(matter['state'])], + currentCount(j, jcount)) + writeStderr(f'\n{Ind.Spaces()}{WARNING_PREFIX}{message}\n') def _cleanVaultExport(export, cd): query = export.get('query') @@ -59319,9 +59322,10 @@ def createSharedDrive(users, useDomainAdminAccess=False): try: callGAPI(drive.drives(), 'update', bailOnInternalError=True, - throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.NOT_FOUND, GAPI.FORBIDDEN, GAPI.BAD_REQUEST, + throwReasons=GAPI.DRIVE_USER_THROW_REASONS+[GAPI.NOT_FOUND, GAPI.FORBIDDEN, GAPI.NO_MANAGE_TEAMDRIVE_ADMINISTRATOR_PRIVILEGE, - GAPI.INTERNAL_ERROR, GAPI.FILE_NOT_FOUND], + GAPI.BAD_REQUEST, GAPI.INTERNAL_ERROR, GAPI.PERMISSION_DENIED, + GAPI.FILE_NOT_FOUND], useDomainAdminAccess=useDomainAdminAccess, driveId=driveId, body=updateBody) if not returnIdOnly and not csvPF: entityActionPerformed([Ent.USER, user, Ent.SHAREDDRIVE_ID, driveId], i, count) @@ -59332,7 +59336,7 @@ def createSharedDrive(users, useDomainAdminAccess=False): entityActionFailedWarning([Ent.USER, user, Ent.REQUEST_ID, requestId], str(e), i, count) break waitingForCreationToComplete(retry*15) - except (GAPI.badRequest, GAPI.internalError) as e: + except (GAPI.badRequest, GAPI.internalError, GAPI.permissionDenied) as e: entityActionFailedWarning([Ent.USER, user, Ent.SHAREDDRIVE_ID, driveId], str(e), i, count) break except GAPI.fileNotFound as e: From 438656a5492f6b91174e8fffb21a259ee25a022c Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Sat, 29 Jul 2023 09:17:12 -0700 Subject: [PATCH 11/14] Improved create shareddrive retries --- docs/GamUpdates.md | 15 +++- docs/How-to-Upgrade-from-Standard-GAM.md | 4 +- docs/Shared-Drives.md | 23 ++++-- docs/Users-Drive-Copy-Move.md | 2 +- docs/Users-Drive-Files-Manage.md | 4 +- docs/Users-Forms.md | 2 +- docs/Users-Shared-Drives.md | 20 +++-- docs/Version-and-Help.md | 12 +-- docs~ | 94 ++++++++++++++++++++++++ src/GamCommands.txt | 80 +++++++++++--------- src/GamUpdate.txt | 11 +++ src/gam/__init__.py | 36 ++++++--- 12 files changed, 229 insertions(+), 74 deletions(-) create mode 100644 docs~ diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index d2ce51ee..f82ced12 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -10,7 +10,18 @@ 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.61.17 +### 6.61.18 + +Added the following options to `gam [] create shareddrive` to allow better control +of the create/update process when attributes other than `themeid` are specified. +``` +errorretries - Number of create/update error retries; default value 5, range 0-10 +updateinitialdelay - Initial delay after create before update: default value 10, range 0-60 +updateretrydelay - Retry delay when update fails; default value 10, range 0-60 +``` +* See: https://github.com/taers232c/GAMADV-XTD3/wiki/Shared-Drives#create-a-shared-drive + +### 6.61.17 Updated `gam print|show vaultexports|vaultholds|vaultqueries` to not set a non-zero return code when a vault matter changes state from `OPEN` to `CLOSED|DELETED` while the command is being processed. @@ -21,7 +32,7 @@ ERROR: 403: permissionDenied - Request had insufficient authentication scopes. ``` It's not clear what causes the error. -6.61.16 +### 6.61.16 Added the following license SKUs. ``` diff --git a/docs/How-to-Upgrade-from-Standard-GAM.md b/docs/How-to-Upgrade-from-Standard-GAM.md index fb3dc16f..5c4ada88 100644 --- a/docs/How-to-Upgrade-from-Standard-GAM.md +++ b/docs/How-to-Upgrade-from-Standard-GAM.md @@ -329,7 +329,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.61.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.61.18 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.10.8 64-bit final MacOS High Sierra 10.13.6 x86_64 @@ -969,7 +969,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.61.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.61.18 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.11.4 64-bit final Windows-10-10.0.17134 AMD64 diff --git a/docs/Shared-Drives.md b/docs/Shared-Drives.md index db894e78..5b9937da 100644 --- a/docs/Shared-Drives.md +++ b/docs/Shared-Drives.md @@ -206,6 +206,7 @@ gam [] create teamdrive ([customtheme ] [color ])] ( )* [hide ] [ou|org|orgunit ] + [errorretries ] [updateinitialdelay ] [updateretrydelay ] [(csv [todrive *] (addcsvdata )*) | returnidonly] [adminaccess|asadmin] ``` @@ -218,14 +219,20 @@ gam [] create teamdrive * ` ` - Set Shared Drive Restrictions * `hide ` - Set Shared Drive visibility -This option is only available when the command is run as an administrator. -* `ou|org|orgunit ` - See: https://workspaceupdates.googleblog.com/2022/05/shared-drives-in-organizational-units-open-beta.html - If any attributes other than `themeid` are specified, GAM must create the Drive and then update the Drive attributes. Even though the Create API returns success, the Update API fails and reports that the Drive does not exist. -For this reason, GAM waits 30 seconds after the create before attempting the update. GAM repeats the update -with waits of 15, 30, and 45 seconds if the Update API continues to fail. This is acceptable when creating -a single Shared Drive, for bulk Shared Drive creation see [Bulk Create Shared Drives](#bulk-create-shared-drives). +* `errorretries ` - Number of create/update error retries; default value 5, range 0-10 +* `updateinitialdelay ` - Initial delay after create before update: default value 10, range 0-60 +* `updateretrydelay ` - Retry delay when update fails; default value 10, range 0-60 + +For this reason, GAM waits `updateinitialdelay ` seconds after the create before attempting the update. +GAM repeats the update `errorretries ` times waiting `updateretrydelay ` between tries +if the Update API continues to fail. + +This is acceptable when creating a single Shared Drive, for bulk Shared Drive creation see [Bulk Create Shared Drives](#bulk-create-shared-drives). + +This option is only available when the command is run as an administrator. +* `ou|org|orgunit ` - See: https://workspaceupdates.googleblog.com/2022/05/shared-drives-in-organizational-units-open-beta.html By default, the Google Administrator and Shared Drive name and ID values are displayed on stdout. * `csv [todrive *]` - Write Google Administrator, Shared Drive name and ID values to a CSV file. @@ -236,9 +243,9 @@ When either of these options is chosen, no infomation about Shared Drive restric To retrieve the Shared Drive ID with `returnidonly`: ``` Linux/MacOS -teamDriveId=`gam create teamdrive ... returnidonly` +teamDriveId=$(gam create teamdrive ... returnidonly) Windows PowerShell -$teamDriveId = & gam create teamdrive ... returnidonly` +$teamDriveId = & gam create teamdrive ... returnidonly ``` ## Bulk Create Shared Drives diff --git a/docs/Users-Drive-Copy-Move.md b/docs/Users-Drive-Copy-Move.md index 9391b3e3..d6a3a07a 100644 --- a/docs/Users-Drive-Copy-Move.md +++ b/docs/Users-Drive-Copy-Move.md @@ -308,7 +308,7 @@ When copying folders, the option is only useful when copying a folder without re To retrieve the file ID with `returnidonly`: ``` Linux/MacOS -fileId=gam user user@domain.com copy drivefile ... returnidonly +fileId=$(gam user user@domain.com copy drivefile ... returnidonly) Windows PowerShell $fileId = & gam user user@domain.com copy drivefile ... returnidonly ``` diff --git a/docs/Users-Drive-Files-Manage.md b/docs/Users-Drive-Files-Manage.md index 8779324a..a2cc5659 100644 --- a/docs/Users-Drive-Files-Manage.md +++ b/docs/Users-Drive-Files-Manage.md @@ -213,7 +213,7 @@ Alternatively, you can direct the output to a CSV file: To retrieve the file ID with `returnidonly`: ``` Linux/MacOS -fileId=`gam user user@domain.com create drivefile ... returnidonly` +fileId=$(gam user user@domain.com create drivefile ... returnidonly) Windows PowerShell $fileId = & gam user user@domain.com create drivefile ... returnidonly ``` @@ -511,7 +511,7 @@ By default, the user, file name, updated file name and id values are displayed o To retrieve the file ID with `returnidonly`: ``` Linux/MacOS -fileId=`gam user user@domain.com update drivefile copy ... returnidonly` +fileId=$(gam user user@domain.com update drivefile copy ... returnidonly) Windows PowerShell $fileId = & gam user user@domain.com update drivefile copy ... returnidonly ``` diff --git a/docs/Users-Forms.md b/docs/Users-Forms.md index 8f392606..c9042dff 100644 --- a/docs/Users-Forms.md +++ b/docs/Users-Forms.md @@ -60,7 +60,7 @@ By default, the user, form title and file name/ID values are displayed on stdout To retrieve the file ID with `returnidonly`: ``` Linux/MacOS -fileId=`gam user user@domain.com create form title "xyz" ... returnidonly` +fileId=$(gam user user@domain.com create form title "xyz" ... returnidonly) Windows PowerShell $fileId = & gam user user@domain.com create form title "xyz" ... returnidonly ``` diff --git a/docs/Users-Shared-Drives.md b/docs/Users-Shared-Drives.md index 8d99deb7..593e464a 100644 --- a/docs/Users-Shared-Drives.md +++ b/docs/Users-Shared-Drives.md @@ -181,6 +181,7 @@ gam create teamdrive ([customtheme ] [color ])] ( )* [hide ] [ou|org|orgunit ] + [errorretries ] [updateinitialdelay ] [updateretrydelay ] [(csv [todrive *] (addcsvdata )*) | returnidonly] ``` * `themeid` - a Shared Drive themeId obtained from `show teamdrivethemes` @@ -191,12 +192,21 @@ gam create teamdrive * `color` - set the Shared Drive color * ` ` - Set Shared Drive Restrictions * `hide ` - Set Shared Drive visibility -* `ou|org|orgunit ` - See: https://workspaceupdates.googleblog.com/2022/05/shared-drives-in-organizational-units-open-beta.html If any attributes other than `themeid` are specified, GAM must create the Drive and then update the Drive attributes. Even though the Create API returns success, the Update API fails and reports that the Drive does not exist. -For this reason, GAM waits 30 seconds after the create before attempting the update. GAM repeats the update -with waits of 15, 30, and 45 seconds if the Update API continues to fail. +* `errorretries ` - Number of create/update error retries; default value 5, range 0-10 +* `updateinitialdelay ` - Initial delay after create before update: default value 10, range 0-60 +* `updateretrydelay ` - Retry delay when update fails; default value 10, range 0-60 + +For this reason, GAM waits `updateinitialdelay ` seconds after the create before attempting the update. +GAM repeats the update `errorretries ` times waiting `updateretrydelay ` between tries +if the Update API continues to fail. + +This is acceptable when creating a single Shared Drive, for bulk Shared Drive creation see [Bulk Create Shared Drives](#bulk-create-shared-drives). + +This option is only available when the command is run as an administrator. +* `ou|org|orgunit ` - See: https://workspaceupdates.googleblog.com/2022/05/shared-drives-in-organizational-units-open-beta.html By default, the user and Shared Drive name and ID values are displayed on stdout. * `csv [todrive *]` - Write user, Shared Drive name and ID values to a CSV file. @@ -207,9 +217,9 @@ When either of these options is chosen, no infomation about Shared Drive restric To retrieve the Shared Drive ID with `returnidonly`: ``` Linux/MacOS -teamDriveId=`gam user user@domain.com create teamdrive ... returnidonly` +teamDriveId=$(gam user user@domain.com create teamdrive ... returnidonly) Windows PowerShell -$teamDriveId = & gam user user@domain.com create teamdrive ... returnidonly` +$teamDriveId = & gam user user@domain.com create teamdrive ... returnidonly ``` ## Bulk Create Shared Drives diff --git a/docs/Version-and-Help.md b/docs/Version-and-Help.md index 358bd4c3..5da6dc04 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.61.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.61.18 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.11.4 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.61.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.61.18 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.11.4 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.61.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.61.18 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.11.4 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.61.14 + Latest: 6.61.18 echo $? 1 ``` @@ -72,7 +72,7 @@ echo $? Print the current version number without details ``` gam version simple -6.61.14 +6.61.18 ``` 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.61.14 - https://github.com/taers232c/GAMADV-XTD3 +GAM 6.61.18 - https://github.com/taers232c/GAMADV-XTD3 Ross Scroggs Python 3.11.4 64-bit final MacOS Monterey 12.6.6 x86_64 diff --git a/docs~ b/docs~ new file mode 100644 index 00000000..5da6dc04 --- /dev/null +++ b/docs~ @@ -0,0 +1,94 @@ +# Version and Help + +Print the current version of Gam with details +``` +gam version +GAMADV-XTD3 6.61.18 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +Ross Scroggs +Python 3.11.4 64-bit final +MacOS Monterey 12.6.6 x86_64 +Path: /Users/Admin/bin/gamadv-xtd3 +Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, customer_id: my_customer, domain.com +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.61.18 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +Ross Scroggs +Python 3.11.4 64-bit final +MacOS Monterey 12.6.6 x86_64 +Path: /Users/Admin/bin/gamadv-xtd3 +Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, customer_id: my_customer, domain.com +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.61.18 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +Ross Scroggs +Python 3.11.4 64-bit final +MacOS Monterey 12.6.6 x86_64 +Path: /Users/Admin/bin/gamadv-xtd3 +Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, customer_id: my_customer, domain.com +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.0 +google-api-python-client 2.88.0 +google-auth-httplib2 0.1.0 +google-auth-oauthlib 1.0.0 +google-auth 2.19.1 +httplib2 0.22.0 +passlib 1.7.4 +python-dateutil 2.8.2 +yubikey-manager 5.1.1 +admin.googleapis.com connects using TLSv1.3 TLS_AES_256_GCM_SHA384 +``` + +Print the current and latest versions of Gam and: +* set the return code to 0 if the current version is the latest version +* set the return code to 1 if the current version is not the latest +``` +gam version checkrc +GAM 5.35.08 - https://github.com/taers232c/GAMADV-XTD3 +Ross Scroggs +Python 3.8.1 64-bit final +google-api-python-client 2.77.0 +httplib2 0.16.0 +oauth2client 4.1.3 +MacOS High Sierra 10.13.6 x86_64 +Path: /Users/Admin/bin/gamadv-xtd3 +Version Check: + Current: 5.35.08 + Latest: 6.61.18 +echo $? +1 +``` + +Print the current version number without details +``` +gam version simple +6.61.18 +``` +In Linux/MacOS you can do: +``` +VER=`gam version simple` +echo $VER +``` +Print the current version of Gam and address of this Wiki +``` +gam help +GAM 6.61.18 - https://github.com/taers232c/GAMADV-XTD3 +Ross Scroggs +Python 3.11.4 64-bit final +MacOS Monterey 12.6.6 x86_64 +Path: /Users/Admin/bin/gamadv-xtd3 +Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, customer_id: my_customer, domain.com +Time: 2023-06-02T21:10:00-07:00 +Help: Syntax in file /Users/Admin/bin/gamadv-xtd3/GamCommands.txt +Help: Documentation is at https://github.com/taers232c/GAMADV-XTD3/wiki +``` diff --git a/src/GamCommands.txt b/src/GamCommands.txt index 736661de..ae16f943 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -290,14 +290,18 @@ If an item contains spaces, it should be surrounded by ". wsbizplus | workspacebusinessplus | 1010020025 | wsbizplusarchived | workspacebusinessplusarchived | 1010340003 | wsbizstan | workspacebusinessstandard | 1010020028 | + wsbizstanarchived | workspacebusinessstandardarchived | 1010340006 | wsbizstarter | workspacebusinessstarter | wsbizstart | 1010020027 | + wsbizstarterarchived | workspacebusinessstarterarchived | 1010340005 | wsentess | workspaceenterpriseessentials | 1010060003 | wsentplus | workspaceenterpriseplus | gae | gse | enterprise | gsuiteenterprise | 1010020020 | wsentstan | workspaceenterprisestandard | 1010020026 | wsentstanarchived | workspaceenterprisestandardarchived | 1010340004 | wsentstarter | workspaceenterprisestarter | 1010020029 | wes | wsess | workspaceesentials | gsuiteessentials | essentials | d4e | driveenterprise | drive4enterprise | 1010060001 | - wsflw | workspacefrontline | workspacefrontlineworker | 1010020030 + wsessplus | workspaceessentialsplus | 1010060005 | + wsflw | workspacefrontline | workspacefrontlineworker | 1010020030 | + wsflwstan | workspacefrontlinestan | workspacefrontlineworkerstan | 1010020031 ## Items built from primitives @@ -4410,7 +4414,7 @@ gam [] info siteacls gam [] show siteacls gam [] print siteacls [todrive *] -# Shared Drives +# Shared Drives - Administrator ::= backgroundimagefile| @@ -4442,30 +4446,31 @@ sharingfoldersrequiresorganizerpermission true In these commands, the Google administrator named in oauth2.txt is used. -gam show teamdrivethemes -gam create|add teamdrive +gam show shareddrivethemes +gam create shareddrive [(theme|themeid ) | ([customtheme ] [color ])] ( )* [hide|hidden ] [ou|org|orgunit ] + [errorretries ] [updateinitialdelay ] [updateretrydelay ] [(csv [todrive *] (addcsvdata )*) | returnidonly] -gam update teamdrive [name ] +gam update shareddrive [name ] [(theme|themeid ) | ([customtheme ] [color ])] ( )* [hide|hidden ] [ou|org|orgunit ] -gam delete teamdrive +gam delete shareddrive [adminaccess|asadmin] [allowitemdeletion] -gam hide teamdrive -gam unhide teamdrive -gam info teamdrive [fields ] +gam hide shareddrive +gam unhide shareddrive +gam info shareddrive [fields ] [formatjson] -gam show teamdriveinfo [fields ] +gam show shareddriveinfo [fields ] [formatjson] -gam print teamdrives [todrive *] +gam print shareddrives [todrive *] [teamdriveadminquery|query ] [matchname ] [orgunit|org|ou ] [fields ] [noorgunits []] [formatjson [quotechar ]] -gam show teamdrives +gam show shareddrives [teamdriveadminquery|query ] [matchname ] [orgunit|org|ou ] [fields ] [noorgunits []] @@ -4480,24 +4485,29 @@ gam show oushareddrives In these commands, you specify an administrator and then indicate that you want domain administrator access with the adminaccess option. -gam create|add teamdrive adminaccess +gam create shareddrive adminaccess [(theme|themeid ) | ([customtheme ] [color ])] ( )* - [hide ] + [hide|hidden ] [ou|org|orgunit ] + [errorretries ] [updateinitialdelay ] [updateretrydelay ] [(csv [todrive *] (addcsvdata )*) | returnidonly] -gam delete teamdrive +gam update shareddrive asadmin [name ] + [(theme|themeid ) | ([customtheme ] [color ])] + ( )* + [hide|hidden ] [ou|org|orgunit ] +gam delete shareddrive adminaccess [allowitemdeletion] -gam info teamdrive adminaccess [fields ] +gam info shareddrive adminaccess [fields ] [formatjson] -gam show teamdriveinfo adminaccess [fields ] +gam show shareddriveinfo adminaccess [fields ] [formatjson] -gam print teamdrives [todrive *] +gam print shareddrives [todrive *] adminaccess [teamdriveadminquery|query ] [matchname ] [orgunit|org|ou ] (role|roles )* [fields ] [formatjson [quotechar ]] -gam show teamdrives +gam show shareddrives adminaccess [teamdriveadminquery|query ] [matchname ] [orgunit|org|ou ] (role|roles )* @@ -7355,7 +7365,7 @@ gam show tasklists gam print tasklists [todrive *] [countsonly | (formatjson [quotechar ])] -# Users - Team Drives +# Users - Shared Drives ::= adminmanagedrestrictions| @@ -7373,32 +7383,32 @@ sharingfoldersrequiresorganizerpermission false allowcontentmanagerstosharefolders false sharingfoldersrequiresorganizerpermission true -gam show teamdrivethemes -gam create|add teamdrive [adminaccess|asadmin] +gam show shareddrivethemes +gam create shareddrive [(theme|themeid ) | ([customtheme ] [color ])] ( )* - [hide|hidden ] [ou|org|orgunit ] -gam update teamdrive [adminaccess|asadmin] [name ] + [hide|hidden ] + [errorretries ] [updateinitialdelay ] [updateretrydelay ] + [(csv [todrive *] (addcsvdata )*) | returnidonly] +gam update shareddrive [name ] [(theme|themeid ) | ([customtheme ] [color ])] ( )* - [hide|hidden ] [ou|org|orgunit ] -gam delete teamdrive - [adminaccess|asadmin] [allowitemdeletion] -gam hide teamdrive -gam unhide teamdrive -gam info teamdrive [fields ] + [hide|hidden ] +gam delete shareddrive + [allowitemdeletion] +gam hide shareddrive +gam unhide shareddrive +gam info shareddrive [fields ] [formatjson] -gam info teamdrive [fields ] +gam show shareddriveinfo [fields ] [formatjson] -gam show teamdriveinfo [fields ] - [formatjson] -gam print teamdrives [todrive *] +gam print shareddrives [todrive *] [adminaccess|asadmin [teamdriveadminquery|query ]] [matchname ] [orgunit|org|ou ] (role|roles )* [fields ] [noorgunits []] [formatjson [quotechar ]] -gam show teamdrives +gam show shareddrives [adminaccess|asadmin [teamdriveadminquery|query ]] [matchname ] [orgunit|org|ou ] (role|roles )* diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index 0f0b97a7..5cc33023 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,6 +2,17 @@ Merged GAM-Team version +6.61.18 + +Added the following options to `gam [] create shareddrive` to allow better control +of the create/update process when attributes other than `themeid` are specified. +``` +errorretries - Number of create/update error retries; default value 5, range 0-10 +updateinitialdelay - Initial delay after create before update: default value 10, range 0-60 +updateretrydelay - Retry delay when update fails; default value 10, range 0-60 +``` +* See: https://github.com/taers232c/GAMADV-XTD3/wiki/Shared-Drives#create-a-shared-drive + 6.61.17 Updated `gam print|show vaultexports|vaultholds|vaultqueries` to not set a non-zero return code diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 098e2824..b19e1788 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -59201,7 +59201,7 @@ def _getSharedDriveRestrictions(myarg, body): return True return False -def _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci=None): +def _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci, returnIdOnly): action = Act.Get() name = f'orgUnits/-/memberships/shared_drive;{driveId}' if ci is None: @@ -59211,8 +59211,9 @@ def _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci=None): try: callGAPI(ci.orgUnits().memberships(), 'move', name=name, body=cibody) - Act.Set(Act.MOVE) - entityModifierNewValueActionPerformed([Ent.SHAREDDRIVE, driveId], Act.MODIFIER_TO, f'{Ent.Singular(Ent.ORGANIZATIONAL_UNIT)}: {orgUnit}', i, count) + if not returnIdOnly: + Act.Set(Act.MOVE) + entityModifierNewValueActionPerformed([Ent.SHAREDDRIVE, driveId], Act.MODIFIER_TO, f'{Ent.Singular(Ent.ORGANIZATIONAL_UNIT)}: {orgUnit}', i, count) except (GAPI.notFound, GAPI.forbidden, GAPI.badRequest, GAPI.internalError, GAPI.noManageTeamDriveAdministratorPrivilege) as e: entityActionFailedWarning([Ent.USER, user, Ent.SHAREDDRIVE_ID, driveId], str(e), i, count) @@ -59225,10 +59226,11 @@ def _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci=None): # [(theme|themeid ) | ([customtheme ] [color ])] # ( )* # [hide|hidden ] [ou|org|orgunit ] +# [errorretries ] [updateinitialdelay ] [updateretrydelay ] # [(csv [todrive *] (addcsvdata )*) | returnidonly] def createSharedDrive(users, useDomainAdminAccess=False): def waitingForCreationToComplete(sleep_time): - writeStdout(Ind.Spaces()+Msg.WAITING_FOR_SHARED_DRIVE_CREATION_TO_COMPLETE_SLEEPING.format(sleep_time)) + writeStderr(Ind.Spaces()+Msg.WAITING_FOR_SHARED_DRIVE_CREATION_TO_COMPLETE_SLEEPING.format(sleep_time)) time.sleep(sleep_time) requestId = str(uuid.uuid4()) @@ -59238,6 +59240,9 @@ def createSharedDrive(users, useDomainAdminAccess=False): addCSVData = {} hide = returnIdOnly = False orgUnit = orgUnitId = ci = None + errorRetries = 5 + updateInitialDelay = 10 + updateRetryDelay = 10 while Cmd.ArgumentsRemaining(): myarg = getArgument() if _getSharedDriveTheme(myarg, body): @@ -59259,6 +59264,12 @@ def createSharedDrive(users, useDomainAdminAccess=False): addCSVData[k] = getString(Cmd.OB_STRING, minLen=0) elif myarg in ADMIN_ACCESS_OPTIONS: useDomainAdminAccess = True + elif myarg == 'errorretries': + errorRetries = getInteger(minVal=0, maxVal=10) + elif myarg == 'updateinitialdelay': + updateInitialDelay = getInteger(minVal=0, maxVal=60) + elif myarg == 'updateretrydelay': + updateRetryDelay = getInteger(minVal=0, maxVal=60) else: unknownArgumentExit() if csvPF: @@ -59299,7 +59310,7 @@ def createSharedDrive(users, useDomainAdminAccess=False): break except (GAPI.transientError, GAPI.teamDriveAlreadyExists) as e: retry += 1 - if retry > 3: + if retry > errorRetries: entityActionFailedWarning([Ent.USER, user, Ent.REQUEST_ID, requestId], str(e), i, count) break requestId = str(uuid.uuid4()) @@ -59313,7 +59324,8 @@ def createSharedDrive(users, useDomainAdminAccess=False): userSvcNotApplicableOrDriveDisabled(user, str(e), i, count) break if doUpdate and (updateBody or hide or orgUnit): - waitingForCreationToComplete(30) + if updateBody or hide: + waitingForCreationToComplete(updateInitialDelay) try: if updateBody: Act.Set(Act.UPDATE) @@ -59332,10 +59344,10 @@ def createSharedDrive(users, useDomainAdminAccess=False): break except GAPI.notFound as e: retry += 1 - if retry > 3: + if retry > errorRetries: entityActionFailedWarning([Ent.USER, user, Ent.REQUEST_ID, requestId], str(e), i, count) break - waitingForCreationToComplete(retry*15) + waitingForCreationToComplete(updateRetryDelay) except (GAPI.badRequest, GAPI.internalError, GAPI.permissionDenied) as e: entityActionFailedWarning([Ent.USER, user, Ent.SHAREDDRIVE_ID, driveId], str(e), i, count) break @@ -59357,12 +59369,12 @@ def createSharedDrive(users, useDomainAdminAccess=False): break except GAPI.notFound as e: retry += 1 - if retry > 3: + if retry > errorRetries: entityActionFailedWarning([Ent.USER, user, Ent.REQUEST_ID, requestId], str(e), i, count) break - time.sleep(retry*retry) + waitingForCreationToComplete(updateRetryDelay) if orgUnit: - ci = _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci) + ci = _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci, returnIdOnly) except (GAPI.forbidden, GAPI.badRequest, GAPI.noManageTeamDriveAdministratorPrivilege) as e: entityActionFailedWarning([Ent.USER, user, Ent.SHAREDDRIVE_ID, driveId], str(e), i, count) except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e: @@ -59431,7 +59443,7 @@ def updateSharedDrive(users, useDomainAdminAccess=False): driveId=driveId) entityActionPerformed([Ent.USER, user, Ent.SHAREDDRIVE_ID, driveId], i, count) if orgUnit: - ci = _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci) + ci = _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci, False) except (GAPI.notFound, GAPI.forbidden, GAPI.badRequest, GAPI.internalError, GAPI.noManageTeamDriveAdministratorPrivilege) as e: entityActionFailedWarning([Ent.USER, user, Ent.SHAREDDRIVE_ID, driveId], str(e), i, count) From 750397e213a8bfee5c7b01c967411468a6acbf6a Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Mon, 31 Jul 2023 07:53:42 -0700 Subject: [PATCH 12/14] Two small updates * - Trap targetUserRoleLimitedByLicenseRestriction * - Update print|show chatmembers, avoid GAMADV-XTD3 bug --- docs/GamUpdates.md | 4 ++++ src/GamUpdate.txt | 4 ++++ src/gam/__init__.py | 32 +++++++++++++++++--------------- src/gam/gamlib/glgapi.py | 12 ++++++++++-- 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index f82ced12..d4daf24c 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -10,6 +10,10 @@ 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.61.19 + +Fixed bug in `gam print|show chatmembers ` that caused a trap. + ### 6.61.18 Added the following options to `gam [] create shareddrive` to allow better control diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index 5cc33023..46bee705 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,6 +2,10 @@ Merged GAM-Team version +6.61.19 + +Fixed bug in `gam print|show chatmembers ` that caused a trap. + 6.61.18 Added the following options to `gam [] create shareddrive` to allow better control diff --git a/src/gam/__init__.py b/src/gam/__init__.py index b19e1788..e05bafe8 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -8389,7 +8389,7 @@ class CSVPrintFile(): except (GAPI.badRequest, GAPI.invalid, GAPI.fileNotFound, GAPI.forbidden, GAPI.internalError, GAPI.insufficientFilePermissions, GAPI.insufficientParentPermissions, GAPI.unknownError, GAPI.ownershipChangeAcrossDomainNotPermitted, GAPI.teamDriveDomainUsersOnlyRestriction, GAPI.teamDriveTeamMembersOnlyRestriction, - GAPI.insufficientAdministratorPrivileges, GAPI.sharingRateLimitExceeded, + GAPI.targetUserRoleLimitedByLicenseRestriction, GAPI.insufficientAdministratorPrivileges, GAPI.sharingRateLimitExceeded, GAPI.publishOutNotPermitted, GAPI.shareInNotPermitted, GAPI.shareOutNotPermitted, GAPI.shareOutNotPermittedToUser, GAPI.cannotShareTeamDriveTopFolderWithAnyoneOrDomains, GAPI.cannotShareTeamDriveWithNonGoogleAccounts, GAPI.ownerOnTeamDriveItemNotSupported, @@ -24751,10 +24751,10 @@ def doInfoChatMember(): infoChatMember([None]) # gam [] show chatmembers -# [showinvited []] [filter ] +# [showinvited []] [showgroups []] [filter ] # [formatjson] # gam [] print chatmembers [todrive *] -# [showinvited []] [filter ] +# [showinvited []] [showgroups []] [filter ] # [formatjson [quotechar ]] def printShowChatMembers(users): def _printChatMember(user, member): @@ -24773,8 +24773,8 @@ def printShowChatMembers(users): cd = buildGAPIObject(API.DIRECTORY) csvPF = CSVPrintFile(['User', 'name'] if not isinstance(users, list) else ['name']) if Act.csvFormat() else None FJQC = FormatJSONQuoteChar(csvPF) - parent = pfilter = None - showInvited = False + kwargs = {} + parent = None while Cmd.ArgumentsRemaining(): myarg = getArgument() if csvPF and myarg == 'todrive': @@ -24782,16 +24782,18 @@ def printShowChatMembers(users): elif myarg == 'space' or myarg.startswith('spaces/'): parent = getChatSpace(myarg) elif myarg == 'showinvited': - showInvited = getBoolean() + kwargs['showInvited'] = getBoolean() + elif myarg == 'showgroups': + kwargs['showGroups'] = getBoolean() elif myarg =='filter': - pfilter = getString(Cmd.OB_STRING) + kwargs['filter'] = getString(Cmd.OB_STRING) else: FJQC.GetFormatJSONQuoteChar(myarg, True) if not parent: missingArgumentExit('space') qfilter = f'{Ent.Singular(Ent.CHAT_SPACE)}: {parent}' - if pfilter: - qfilter += f', {pfilter}' + if 'filter' in kwargs: + qfilter += f', {kwargs["filter"]}' i, count, users = getEntityArgument(users) for user in users: i += 1 @@ -24802,7 +24804,7 @@ def printShowChatMembers(users): members = callGAPIpages(chat.spaces().members(), 'list', 'memberships', pageMessage=_getChatPageMessage(Ent.CHAT_MEMBER, user, i, count, qfilter), throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.PERMISSION_DENIED], - pageSize=CHAT_PAGE_SIZE, parent=parent, filter=pfilter, showInvited=showInvited) + pageSize=CHAT_PAGE_SIZE, parent=parent, **kwargs) for member in members: _getChatMemberEmail(cd, member) except (GAPI.notFound, GAPI.invalidArgument, GAPI.permissionDenied) as e: @@ -53924,7 +53926,7 @@ def _copyPermissions(drive, user, i, count, j, jcount, except (GAPI.badRequest, GAPI.invalid, GAPI.fileNotFound, GAPI.forbidden, GAPI.internalError, GAPI.insufficientFilePermissions, GAPI.unknownError, GAPI.ownershipChangeAcrossDomainNotPermitted, GAPI.teamDriveDomainUsersOnlyRestriction, GAPI.teamDriveTeamMembersOnlyRestriction, - GAPI.insufficientAdministratorPrivileges, GAPI.sharingRateLimitExceeded, + GAPI.targetUserRoleLimitedByLicenseRestriction, GAPI.insufficientAdministratorPrivileges, GAPI.sharingRateLimitExceeded, GAPI.publishOutNotPermitted, GAPI.shareInNotPermitted, GAPI.shareOutNotPermitted, GAPI.shareOutNotPermittedToUser, GAPI.cannotShareTeamDriveTopFolderWithAnyoneOrDomains, GAPI.cannotShareTeamDriveWithNonGoogleAccounts, GAPI.ownerOnTeamDriveItemNotSupported, @@ -54977,7 +54979,7 @@ def _updateMoveFilePermissions(drive, user, i, count, except (GAPI.badRequest, GAPI.invalid, GAPI.fileNotFound, GAPI.forbidden, GAPI.internalError, GAPI.insufficientFilePermissions, GAPI.unknownError, GAPI.ownershipChangeAcrossDomainNotPermitted, GAPI.teamDriveDomainUsersOnlyRestriction, GAPI.teamDriveTeamMembersOnlyRestriction, - GAPI.insufficientAdministratorPrivileges, GAPI.sharingRateLimitExceeded, + GAPI.targetUserRoleLimitedByLicenseRestriction, GAPI.insufficientAdministratorPrivileges, GAPI.sharingRateLimitExceeded, GAPI.publishOutNotPermitted, GAPI.shareInNotPermitted, GAPI.shareOutNotPermitted, GAPI.shareOutNotPermittedToUser, GAPI.cannotShareTeamDriveTopFolderWithAnyoneOrDomains, GAPI.cannotShareTeamDriveWithNonGoogleAccounts, GAPI.ownerOnTeamDriveItemNotSupported, @@ -57961,7 +57963,7 @@ def createDriveFileACL(users, useDomainAdminAccess=False): GAPI.cannotSetExpiration, GAPI.insufficientFilePermissions, GAPI.unknownError, GAPI.ownershipChangeAcrossDomainNotPermitted, GAPI.teamDriveDomainUsersOnlyRestriction, GAPI.teamDriveTeamMembersOnlyRestriction, - GAPI.insufficientAdministratorPrivileges, GAPI.sharingRateLimitExceeded, + GAPI.targetUserRoleLimitedByLicenseRestriction, GAPI.insufficientAdministratorPrivileges, GAPI.sharingRateLimitExceeded, GAPI.publishOutNotPermitted, GAPI.shareInNotPermitted, GAPI.shareOutNotPermitted, GAPI.shareOutNotPermittedToUser, GAPI.cannotShareTeamDriveTopFolderWithAnyoneOrDomains, GAPI.cannotShareTeamDriveWithNonGoogleAccounts, GAPI.ownerOnTeamDriveItemNotSupported, @@ -58090,7 +58092,7 @@ def updateDriveFileACLs(users, useDomainAdminAccess=False): GAPI.cannotSetExpiration, GAPI.badRequest, GAPI.invalidOwnershipTransfer, GAPI.cannotRemoveOwner, GAPI.fileNeverWritable, GAPI.ownershipChangeAcrossDomainNotPermitted, GAPI.sharingRateLimitExceeded, - GAPI.insufficientAdministratorPrivileges, + GAPI.targetUserRoleLimitedByLicenseRestriction, GAPI.insufficientAdministratorPrivileges, GAPI.publishOutNotPermitted, GAPI.shareInNotPermitted, GAPI.shareOutNotPermitted, GAPI.shareOutNotPermittedToUser, GAPI.organizerOnNonTeamDriveItemNotSupported, GAPI.fileOrganizerOnNonTeamDriveNotSupported, GAPI.cannotUpdatePermission, GAPI.cannotModifyInheritedTeamDrivePermission, GAPI.fieldNotWritable) as e: @@ -58189,7 +58191,7 @@ def createDriveFilePermissions(users, useDomainAdminAccess=False): except (GAPI.badRequest, GAPI.invalid, GAPI.fileNotFound, GAPI.forbidden, GAPI.internalError, GAPI.insufficientFilePermissions, GAPI.unknownError, GAPI.ownershipChangeAcrossDomainNotPermitted, GAPI.teamDriveDomainUsersOnlyRestriction, GAPI.teamDriveTeamMembersOnlyRestriction, - GAPI.insufficientAdministratorPrivileges, GAPI.sharingRateLimitExceeded, + GAPI.targetUserRoleLimitedByLicenseRestriction, GAPI.insufficientAdministratorPrivileges, GAPI.sharingRateLimitExceeded, GAPI.publishOutNotPermitted, GAPI.shareInNotPermitted, GAPI.shareOutNotPermitted, GAPI.shareOutNotPermittedToUser, GAPI.cannotShareTeamDriveTopFolderWithAnyoneOrDomains, GAPI.cannotShareTeamDriveWithNonGoogleAccounts, GAPI.ownerOnTeamDriveItemNotSupported, diff --git a/src/gam/gamlib/glgapi.py b/src/gam/gamlib/glgapi.py index 3da3b1fd..eedf06b4 100644 --- a/src/gam/gamlib/glgapi.py +++ b/src/gam/gamlib/glgapi.py @@ -111,6 +111,7 @@ LABEL_MUTATION_ILLEGAL_SELECTION = 'labelMutationIllegalSelection' LABEL_MUTATION_UNKNOWN_FIELD = 'labelMutationUnknownField' LIMIT_EXCEEDED = 'limitExceeded' LOGIN_REQUIRED = 'loginRequired' +MALFORMED_WORKING_LOCATION_EVENT = 'malformedWorkingLocationEvent' MEMBER_NOT_FOUND = 'memberNotFound' NO_LIST_TEAMDRIVES_ADMINISTRATOR_PRIVILEGE = 'noListTeamDrivesAdministratorPrivilege' NO_MANAGE_TEAMDRIVE_ADMINISTRATOR_PRIVILEGE = 'noManageTeamDriveAdministratorPrivilege' @@ -149,6 +150,7 @@ SHARING_RATE_LIMIT_EXCEEDED = 'sharingRateLimitExceeded' SHORTCUT_TARGET_INVALID = 'shortcutTargetInvalid' STORAGE_QUOTA_EXCEEDED = 'storageQuotaExceeded' SYSTEM_ERROR = 'systemError' +TARGET_USER_ROLE_LIMITED_BY_LICENSE_RESTRICTION = 'targetUserRoleLimitedByLicenseRestriction' TEAMDRIVE_ALREADY_EXISTS = 'teamDriveAlreadyExists' TEAMDRIVE_DOMAIN_USERS_ONLY_RESTRICTION = 'teamDriveDomainUsersOnlyRestriction' TEAMDRIVE_TEAM_MEMBERS_ONLY_RESTRICTION = 'teamDriveTeamMembersOnlyRestriction' @@ -196,7 +198,7 @@ DRIVE_COPY_THROW_REASONS = DRIVE_ACCESS_THROW_REASONS+[CANNOT_COPY_FILE, BAD_REQ DRIVE_GET_THROW_REASONS = DRIVE_USER_THROW_REASONS+[FILE_NOT_FOUND] DRIVE3_CREATE_ACL_THROW_REASONS = [BAD_REQUEST, INVALID, INVALID_SHARING_REQUEST, OWNERSHIP_CHANGE_ACROSS_DOMAIN_NOT_PERMITTED, CANNOT_SET_EXPIRATION, NOT_FOUND, TEAMDRIVE_DOMAIN_USERS_ONLY_RESTRICTION, TEAMDRIVE_TEAM_MEMBERS_ONLY_RESTRICTION, - INSUFFICIENT_ADMINISTRATOR_PRIVILEGES, SHARING_RATE_LIMIT_EXCEEDED, + TARGET_USER_ROLE_LIMITED_BY_LICENSE_RESTRICTION, INSUFFICIENT_ADMINISTRATOR_PRIVILEGES, SHARING_RATE_LIMIT_EXCEEDED, PUBLISH_OUT_NOT_PERMITTED, SHARE_IN_NOT_PERMITTED, SHARE_OUT_NOT_PERMITTED, SHARE_OUT_NOT_PERMITTED_TO_USER, CANNOT_SHARE_TEAMDRIVE_TOPFOLDER_WITH_ANYONEORDOMAINS, CANNOT_SHARE_TEAMDRIVE_WITH_NONGOOGLE_ACCOUNTS, @@ -213,7 +215,7 @@ DRIVE3_GET_ACL_REASONS = DRIVE_USER_THROW_REASONS+[FILE_NOT_FOUND, FORBIDDEN, IN DRIVE3_UPDATE_ACL_THROW_REASONS = [BAD_REQUEST, INVALID_OWNERSHIP_TRANSFER, CANNOT_REMOVE_OWNER, CANNOT_SET_EXPIRATION, OWNERSHIP_CHANGE_ACROSS_DOMAIN_NOT_PERMITTED, NOT_FOUND, TEAMDRIVE_DOMAIN_USERS_ONLY_RESTRICTION, TEAMDRIVE_TEAM_MEMBERS_ONLY_RESTRICTION, - INSUFFICIENT_ADMINISTRATOR_PRIVILEGES, SHARING_RATE_LIMIT_EXCEEDED, + TARGET_USER_ROLE_LIMITED_BY_LICENSE_RESTRICTION, INSUFFICIENT_ADMINISTRATOR_PRIVILEGES, SHARING_RATE_LIMIT_EXCEEDED, PUBLISH_OUT_NOT_PERMITTED, SHARE_IN_NOT_PERMITTED, SHARE_OUT_NOT_PERMITTED, SHARE_OUT_NOT_PERMITTED_TO_USER, CANNOT_SHARE_TEAMDRIVE_TOPFOLDER_WITH_ANYONEORDOMAINS, CANNOT_SHARE_TEAMDRIVE_WITH_NONGOOGLE_ACCOUNTS, @@ -501,6 +503,8 @@ class limitExceeded(Exception): pass class loginRequired(Exception): pass +class malformedWorkingLocationEvent(Exception): + pass class memberNotFound(Exception): pass class noListTeamDrivesAdministratorPrivilege(Exception): @@ -577,6 +581,8 @@ class storageQuotaExceeded(Exception): pass class systemError(Exception): pass +class targetUserRoleLimitedByLicenseRestriction(Exception): + pass class teamDriveAlreadyExists(Exception): pass class teamDriveDomainUsersOnlyRestriction(Exception): @@ -701,6 +707,7 @@ REASON_EXCEPTION_MAP = { LABEL_MUTATION_UNKNOWN_FIELD: labelMutationUnknownField, LIMIT_EXCEEDED: limitExceeded, LOGIN_REQUIRED: loginRequired, + MALFORMED_WORKING_LOCATION_EVENT: malformedWorkingLocationEvent, MEMBER_NOT_FOUND: memberNotFound, NO_LIST_TEAMDRIVES_ADMINISTRATOR_PRIVILEGE: noListTeamDrivesAdministratorPrivilege, NO_MANAGE_TEAMDRIVE_ADMINISTRATOR_PRIVILEGE: noManageTeamDriveAdministratorPrivilege, @@ -739,6 +746,7 @@ REASON_EXCEPTION_MAP = { SHORTCUT_TARGET_INVALID: shortcutTargetInvalid, STORAGE_QUOTA_EXCEEDED: storageQuotaExceeded, SYSTEM_ERROR: systemError, + TARGET_USER_ROLE_LIMITED_BY_LICENSE_RESTRICTION: targetUserRoleLimitedByLicenseRestriction, TEAMDRIVE_ALREADY_EXISTS: teamDriveAlreadyExists, TEAMDRIVE_DOMAIN_USERS_ONLY_RESTRICTION: teamDriveDomainUsersOnlyRestriction, TEAMDRIVE_TEAM_MEMBERS_ONLY_RESTRICTION: teamDriveTeamMembersOnlyRestriction, From 748f2a94173f99e5d545047c974a94c87956a180 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Mon, 31 Jul 2023 12:37:36 -0700 Subject: [PATCH 13/14] Add enable_gcloud_reauth to gam.cfg --- src/gam/gamlib/glcfg.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gam/gamlib/glcfg.py b/src/gam/gamlib/glcfg.py index e58d166b..af43cfb7 100644 --- a/src/gam/gamlib/glcfg.py +++ b/src/gam/gamlib/glcfg.py @@ -149,6 +149,8 @@ DRIVE_V3_NATIVE_NAMES = 'drive_v3_native_names' EMAIL_BATCH_SIZE = 'email_batch_size' # Enable Delegated Admin Service Account ENABLE_DASA = 'enable_dasa' +# Enable Gcloud reauth +ENABLE_GCLOUD_REAUTH = 'enable_gcloud_reauth' # When retrieving lists of calendar events from API, how many should be retrieved in each chunk EVENT_MAX_RESULTS = 'event_max_results' # Path to extra_args.txt @@ -331,6 +333,7 @@ Defaults = { DRIVE_V3_NATIVE_NAMES: TRUE, EMAIL_BATCH_SIZE: '50', ENABLE_DASA: FALSE, + ENABLE_GCLOUD_REAUTH: TRUE, EVENT_MAX_RESULTS: '250', EXTRA_ARGS: '', INTER_BATCH_WAIT: '0', @@ -474,6 +477,7 @@ VAR_INFO = { DRIVE_V3_NATIVE_NAMES: {VAR_TYPE: TYPE_BOOLEAN}, EMAIL_BATCH_SIZE: {VAR_TYPE: TYPE_INTEGER, VAR_LIMITS: (1, 100)}, ENABLE_DASA: {VAR_TYPE: TYPE_BOOLEAN, VAR_SIGFILE: 'enabledasa.txt', VAR_SFFT: (FALSE, TRUE)}, + ENABLE_GCLOUD_REAUTH: {VAR_TYPE: TYPE_BOOLEAN}, EVENT_MAX_RESULTS: {VAR_TYPE: TYPE_INTEGER, VAR_LIMITS: (1, 2500)}, EXTRA_ARGS: {VAR_TYPE: TYPE_FILE, VAR_SIGFILE: FN_EXTRA_ARGS_TXT, VAR_SFFT: ('', FN_EXTRA_ARGS_TXT), VAR_ACCESS: os.R_OK}, INTER_BATCH_WAIT: {VAR_TYPE: TYPE_FLOAT, VAR_LIMITS: (0.0, 60.0)}, From 2705508c4de8f6e0656c11152eaab90a371eae2e Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Mon, 31 Jul 2023 12:46:49 -0700 Subject: [PATCH 14/14] Make default value for enable_gcloud_reauth False --- src/gam/gamlib/glcfg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gam/gamlib/glcfg.py b/src/gam/gamlib/glcfg.py index af43cfb7..7e5b3d74 100644 --- a/src/gam/gamlib/glcfg.py +++ b/src/gam/gamlib/glcfg.py @@ -333,7 +333,7 @@ Defaults = { DRIVE_V3_NATIVE_NAMES: TRUE, EMAIL_BATCH_SIZE: '50', ENABLE_DASA: FALSE, - ENABLE_GCLOUD_REAUTH: TRUE, + ENABLE_GCLOUD_REAUTH: FALSE, EVENT_MAX_RESULTS: '250', EXTRA_ARGS: '', INTER_BATCH_WAIT: '0',