Skip to content

Commit

Permalink
Updated <PeopleContactAttribute> fields address,email,phone,url t…
Browse files Browse the repository at this point in the history
…o allow an empty type field.
  • Loading branch information
taers232c committed Sep 26, 2024
1 parent e4ad4fb commit 3e638dd
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 19 deletions.
10 changes: 10 additions & 0 deletions docs/GamUpdates.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<PeopleContactAttribute>` fields `address,email,phone,url` to allow an empty type field.
```
address "" formatted "My Address" primary
email "" [email protected] primary
phone "" "510-555-1212" primary
url "" "https://www.domain.com" primary
```

### 7.00.06

Updated `gam <UserTypeEntity> create|update chatspace` to support the new permissions settings
Expand Down
4 changes: 2 additions & 2 deletions docs/How-to-Upgrade-from-Legacy-GAM.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
Python 3.12.6 64-bit final
MacOS Sonoma 14.5 x86_64
Expand Down Expand Up @@ -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 <[email protected]>
Python 3.12.6 64-bit final
Windows-10-10.0.17134 AMD64
Expand Down
12 changes: 12 additions & 0 deletions docs/Organizational-Units.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions docs/Users-Chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
```
Expand Down
2 changes: 1 addition & 1 deletion docs/Users-Drive-Files-Display.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand Down
9 changes: 8 additions & 1 deletion docs/Users-People-Contacts-Profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,15 @@ gam user [email protected] check serviceaccount
(subject <String>)|
(suffix <String>)|
(userdefinedfield clear|(<String> <String>))|
(website clear|(app_install_page|blog|ftp|home|home_page|other|profile|reservations|work|<String> <URL> notprimary|primary))
(url|website clear|(app_install_page|blog|ftp|home|home_page|other|profile|reservations|work|<String> <URL> notprimary|primary))
For address, email, phone and url, the type <String> can be empty.
address "" formatted "My Address" primary
email "" [email protected] primary
phone "" "510-555-1212" primary
url "" "https://www.domain.com" primary
```
```
<PeopleFieldName> ::=
addresses|
ageranges|
Expand Down
12 changes: 6 additions & 6 deletions docs/Version-and-Help.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
Python 3.12.5 64-bit final
MacOS Sonoma 14.5 x86_64
Expand All @@ -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 <[email protected]>
Python 3.12.5 64-bit final
MacOS Sonoma 14.5 x86_64
Expand All @@ -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 <[email protected]>
Python 3.12.5 64-bit final
MacOS Sonoma 14.5 x86_64
Expand Down Expand Up @@ -64,15 +64,15 @@ 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
```

Print the current version number without details
```
gam version simple
7.00.06
7.00.07
```
In Linux/MacOS you can do:
```
Expand All @@ -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 <[email protected]>
Python 3.12.5 64-bit final
MacOS Sonoma 14.5 x86_64
Expand Down
2 changes: 1 addition & 1 deletion src/GamCommands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7902,7 +7902,7 @@ gam <UserItem> print meettranscripts <MeetConferenceName> [todrive <ToDriveAttri
(subject <String>)|
(suffix <String>)|
(userdefinedfield clear|(<String> <String>))|
(website clear|(app_install_page|blog|ftp|home|home_page|other|profile|reservations|work|<String> <URL> notprimary|primary))
(url|website clear|(app_install_page|blog|ftp|home|home_page|other|profile|reservations|work|<String> <URL> notprimary|primary))

<PeopleUserContactSelection> ::=
[(selectcontactgroup <PeopleContactGroupItem>)|
Expand Down
10 changes: 10 additions & 0 deletions src/GamUpdate.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
7.00.07

Updated `<PeopleContactAttribute>` fields `address,email,phone,url` to allow an empty type field.
```
address "" formatted "My Address" primary
email "" [email protected] primary
phone "" "510-555-1212" primary
url "" "https://www.domain.com" primary
```

7.00.06

Updated `gam <UserTypeEntity> create|update chatspace` to support the new permissions settings
Expand Down
22 changes: 14 additions & 8 deletions src/gam/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# GAM
# GAM7
#
# Copyright 2024, All Rights Reserved.
#
Expand All @@ -25,7 +25,7 @@
"""

__author__ = 'GAM Team <[email protected]>'
__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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3e638dd

Please sign in to comment.