diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index cc3c31e83..87ec3f318 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -10,6 +10,16 @@ Add the `-s` option to the end of the above commands to suppress creating the `g See [Downloads-Installs](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads-Installs) for Windows or other options, including manual installation +### 7.00.07 + +Updated `` fields `address,email,phone,url` to allow an empty type field. +``` +address "" formatted "My Address" primary +email "" user@gmail.com primary +phone "" "510-555-1212" primary +url "" "https://www.domain.com" primary +``` + ### 7.00.06 Updated `gam create|update chatspace` to support the new permissions settings diff --git a/docs/How-to-Upgrade-from-Legacy-GAM.md b/docs/How-to-Upgrade-from-Legacy-GAM.md index b3ad736f4..bc60dbcb3 100644 --- a/docs/How-to-Upgrade-from-Legacy-GAM.md +++ b/docs/How-to-Upgrade-from-Legacy-GAM.md @@ -251,7 +251,7 @@ 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 -GAMADV-XTD3 7.00.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 7.00.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.6 64-bit final MacOS Sonoma 14.5 x86_64 @@ -923,7 +923,7 @@ 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 -GAMADV-XTD3 7.00.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 7.00.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.6 64-bit final Windows-10-10.0.17134 AMD64 diff --git a/docs/Organizational-Units.md b/docs/Organizational-Units.md index 013ec83ce..a006f5aba 100644 --- a/docs/Organizational-Units.md +++ b/docs/Organizational-Units.md @@ -16,6 +16,7 @@ - [Display organizational unit counts](#display-organizational-unit-counts) - [Display indented organizational unit tree](#display-indented-organizational-unit-tree) - [Check organizational unit for contained items](#check-organizational-unit-for-contained-items) +- [Delete Empty OUs](#delete-empty-ous) - [Special case handling for large number of organizational units](#special-case-handling-for-large-number-of-organizational-units) ## API documentation @@ -321,6 +322,17 @@ You can inspect the file and execute it if desired; substitute actual filenames gam redirect stdout CleanOuLog.txt multiproces redirect stderr stdout batch CleanOuBatch.txt ``` +### Delete Empty OUs +``` +# Get list of OUs +gam redirect csv ./OUs.csv print ous +# Check status of each OU +gam redirect csv ./CheckOUs.csv multiprocess redirect stderr - multiprocess csv OUs.csv gam check ou "~orgUnitId" +# Delete empty OUs +gam config csv_input_row_filter "empty:boolean:true" redirect stdout ./DeleteEmptyOUs.txt multiprocess redirect stderr stdout csv CheckOUs.csv gam delete ou "~orgUnitId" +``` +Repeat the steps until no empty OUs remain. + ## Special case handling for large number of organizational units By default, the `print orgs` and `show orgtree` commands issue a single API call to get the diff --git a/docs/Users-Chat.md b/docs/Users-Chat.md index d8c262506..30dd39c0f 100644 --- a/docs/Users-Chat.md +++ b/docs/Users-Chat.md @@ -3,6 +3,7 @@ - [Introduction](#introduction) - [Set up a Chat Bot](#set-up-a-chat-bot) - [Definitions](#definitions) +- [Chat Space Permissions](#chat-space-permissions) - [Manage Chat Spaces](#manage-chat-spaces) - [Display Chat Spaces](#display-chat-spaces) - [Manage Chat Members](#manage-chat-members) @@ -156,6 +157,31 @@ Google requires that you have a Chat Bot configured in order to use the Chat API ``` +## Chat Space Permissions +### Announcement +| Keyword | Description | Allowed | Default | +|---------|-------------|---------|---------| +| manageapps | Manage apps | managers-immutable | managers | +| managemembersandgroups | Manage members and groups | managers/members | managers | +| managewebhooks | Manage web hooks | managers-immutable | managers | +| modifyspacedetails | Modify space details | managers/members | managers | +| postmessages | Post messages | managers-immutable | managers | +| replymessages | Reply messages | members/managers | members | +| togglehistory | Turn history on and off | managers/members | managers | +| useatmentionall | Use @all | managers-immutable | managers | + +### Collaboration +| Keyword | Description | Allowed | Default | +|---------|-------------|---------|---------| +| manageapps | Manage apps | members-immutable | members | +| managemembersandgroups | Manage members and groups | managers/members | members | +| managewebhooks | Manage web hooks | managers/members | members | +| modifyspacedetails | Modify space details | managers/members | members | +| postmessages | Post messages | members-immutable | members | +| replymessages | Reply messages | members-immutable | members | +| togglehistory | Turn history on and off | managers/members | members | +| useatmentionall | Use @all | managers/members | members | + ## Manage Chat Spaces ### Create a chat space ``` diff --git a/docs/Users-Drive-Files-Display.md b/docs/Users-Drive-Files-Display.md index 1dd714559..fcf392e3d 100644 --- a/docs/Users-Drive-Files-Display.md +++ b/docs/Users-Drive-Files-Display.md @@ -722,7 +722,7 @@ as it does now. Of course, if the query really is invalid, you will get the mess The `showsize` option displays the total size (in bytes) of the files counted. -The showmimetypesize' displays the total size (in bytes) of each MIME type counted. +The `showmimetypesize` option displays the total size (in bytes) of each MIME type counted. The option `showlastmodification` displays the following fields: `lastModifiedFileId,lastModifiedFileName,lastModifyingUser,lastModifiedTime`; diff --git a/docs/Users-People-Contacts-Profiles.md b/docs/Users-People-Contacts-Profiles.md index 49d5b03ae..ac54d0bbc 100644 --- a/docs/Users-People-Contacts-Profiles.md +++ b/docs/Users-People-Contacts-Profiles.md @@ -125,8 +125,15 @@ gam user user@domain.com check serviceaccount (subject )| (suffix )| (userdefinedfield clear|( ))| - (website clear|(app_install_page|blog|ftp|home|home_page|other|profile|reservations|work| notprimary|primary)) + (url|website clear|(app_install_page|blog|ftp|home|home_page|other|profile|reservations|work| notprimary|primary)) +For address, email, phone and url, the type can be empty. +address "" formatted "My Address" primary +email "" user@gmail.com primary +phone "" "510-555-1212" primary +url "" "https://www.domain.com" primary +``` +``` ::= addresses| ageranges| diff --git a/docs/Version-and-Help.md b/docs/Version-and-Help.md index a98d09e28..3b216a81b 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 7.00.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 7.00.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.5 64-bit final MacOS Sonoma 14.5 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 7.00.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 7.00.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.5 64-bit final MacOS Sonoma 14.5 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 7.00.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 7.00.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.5 64-bit final MacOS Sonoma 14.5 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: 7.00.06 + Latest: 7.00.07 echo $? 1 ``` @@ -72,7 +72,7 @@ echo $? Print the current version number without details ``` gam version simple -7.00.06 +7.00.07 ``` 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 7.00.06 - https://github.com/taers232c/GAMADV-XTD3 +GAM 7.00.07 - https://github.com/taers232c/GAMADV-XTD3 Ross Scroggs Python 3.12.5 64-bit final MacOS Sonoma 14.5 x86_64 diff --git a/src/GamCommands.txt b/src/GamCommands.txt index 56e5a2e8d..901e1ba24 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -7902,7 +7902,7 @@ gam print meettranscripts [todrive )| (suffix )| (userdefinedfield clear|( ))| - (website clear|(app_install_page|blog|ftp|home|home_page|other|profile|reservations|work| notprimary|primary)) + (url|website clear|(app_install_page|blog|ftp|home|home_page|other|profile|reservations|work| notprimary|primary)) ::= [(selectcontactgroup )| diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index b92dd1a5d..d39277451 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -1,3 +1,13 @@ +7.00.07 + +Updated `` fields `address,email,phone,url` to allow an empty type field. +``` +address "" formatted "My Address" primary +email "" user@gmail.com primary +phone "" "510-555-1212" primary +url "" "https://www.domain.com" primary +``` + 7.00.06 Updated `gam create|update chatspace` to support the new permissions settings diff --git a/src/gam/__init__.py b/src/gam/__init__.py index feb1e7e44..12fc552f2 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- # -# GAM +# GAM7 # # Copyright 2024, All Rights Reserved. # @@ -25,7 +25,7 @@ """ __author__ = 'GAM Team ' -__version__ = '7.00.06' +__version__ = '7.00.07' __license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)' #pylint: disable=wrong-import-position @@ -20710,6 +20710,9 @@ class PeopleManager(): } } +# Fields that allow an empty type + EMPTY_TYPE_ALLOWED_FIELDS = {PEOPLE_ADDRESSES, PEOPLE_EMAIL_ADDRESSES, PEOPLE_PHONE_NUMBERS, PEOPLE_URLS} + # Fields with just a URL # URL_FIELDS = { # PEOPLE_COVER_PHOTOS, @@ -20753,14 +20756,14 @@ def GetSingleFieldEntry(fieldName): person[fieldName].append({}) return person[fieldName][0] - def InitArrayFieldEntry(choices): + def InitArrayFieldEntry(choices, typeMinLen=1): entry = {'metadata': {'primary': False}} if choices is not None: ftype = getChoice(choices, mapChoice=True, defaultChoice=None) if ftype: entry['type'] = ftype else: - entry['type'] = getString(Cmd.OB_STRING) + entry['type'] = getString(Cmd.OB_STRING, minLen=typeMinLen) return entry def GetMultiFieldEntry(fieldName): @@ -20811,7 +20814,7 @@ def AppendArrayEntryToFields(fieldName, entry, checkBlankField=None): if fieldName == PEOPLE_ADDRESSES: if CheckClearPersonField(fieldName): continue - entry = InitArrayFieldEntry(PeopleManager.TYPE_VALUE_PNP_FIELDS[fieldName]) + entry = InitArrayFieldEntry(PeopleManager.TYPE_VALUE_PNP_FIELDS[fieldName], typeMinLen=0) while Cmd.ArgumentsRemaining(): argument = getArgument() if argument in PeopleManager.ADDRESS_ARGUMENT_TO_FIELD_MAP: @@ -20892,7 +20895,8 @@ def AppendArrayEntryToFields(fieldName, entry, checkBlankField=None): elif fieldName in PeopleManager.TYPE_VALUE_PNP_FIELDS: if CheckClearPersonField(fieldName): continue - entry = InitArrayFieldEntry(PeopleManager.TYPE_VALUE_PNP_FIELDS[fieldName]) + entry = InitArrayFieldEntry(PeopleManager.TYPE_VALUE_PNP_FIELDS[fieldName], + typeMinLen=0 if fieldName in PeopleManager.EMPTY_TYPE_ALLOWED_FIELDS else 1) if fieldName == PEOPLE_IM_CLIENTS: checkBlankField = None entry['protocol'] = getChoice(PeopleManager.IM_PROTOCOLS, mapChoice=True) @@ -71962,14 +71966,16 @@ def _processSendAs(user, i, count, entityType, emailAddress, j, jcount, gmail, f result = callGAPI(gmail.users().settings().sendAs(), function, throwReasons=GAPI.GMAIL_THROW_REASONS+[GAPI.NOT_FOUND, GAPI.ALREADY_EXISTS, GAPI.DUPLICATE, GAPI.CANNOT_DELETE_PRIMARY_SENDAS, GAPI.INVALID_ARGUMENT, - GAPI.FAILED_PRECONDITION, GAPI.PERMISSION_DENIED], + GAPI.FAILED_PRECONDITION, GAPI.PERMISSION_DENIED, + GAPI.INSUFFICIENT_PERMISSIONS], userId='me', **kwargs) if function == 'get': _showSendAs(result, j, jcount, sigReplyFormat, verifyOnly) else: entityActionPerformed([Ent.USER, user, entityType, emailAddress], j, jcount) except (GAPI.notFound, GAPI.alreadyExists, GAPI.duplicate, - GAPI.cannotDeletePrimarySendAs, GAPI.invalidArgument, GAPI.failedPrecondition, GAPI.permissionDenied) as e: + GAPI.cannotDeletePrimarySendAs, GAPI.invalidArgument, + GAPI.failedPrecondition, GAPI.permissionDenied, GAPI.insufficientPermissions) as e: entityActionFailedWarning([Ent.USER, user, entityType, emailAddress], str(e), j, jcount) except (GAPI.serviceNotAvailable, GAPI.badRequest): entityServiceNotApplicableWarning(Ent.USER, user, i, count)