From dd4fb084e62db3cad93ef3355878b7733dfa94f1 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Tue, 14 May 2024 08:10:42 -0700 Subject: [PATCH] Update docs; improve error message on missing SA scope --- docs/Authorization.md | 4 ++-- docs/CSV-Input-Filtering.md | 8 +++++++- docs/CSV-Output-Filtering.md | 7 +++++-- docs/Context-Aware-Access-Levels.md | 2 +- docs/Groups-Membership.md | 5 +++++ docs/Install-GAM-as-Python-Library.md | 4 ++-- docs/Users-Gmail-Messages-Threads.md | 1 + src/gam/__init__.py | 2 +- 8 files changed, 24 insertions(+), 9 deletions(-) diff --git a/docs/Authorization.md b/docs/Authorization.md index 3b648882..2a30effd 100644 --- a/docs/Authorization.md +++ b/docs/Authorization.md @@ -340,8 +340,8 @@ Use an existing project to create and download two files: `client_secrets.json` * `` - `` ### Basic -Use an existing project with default values for the service account. This is typically used when -the system administrators have created a basic project and you now want to configure it as a GAM project. +Use an existing uninitialized/uncredentialed project and configure it to be a GAM project; this typically used when +the GCP administrators have created a basic project because project creation is not available for most users. ``` gam use project [] [project ] ``` diff --git a/docs/CSV-Input-Filtering.md b/docs/CSV-Input-Filtering.md index e15a8436..063db6f2 100644 --- a/docs/CSV-Input-Filtering.md +++ b/docs/CSV-Input-Filtering.md @@ -83,11 +83,17 @@ Name:value form. * Each `:` pair should be enclosed in `'`. * If `` contains a `:` or a space, it should be enclosed in `\"`. * If `` or `` in `` contain a space, it should be enclosed in `\"`. +* If `` or `` in `` contain a `\` to escape a special character +or enter a special sequence, enter `\\\` on Linux and Mac OS, `\\` on Windows, -Example: +Examples: ``` csv_input_row_filter "'\"accounts:used_quota_in_mb\":count>15000'" csv_input_row_filter "'email:data:\"csvfile gsheet:email user@domain.com FileID Sheet1\"'" +Linux and Mac OS +csv_input_row_filter "'phones.\\\d+.value:regex:(?:^\\\(510\\\) )|(?:^510[- ])\\\d{3}-\\\d{4}'" +Windows +csv_input_row_filter "'phones.\\d+.value:regex:(?:^\\(510\\) )|(?:^510[- ])\\d{3}-\\d{4}'" ``` JSON form. ``` diff --git a/docs/CSV-Output-Filtering.md b/docs/CSV-Output-Filtering.md index 0371afd1..8c90a403 100644 --- a/docs/CSV-Output-Filtering.md +++ b/docs/CSV-Output-Filtering.md @@ -89,13 +89,16 @@ Name:value form. * If `` contains a `:` or a space, it should be enclosed in `\"`. * If `` or `` in `` contain a space, it should be enclosed in `\"`. * If `` or `` in `` contain a `\` to escape a special character -or enter a special sequence, enter `\\\`. +or enter a special sequence, enter `\\\` on Linux and Mac OS, `\\` on Windows, -Example: +Examples: ``` csv_output_row_filter "'\"accounts:used_quota_in_mb\":count>15000'" csv_output_row_filter "'email:data:\"csvfile gsheet:email user@domain.com FileID Sheet1\"'" +Linux and Mac OS csv_output_row_filter "'phones.\\\d+.value:regex:(?:^\\\(510\\\) )|(?:^510[- ])\\\d{3}-\\\d{4}'" +Windows +csv_output_row_filter "'phones.\\d+.value:regex:(?:^\\(510\\) )|(?:^510[- ])\\d{3}-\\d{4}'" ``` JSON form. ``` diff --git a/docs/Context-Aware-Access-Levels.md b/docs/Context-Aware-Access-Levels.md index a70c1d2c..4cd5a44e 100644 --- a/docs/Context-Aware-Access-Levels.md +++ b/docs/Context-Aware-Access-Levels.md @@ -23,7 +23,7 @@ gam update project ``` ## API documentation -* https://cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies/list +* https://cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies ## Grant Service Account Rights to Manage CAA In order for GAM to manage CAA access levels, you need to grant your service account a special role for your GCP organization. diff --git a/docs/Groups-Membership.md b/docs/Groups-Membership.md index 8f842969..6920c2d1 100644 --- a/docs/Groups-Membership.md +++ b/docs/Groups-Membership.md @@ -1,5 +1,6 @@ Groups - Membership - [API documentation](#api-documentation) +- [Query documentation](#query-documentation) - [Python Regular Expressions](Python-Regular-Expressions) Match function - [Definitions](#definitions) - [Collections of Users](#collections-of-users) @@ -18,6 +19,10 @@ ## API documentation * https://developers.google.com/admin-sdk/directory/v1/reference/members +## Query documentation +* https://developers.google.com/admin-sdk/directory/v1/guides/search-groups +* https://cloud.google.com/identity/docs/reference/rest/v1/groups#dynamicgroupquery + ## Definitions See [Collections of Items](Collections-of-Items) ``` diff --git a/docs/Install-GAM-as-Python-Library.md b/docs/Install-GAM-as-Python-Library.md index 6934065a..ec3a1004 100644 --- a/docs/Install-GAM-as-Python-Library.md +++ b/docs/Install-GAM-as-Python-Library.md @@ -9,7 +9,7 @@ Scroll down to Install Git You can install GAM as a Python library with pip. ``` -pip install git+https://github.com/taers232c/GAMADV-XTD3.git#subdirectory=src --use-pep517 +pip install git+https://github.com/taers232c/GAMADV-XTD3.git#subdirectory=src ``` Or as a PEP 508 Requirement Specifier, e.g. in requirements.txt file: @@ -29,7 +29,7 @@ dependencies = [ Target a specific revision or tag: ``` -advanced-gam-for-google-workspace @ git+https://github.com/taers232c/GAMADV-XTD3.git@v6.58.00#subdirectory=src +advanced-gam-for-google-workspace @ git+https://github.com/taers232c/GAMADV-XTD3.git@v6.76.01#subdirectory=src ``` ## Using the library diff --git a/docs/Users-Gmail-Messages-Threads.md b/docs/Users-Gmail-Messages-Threads.md index c8527f58..250d1771 100644 --- a/docs/Users-Gmail-Messages-Threads.md +++ b/docs/Users-Gmail-Messages-Threads.md @@ -556,6 +556,7 @@ By default, Gam displays all messages. * `labelmatchpattern xyz` - Label must start with xyz * `labelmatchpattern .*xyz.*` - Label must contain xyz * `labelmatchpattern .*xyz` - Label must end with xyz + * `labelmatchpattern ^xyz$` - Label must extctly match xyz * `sendermatchpattern ` - Only display messages if the sender matches the `` When `matchlabel ` is specified, the following characters are replaced with a `-` in the generated query. diff --git a/src/gam/__init__.py b/src/gam/__init__.py index f9342917..dd4ea4e9 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -672,7 +672,7 @@ def SvcAcctAPIAccessDeniedExit(): apiOrScopes = API.getAPIName(GM.Globals[GM.CURRENT_SVCACCT_API]) if GM.Globals[GM.CURRENT_SVCACCT_API] else ','.join(sorted(GM.Globals[GM.CURRENT_SVCACCT_API_SCOPES])) writeStderr(Msg.API_CHECK_SVCACCT_AUTHORIZATION.format(GM.Globals[GM.OAUTH2SERVICE_CLIENT_ID], apiOrScopes, - GM.Globals[GM.CURRENT_SVCACCT_USER] or 'user@domain.com')) + GM.Globals[GM.CURRENT_SVCACCT_USER] or _getAdminEmail())) systemErrorExit(API_ACCESS_DENIED_RC, None) def SvcAcctAPIDisabledExit():