From ebfdf4b0523bf4a5813b42b097c6247b7521ab0e Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Tue, 31 Aug 2021 08:49:55 -0400 Subject: [PATCH 01/15] Update build.yml --- .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 c60ddb13..48d7b69b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,8 +12,8 @@ defaults: working-directory: src env: - BUILD_PYTHON_VERSION: "3.9.6" - MIN_PYTHON_VERSION: "3.9.6" + BUILD_PYTHON_VERSION: "3.9.7" + MIN_PYTHON_VERSION: "3.9.7" BUILD_OPENSSL_VERSION: "1.1.1l" MIN_OPENSSL_VERSION: "1.1.1k" PATCHELF_VERSION: "0.12" From 108990cf068b110cc3830e8c88ee12d5ef829f0e Mon Sep 17 00:00:00 2001 From: Janosh Riebesell Date: Tue, 31 Aug 2021 13:51:51 +0100 Subject: [PATCH 02/15] Fix pip license error + add pip install command to readme (#1419) * fix pip license error, add pip install to readme * fix warning: the 'license_file' option is deprecated, use 'license_files' instead --- README.md | 27 +++++++++++++++++++++++++-- src/setup.cfg | 2 +- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1117a2d4..efc4bdaa 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,46 @@ GAM is a command line tool for Google Workspace (fka G Suite) Administrators to manage domain and user settings quickly and easily. ![Build Status](https://github.com/jay0lee/GAM/workflows/Build%20and%20test%20GAM/badge.svg) + # Quick Start + ## Linux / MacOS + Open a terminal and run: -``` + +```sh bash <(curl -s -S -L https://git.io/install-gam) ``` + this will download GAM, install it and start setup. + +To install with `pip`, run + +```sh +pip install git+https://github.com/jay0lee/GAM.git#subdirectory=src +``` + +This will only download and install GAM. To start setup, simply invoke the `gam` CLI. + ## Windows + Download the MSI Installer from the [GitHub Releases] page. Install the MSI and you'll be prompted to setup GAM. + # Documentation + The GAM documentation is hosted in the [GitHub Wiki] + # Mailing List / Discussion group + The GAM mailing list / discussion group is hosted on [Google Groups]. You can join the list and interact via email, or just post from the web itself. + # Chat Room + There is a public chat room hosted in Google Chat. [Instructions to join](https://git.io/gam-chat). + # Author -GAM is maintained by Jay Lee. Please direct "how do I?" questions to [Google Groups]. + +GAM is maintained by [Jay Lee](mailto:jay0lee@gmail.com). Please direct "how do I?" questions to [Google Groups]. [GAM release]: https://git.io/gamreleases [GitHub Releases]: https://github.com/jay0lee/GAM/releases diff --git a/src/setup.cfg b/src/setup.cfg index a6f5f8e9..bedd5d8a 100644 --- a/src/setup.cfg +++ b/src/setup.cfg @@ -8,7 +8,7 @@ url = https://github.com/jay0lee/GAM author = Jay Lee author_email = jay0lee@gmail.com license = Apache -license_file = src/license.rtf +license_files = LICENSE keywords = google, oauth2, gsuite, google-apps, google-admin-sdk, google-drive, google-cloud, google-calendar, gam, google-api, oauth2-client, google-workspace classifiers = Programming Language :: Python :: 3 From 71075e95bffae9035ff59fc51892a11986982288 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Tue, 31 Aug 2021 08:58:45 -0400 Subject: [PATCH 03/15] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 48d7b69b..b5848638 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ env: MIN_OPENSSL_VERSION: "1.1.1k" PATCHELF_VERSION: "0.12" # PYINSTALLER_VERSION can be full commit hash or version like v4.20 - PYINSTALLER_VERSION: "bcb824c1ad2989855a5fc01d95e5fc693b2f0966" + PYINSTALLER_VERSION: "5a02f55c696f16b98f23a8b487f3daa8f644a8d2" jobs: build: From 7378b9d84316764587685daa3d9edf6f5c77f091 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Tue, 31 Aug 2021 09:10:22 -0400 Subject: [PATCH 04/15] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b5848638..1b3b042f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,7 +97,7 @@ jobs: path: | ~/python ~/ssl - key: ${{ matrix.os }}-${{ matrix.jid }}-20210628 + key: ${{ matrix.os }}-${{ matrix.jid }}-20210831 - name: Set env variables env: From 28dade2a34be16c8d63269e40e1e9d424d3e2941 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Tue, 31 Aug 2021 09:18:23 -0400 Subject: [PATCH 05/15] Update build.yml --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b3b042f..2015c67d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -184,6 +184,12 @@ jobs: $python ./waf all $TARGETARCH cd .. fi + + # fix TLS errors by grabbing Digicert CA directly + curl -o digicert.crt https://cacerts.digicert.com/DigiCertHighAssuranceEVRootCA.crt + openssl x509 -in digicert.crt -out digicert.pem + export PIP_CERT= digicert.pem + $python setup.py install #$pip install pyinstaller From f022ffdff486ab5d07d6d4b34f7892495e73e665 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Tue, 31 Aug 2021 09:25:13 -0400 Subject: [PATCH 06/15] Update build.yml --- .github/workflows/build.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2015c67d..b18a0644 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -166,6 +166,7 @@ jobs: echo "pip=$pip" >> $GITHUB_ENV echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV echo -e "Python: $python\nPip: $pip\nLD_LIB...: $LD_LIBRARY_PATH" + $pip install --upgrade pip $pip install wheel export url="https://codeload.github.com/pyinstaller/pyinstaller/tar.gz/${PYINSTALLER_VERSION}" echo "Downloading ${url}" @@ -184,12 +185,6 @@ jobs: $python ./waf all $TARGETARCH cd .. fi - - # fix TLS errors by grabbing Digicert CA directly - curl -o digicert.crt https://cacerts.digicert.com/DigiCertHighAssuranceEVRootCA.crt - openssl x509 -in digicert.crt -out digicert.pem - export PIP_CERT= digicert.pem - $python setup.py install #$pip install pyinstaller From 9bb9d331adc1a53891fbb033408c9892e02fe97e Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Tue, 31 Aug 2021 09:58:07 -0400 Subject: [PATCH 07/15] Update build.yml --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b18a0644..9253ff58 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -168,6 +168,7 @@ jobs: echo -e "Python: $python\nPip: $pip\nLD_LIB...: $LD_LIBRARY_PATH" $pip install --upgrade pip $pip install wheel + $pip install --upgrade macholib export url="https://codeload.github.com/pyinstaller/pyinstaller/tar.gz/${PYINSTALLER_VERSION}" echo "Downloading ${url}" curl -o pyinstaller.tar.gz --compressed "${url}" From 00413fe7a48a2744f0f5b90c84f3fd77d363eae7 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Tue, 31 Aug 2021 10:46:03 -0400 Subject: [PATCH 08/15] Update build.yml --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9253ff58..fd2a4e8f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -186,7 +186,8 @@ jobs: $python ./waf all $TARGETARCH cd .. fi - $python setup.py install + $pip install . + #$python setup.py install #$pip install pyinstaller - name: Install pip requirements From 74977a6154834db2164b4635f92347d5c790198d Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Tue, 31 Aug 2021 10:49:42 -0400 Subject: [PATCH 09/15] Update build.yml --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd2a4e8f..b9f674c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -168,7 +168,6 @@ jobs: echo -e "Python: $python\nPip: $pip\nLD_LIB...: $LD_LIBRARY_PATH" $pip install --upgrade pip $pip install wheel - $pip install --upgrade macholib export url="https://codeload.github.com/pyinstaller/pyinstaller/tar.gz/${PYINSTALLER_VERSION}" echo "Downloading ${url}" curl -o pyinstaller.tar.gz --compressed "${url}" From 1f2bb18bc1a1118e9097143b9ed2ef290f1eb60b Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Tue, 31 Aug 2021 13:58:04 -0400 Subject: [PATCH 10/15] GAM 6.08 --- src/gam/var.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gam/var.py b/src/gam/var.py index 951e85db..3c161025 100644 --- a/src/gam/var.py +++ b/src/gam/var.py @@ -8,7 +8,7 @@ import platform import re GAM_AUTHOR = 'Jay Lee ' -GAM_VERSION = '6.07' +GAM_VERSION = '6.08' GAM_LICENSE = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)' GAM_URL = 'https://git.io/gam' From 88339b721442635aafebde216d8893d4ad9991f5 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Tue, 31 Aug 2021 13:59:04 -0400 Subject: [PATCH 11/15] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9f674c2..b0991fa0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ env: BUILD_PYTHON_VERSION: "3.9.7" MIN_PYTHON_VERSION: "3.9.7" BUILD_OPENSSL_VERSION: "1.1.1l" - MIN_OPENSSL_VERSION: "1.1.1k" + MIN_OPENSSL_VERSION: "1.1.1l" PATCHELF_VERSION: "0.12" # PYINSTALLER_VERSION can be full commit hash or version like v4.20 PYINSTALLER_VERSION: "5a02f55c696f16b98f23a8b487f3daa8f644a8d2" From e3c5dca09d85905eb497a84f4a99527264767263 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Thu, 9 Sep 2021 10:06:50 -0700 Subject: [PATCH 12/15] Three updates (#1421) * Initialize pageToken for each namespace * Update group sync to do removes before adds This gets around problem when a group contains a primary address and a sync is performed with an alias. With adds first you get a duplicate error; with removes first the primary address in the group is replaced with the alias. * Add defaultsender to group settings --- src/GamCommands.txt | 1 + src/gam/gapi/chromepolicy.py | 1 + src/gam/gapi/directory/groups.py | 10 ++++++---- src/gam/var.py | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/GamCommands.txt b/src/GamCommands.txt index 682eb2d3..d8a5cdc2 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -720,6 +720,7 @@ Specify a collection of Users by directly specifying them or by specifiying item (customfootertext )| (customreplyto )| (defaultmessagedenynotificationtext )| + (defaultsender default_self|group)| (description )| (enablecollaborativeinbox|collaborative )| (includeinglobaladdresslist|gal )| diff --git a/src/gam/gapi/chromepolicy.py b/src/gam/gapi/chromepolicy.py index 7876ef87..2acd0938 100644 --- a/src/gam/gapi/chromepolicy.py +++ b/src/gam/gapi/chromepolicy.py @@ -86,6 +86,7 @@ def printshow_policies(): for namespace in namespaces: spacing = ' ' body['policySchemaFilter'] = f'{namespace}.*' + body['pageToken'] = None try: policies = gapi.get_all_pages(svc.customers().policies(), 'resolve', items='resolvedPolicies', diff --git a/src/gam/gapi/directory/groups.py b/src/gam/gapi/directory/groups.py index 735c11e8..138c5b4c 100644 --- a/src/gam/gapi/directory/groups.py +++ b/src/gam/gapi/directory/groups.py @@ -266,6 +266,8 @@ GROUP_ATTRIBUTES_ARGUMENT_TO_PROPERTY_MAP = { 'customReplyTo', 'defaultmessagedenynotificationtext': 'defaultMessageDenyNotificationText', + 'defaultsender': + 'defaultSender', 'enablecollaborativeinbox': 'enableCollaborativeInbox', 'favoriterepliesontop': @@ -979,6 +981,9 @@ def update(): sys.stderr.write( f'Group: {group}, Will add {len(to_add)} and remove {len(to_remove)} {role}s.\n' ) + for user in to_remove: + items.append( + ['gam', 'update', 'group', group, 'remove', user]) for user in to_add: item = ['gam', 'update', 'group', group, 'add'] if role: @@ -987,9 +992,6 @@ def update(): item.append(delivery) item.append(user) items.append(item) - for user in to_remove: - items.append( - ['gam', 'update', 'group', group, 'remove', user]) elif myarg in ['delete', 'remove']: _, users_email, _ = _getRoleAndUsers() if not exists(cd, group): @@ -1219,7 +1221,7 @@ def getGroupAttrValue(myarg, value, gs_object, gs_body, function): params) in list(gs_object['schemas']['Groups']['properties'].items()): if attrib in ['kind', 'etag', 'email']: continue - if myarg == attrib.lower(): + if myarg == attrib.lower().replace('_', ''): if params['type'] == 'integer': try: if value[-1:].upper() == 'M': diff --git a/src/gam/var.py b/src/gam/var.py index 3c161025..a565d2e6 100644 --- a/src/gam/var.py +++ b/src/gam/var.py @@ -1110,7 +1110,8 @@ GROUP_SETTINGS_LIST_ATTRIBUTES = set([ 'whoCanUnmarkFavoriteReplyOnAnyTopic', 'whoCanViewGroup', 'whoCanViewMembership', - # Miscellaneous hoices + # Miscellaneous choices + 'default_sender', 'messageModerationLevel', 'replyTo', 'spamModerationLevel', From 0a2b048fb121775ea8e8e744213a76c81358e498 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Fri, 10 Sep 2021 14:40:21 -0400 Subject: [PATCH 13/15] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0991fa0..f4ae960d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ defaults: env: BUILD_PYTHON_VERSION: "3.9.7" MIN_PYTHON_VERSION: "3.9.7" - BUILD_OPENSSL_VERSION: "1.1.1l" + BUILD_OPENSSL_VERSION: "3.0.0" MIN_OPENSSL_VERSION: "1.1.1l" PATCHELF_VERSION: "0.12" # PYINSTALLER_VERSION can be full commit hash or version like v4.20 From 45e1b5067475fedf9a7dfdea4c6f96ec51e3d8f5 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Fri, 10 Sep 2021 14:41:08 -0400 Subject: [PATCH 14/15] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f4ae960d..70ced694 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,7 +97,7 @@ jobs: path: | ~/python ~/ssl - key: ${{ matrix.os }}-${{ matrix.jid }}-20210831 + key: ${{ matrix.os }}-${{ matrix.jid }}-20210910 - name: Set env variables env: From df1f0f8f095e8f4ed0e9a1413d685e95c93040db Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Thu, 16 Sep 2021 08:15:21 -0400 Subject: [PATCH 15/15] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 70ced694..abcd7459 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ defaults: env: BUILD_PYTHON_VERSION: "3.9.7" MIN_PYTHON_VERSION: "3.9.7" - BUILD_OPENSSL_VERSION: "3.0.0" + BUILD_OPENSSL_VERSION: "1.1.1l" MIN_OPENSSL_VERSION: "1.1.1l" PATCHELF_VERSION: "0.12" # PYINSTALLER_VERSION can be full commit hash or version like v4.20