Skip to content

Commit

Permalink
Added group/ou filtering to print|show policies
Browse files Browse the repository at this point in the history
Updated `gam get|update|delete contactphotos` to use the People API
  • Loading branch information
taers232c committed Nov 10, 2024
1 parent f246296 commit 95b3a97
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 169 deletions.
17 changes: 15 additions & 2 deletions docs/Cloud-Identity-Policies.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Cloud Identity Policies
- [API documentation](#api-documentation)
- [Notes](#notes)
- [Python Regular Expressions](Python-Regular-Expressions) Match function
- [Definitions](#definitions)
- [Policies](#policies)
- [Display Cloud Identity Policies](#display-cloud-identity-policies)
Expand Down Expand Up @@ -322,8 +323,8 @@ gam info policies <CIPolicyEntity>

Select policies::
* `polices/<String>` - A policy name, `policies/ahv4hg7qc24kvaghb7zihwf4riid4`
* `settings/<String>` - A policy setting type, `settings/workspace_marketplace.apps_allowlist'
* `<String>` - A policy setting type, `workspace_marketplace.apps_allowlist'
* `settings/<String>` - A policy setting type, `settings/workspace_marketplace.apps_allowlist`
* `<String>` - A policy setting type, `workspace_marketplace.apps_allowlist`

By default, policy warnings are displayed, use the 'nowarnings` option to suppress their display.

Expand All @@ -337,10 +338,13 @@ Display all or filtered policies.
```
gam show policies
[filter <String>] [nowarnings] [noappnames]
[group <RegularExpression>] [ou|org|orgunit <RegularExpression>]
[formatjson]
```
By default, all policies are displayed.
* `filter <String>` - Display filtered policies, See https://cloud.google.com/identity/docs/reference/rest/v1beta1/policies/list
* `group <RegularExpression>` - Only display policies whose group email address matches the `<RegularExpression>`
* `ou|org|orgunit <RegularExpression> - Only display policies whose OU path matches the `<RegularExpression>`

By default, policy warnings are displayed, use the 'nowarnings` option to suppress their display.

Expand All @@ -353,10 +357,13 @@ By default, Gam displays the information as an indented list of keys and values.
```
gam print policies [todrive <ToDriveAttribute>*]
[filter <String>] [nowarnings] [noappnames]
[group <RegularExpression>] [ou|org|orgunit <RegularExpression>]
[formatjson [quotechar <Character>]]
```
By default, all policies are displayed:
* `filter <String>` - Display filtered policies, See https://cloud.google.com/identity/docs/reference/rest/v1beta1/policies/list
* `group <RegularExpression>` - Only display policies whose group email address matches the `<RegularExpression>`
* `ou|org|orgunit <RegularExpression> - Only display policies whose OU path matches the `<RegularExpression>`

By default, policy warnings are displayed, use the 'nowarnings` option to suppress their display.

Expand All @@ -371,3 +378,9 @@ the quote character itself, the column delimiter (comma by default) and new-line
When using the `formatjson` option, double quotes are used extensively in the data resulting in hard to read/process output.
The `quotechar <Character>` option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output.
`quotechar` defaults to `gam.cfg/csv_output_quote_char`. When uploading CSV files to Google, double quote `"` should be used.

### Examples
Print all service status policies.
```
gam redirect csv ./ServiceStatusPolicies.csv print policies filter "setting.type.matches('.*service_status')"
```
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-GAM7](https://github.com/GAM-team/GAM/wiki/Downloads-Installs) for Windows or other options, including manual installation

### 7.00.37

Added options `group <RegularExpression>` and `ou|org|orgunit <RegularExpression>`
to `gam print|show policies` that causes GAM to only display policies whose group email address
or OU path match the `<RegularExpression>`.

Updated `gam get|update|delete contactphotos` to use the People API for domain shared contact photos
as Google has deprecated the Domain Shared Contacts API for these commands. Unfortunately,
the People API fails with `gam update|delete contactphotos`.

### 7.00.36

Updated `gam print chromeapps` to correct a trap caused by an API change.
Expand Down
4 changes: 2 additions & 2 deletions docs/How-to-Upgrade-Legacy-GAM-to-GAM7.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
GAM 7.00.36 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.00.37 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <[email protected]>
Python 3.13.0 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
GAM7 7.00.36 - https://github.com/GAM-team/GAM - pythonsource
GAM7 7.00.37 - https://github.com/GAM-team/GAM - pythonsource
GAM Team <[email protected]>
Python 3.13.0 64-bit final
Windows-10-10.0.17134 AMD64
Expand Down
45 changes: 34 additions & 11 deletions docs/Users-Calendars.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
- [Display calendar UI settings](#display-calendar-ui-settings)
- [Manage calendars](#manage-calendars)
- [Create and remove calendars](#create-and-remove-calendars)
- [Display calendar settings](#display-calendar-settings)
- [Modify calendar settings](#modify-calendar-settings)
- [Display calendar settings](#display-calendar-settings)
- [Manage calendar lists](#manage-calendar-lists)
- [Display specific calendars from list](#display-specific-calendars-from-list)
- [Display calendar lists](#display-calendar-lists)
Expand All @@ -23,6 +23,8 @@
<EmailAddress> ::= <String>@<DomainName>
<CalendarItem> ::= <EmailAddress>
<CalendarList> ::= "<CalendarItem>(,<CalendarItem>)*"
<CalendarEntity> ::= <CalendarList> | <FileSelector> | <CSVkmdSelector> | <CSVDataSelector>
See: https://github.com/taers232c/GAMADV-XTD3/wiki/Collections-of-Items
<CourseAlias> ::= <String>
<CourseID> ::= <Number>|d:<CourseAlias>
<CourseIDList> ::= "<CourseID>(,<CourseID>)*"
Expand All @@ -38,6 +40,21 @@
<CalendarACLRole> ::=
editor|freebusy|freebusyreader|owner|reader|writer
<CalendarSettings> ::=
(description <String>)|
(location <String>)|
(summary <String>)|
(timezone <TimeZone>)
<CalendarSettingsField> ::=
conferenceproperties|
description|
id|
location|
summary|
timezone
<CalendarSettingsFieldList> ::= "<CalendarSettingsField>(,<CalendarSettingsField>)*"
<CalendarSelectProperty> ::=
minaccessrole <CalendarACLRole>|
showdeleted|
Expand Down Expand Up @@ -111,12 +128,6 @@
(selected <Boolean>)|
(summary <String>)
<CalendarSettings> ::=
(description <String>)|
(location <String>)|
(summary <String>)|
(timezone <TimeZone>)
<CalendarListField> ::=
accessrole|
backgroundcolor|
Expand Down Expand Up @@ -189,17 +200,29 @@ gam <UserTypeEntity> create calendar <CalendarSettings>
gam <UserTypeEntity> remove calendars <UserCalendarEntity>
```

### Modify calendar settings
```
gam <UserTypeEntity> modify calendars <UserCalendarEntity> <CalendarSettings>
```

### Display calendar settings
```
gam <UserTypeEntity> info calendars <UserCalendarEntity> [formatjson]
gam calendar <CalendarEntity> show settings
[fields <CalendarSettingsFieldList>]
[formatjson]
```
By default, Gam displays the information as an indented list of keys and values.
* `formatjson` - Display the fields in JSON format.

### Modify calendar settings
```
gam <UserTypeEntity> modify calendars <UserCalendarEntity> <CalendarSettings>
gam calendar <CalendarEntity> print settings [todrive <ToDriveAttribute>*]
[fields <CalendarSettingsFieldList>]
[formatjson [quotechar <Character>]]
```
By default, when writing CSV files, Gam uses a quote character of double quote `"`. The quote character is used to enclose columns that contain
the quote character itself, the column delimiter (comma by default) and new-line characters. Any quote characters within the column are doubled.
When using the `formatjson` option, double quotes are used extensively in the data resulting in hard to read/process output.
The `quotechar <Character>` option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output.
`quotechar` defaults to `gam.cfg/csv_output_quote_char`. When uploading CSV files to Google, double quote `"` should be used.

## Manage calendar lists
These commands manage a user's list of calendars.
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
GAM 7.00.36 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.00.37 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <[email protected]>
Python 3.13.0 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
GAM 7.00.36 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.00.37 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <[email protected]>
Python 3.13.0 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
GAM 7.00.36 - https://github.com/GAM-team/GAM - pyinstaller
GAM 7.00.37 - https://github.com/GAM-team/GAM - pyinstaller
GAM Team <[email protected]>
Python 3.13.0 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/gam7
Version Check:
Current: 5.35.08
Latest: 7.00.36
Latest: 7.00.37
echo $?
1
```

Print the current version number without details
```
gam version simple
7.00.36
7.00.37
```
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.36 - https://github.com/GAM-team/GAM
GAM 7.00.37 - https://github.com/GAM-team/GAM
GAM Team <[email protected]>
Python 3.13.0 64-bit final
MacOS Sonoma 14.5 x86_64
Expand Down
2 changes: 2 additions & 0 deletions src/GamCommands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4075,9 +4075,11 @@ gam info policies <CIPolicyNameEntity>
[formatjson]
gam print policies [todrive <ToDriveAttribute>*]
[filter <String>] [nowarnings] [noappnames]
[group <RegularExpression>] [ou|org|orgunit <RegularExpression>]
[formatjson [quotechar <Character>]]
gam show policies
[filter <String>] [nowarnings] [noappnames]
[group <RegularExpression>] [ou|org|orgunit <RegularExpression>]
[formatjson]

# Inbound SSO
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.37

Added options `group <RegularExpression>` and `ou|org|orgunit <RegularExpression>`
to `gam print|show policies` that causes GAM to only display policies whose group email address
or OU path match the `<RegularExpression>`.

Updated `gam get|update|delete contactphotos` to use the People API for domain shared contact photos
as Google has deprecated the Domain Shared Contacts API for these commands. Unfortunately,
the People API fails with `gam update|delete contactphotos`.

7.00.36

Updated `gam print chromeapps` to correct a trap caused by an API change.
Expand Down
Loading

0 comments on commit 95b3a97

Please sign in to comment.