mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-06 12:43:35 +00:00
Added commands to show the number of CrOS devices or Users in an entity.
Updated `gam create project` to prompt user to mark `GAM Project Creation` as a trusted app.
This commit is contained in:
@ -231,6 +231,13 @@ gam create gcpfolder [admin <EmailAddress] folder <String>
|
||||
Create a new project to create and download two files: `client_secrets.json` for the Client and `oauth2service.json` for the Service Account.
|
||||
On-screen instructions lead you through the process.
|
||||
|
||||
An existing project, `GAM Project Creation`, is used to create your GAM project. The initial instructions tell you how to
|
||||
enable this project as a trusted app as your workspace may not allow untrusted third-party apps. You can skip these steps
|
||||
if you know that untrusted third-party apps are allowed.
|
||||
|
||||
The final instructions tell you how to enable your new GAM project as a trusted app as your workspace may not allow untrusted third-party apps.
|
||||
You can skip these steps if you know that untrusted third-party apps are allowed.
|
||||
|
||||
### Default values
|
||||
* `<AppName>` - "GAM"
|
||||
* `<ProjectID>` - "gam-project-abc-def-jki" where "abc-def-ghi" are randomly generated
|
||||
|
@ -466,7 +466,7 @@ No events are deleted unless you specify the `doit` option; omit `doit` to verif
|
||||
|
||||
When events are deleted from a calendar, they are moved to the calendar's trash and are only permanently deleted (purged) after 30 days.
|
||||
Following a suggestion here (https://stackoverflow.com/questions/41043053/how-to-empty-calendar-trash-via-google-services) you can permanently delete
|
||||
calendar events. This is achieved by creating a temporary calendar, deleting the events, moving the deleted events to the temporary calendar
|
||||
calendar events with `purge events`. This is achieved by creating a temporary calendar, deleting the events, moving the deleted events to the temporary calendar
|
||||
and then deleting the temporary calendar.
|
||||
|
||||
## Delete all calendar events
|
||||
|
@ -23,6 +23,7 @@
|
||||
- [Print a header row and fields for selected CrOS devices](#print-a-header-row-and-fields-for-selected-cros-devices)
|
||||
- [Print a header row and fields for specified CrOS devices](#print-a-header-row-and-fields-for-specified-cros-devices)
|
||||
- [Display Examples](#display-examples)
|
||||
- [Display CrOS device count](#display-cros-device-count)
|
||||
- [Print ChromeOS device activity](#print-chromeos-device-activity)
|
||||
- [Print a header row and activity for selected CrOS devices](#print-a-header-row-and-activity-for-selected-cros-devices)
|
||||
- [Print a header row and activity for specified CrOS devices](#print-a-header-row-and-activity-for-specified-cros-devices)
|
||||
@ -672,6 +673,12 @@ Print information about CrOS devices synced between 45 days ago and 30 days ago:
|
||||
gam print cros query "sync:#querytime1#..#querytime2#" querytime1 -45d querytime2 -30d
|
||||
```
|
||||
|
||||
## Display CrOS device count
|
||||
Display the number of CrOS devices in an entity.
|
||||
```
|
||||
gam <CrOSTypeEntity> show count
|
||||
```
|
||||
|
||||
## Print ChromeOS device activity
|
||||
|
||||
### Print a header row and activity for selected CrOS devices
|
||||
|
@ -10,6 +10,16 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
|
||||
|
||||
See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation.
|
||||
|
||||
### 6.63.10
|
||||
|
||||
Added commands to show the number of CrOS devices or Users in an entity.
|
||||
```
|
||||
gam <CrOSTypeEntity> show count
|
||||
gam <UserTypeEntity> show count
|
||||
```
|
||||
|
||||
Updated `gam create project` to prompt user to mark `GAM Project Creation` as a trusted app.
|
||||
|
||||
### 6.63.09
|
||||
|
||||
Updated `gam create teamdrive` to handle the following error:
|
||||
|
@ -330,7 +330,7 @@ writes the credentials into the file oauth2.txt.
|
||||
admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt
|
||||
admin@server:/Users/admin/bin/gamadv-xtd3$ ./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 6.63.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.63.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.10.8 64-bit final
|
||||
MacOS High Sierra 10.13.6 x86_64
|
||||
@ -972,7 +972,7 @@ writes the credentials into the file oauth2.txt.
|
||||
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
|
||||
C:\GAMADV-XTD3>gam version
|
||||
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
|
||||
GAMADV-XTD3 6.63.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.63.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.11.5 64-bit final
|
||||
Windows-10-10.0.17134 AMD64
|
||||
|
@ -548,8 +548,8 @@ No events are deleted unless you specify the `doit` option; omit `doit` to verif
|
||||
|
||||
When events are deleted from a calendar, they are moved to the calendar's trash and are only permanently deleted (purged) after 30 days.
|
||||
Following a suggestion here (https://stackoverflow.com/questions/41043053/how-to-empty-calendar-trash-via-google-services) you can permanently delete
|
||||
calendar events. This is achieved by creating a temporary calendar, deleting the events, moving the deleted events to the temporary calendar
|
||||
and then deleting the temporary calendar.
|
||||
calendar events with `purge events`. This is achieved by creating a temporary calendar, deleting the events, moving the deleted events to the temporary calendar
|
||||
and then deleting the temporary calendar.
|
||||
|
||||
## Delete all calendar events
|
||||
For a user's primary calendar:
|
||||
|
@ -38,6 +38,7 @@
|
||||
- [Print domain counts for users in a specific domain and/or selected by a query](#print-domain-counts-for-users-in-a-specific-domain-and-or-selected-by-a-query)
|
||||
- [Print domain counts for users specified by `<UserTypeEntity>`](#print-domain-counts-for-users-specified-by-usertypeentity)
|
||||
- [Print user list](#print-user-list)
|
||||
- [Display user count](#display-user-count)
|
||||
|
||||
## API documentation
|
||||
* https://developers.google.com/admin-sdk/directory/reference/rest/v1/users
|
||||
@ -1087,7 +1088,7 @@ When using the `formatjson` option, double quotes are used extensively in the da
|
||||
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.
|
||||
|
||||
### Print user list
|
||||
## Print user list
|
||||
Print a CSV file with headers `title,count,users` that displays the list of users in `<UserTypeEntity>` in a single row.
|
||||
```
|
||||
gam <UserTypeEntity> print userlist [todrive <ToDriveAttribute>*]
|
||||
@ -1177,4 +1178,11 @@ Got 12 Users in the Organizational Unit for /Test...
|
||||
Got 4 Users directly in the Organizational Unit for /Test
|
||||
$ more UsersList.csv
|
||||
["testuser1@domain.org", "testuser2@domain.org", "testuser3@domain.org", "testuser4@domain.org"]
|
||||
```
|
||||
```
|
||||
|
||||
## Display user count
|
||||
Display the number of users in an entity.
|
||||
```
|
||||
gam <UserTypeEntity> show count
|
||||
```
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
Print the current version of Gam with details
|
||||
```
|
||||
gam version
|
||||
GAMADV-XTD3 6.63.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.63.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.11.5 64-bit final
|
||||
MacOS Monterey 12.6.6 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 6.63.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.63.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.11.5 64-bit final
|
||||
MacOS Monterey 12.6.6 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 6.63.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
GAMADV-XTD3 6.63.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.11.5 64-bit final
|
||||
MacOS Monterey 12.6.6 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: 6.63.09
|
||||
Latest: 6.63.10
|
||||
echo $?
|
||||
1
|
||||
```
|
||||
@ -72,7 +72,7 @@ echo $?
|
||||
Print the current version number without details
|
||||
```
|
||||
gam version simple
|
||||
6.63.09
|
||||
6.63.10
|
||||
```
|
||||
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 6.63.09 - https://github.com/taers232c/GAMADV-XTD3
|
||||
GAM 6.63.10 - https://github.com/taers232c/GAMADV-XTD3
|
||||
Ross Scroggs <ross.scroggs@gmail.com>
|
||||
Python 3.11.5 64-bit final
|
||||
MacOS Monterey 12.6.6 x86_64
|
||||
|
@ -2295,6 +2295,10 @@ Print no header row and deviceId for specified CrOS devices.
|
||||
gam <CrOSTypeEntity> print
|
||||
gam <CrOSTypeEntity> print cros
|
||||
|
||||
Show count of CrOS devices
|
||||
|
||||
gam <CrOSTypeEntity> show count
|
||||
|
||||
Print activity for selected CrOS devices; use these options to select CrOS devices:
|
||||
[(query <QueryCrOS>)|(queries <QueryCrOSList>) [querytime.* <Time>]
|
||||
[(limittoou|cros_ou <OrgUnitItem>)|(cros_ou_and_children <OrgUnitItem>)|
|
||||
@ -5331,6 +5335,10 @@ gam <UserTypeEntity> print userlist [todrive <ToDriveAttribute>*]
|
||||
[title <String>]
|
||||
[delimiter <Character>] [formatjson] [quotechar <Character>]
|
||||
|
||||
Show count of users
|
||||
|
||||
gam <UserTypeEntity> show count
|
||||
|
||||
# Users - Application Specific Passwords/backup Codes
|
||||
|
||||
gam <UserTypeEntity> delete asps|applicationspecificpasswords all|<ASPIDList>
|
||||
|
@ -2,6 +2,16 @@
|
||||
|
||||
Merged GAM-Team version
|
||||
|
||||
6.63.10
|
||||
|
||||
Added commands to show the number of CrOS devices or Users in an entity.
|
||||
```
|
||||
gam <CrOSTypeEntity> show count
|
||||
gam <UserTypeEntity> show count
|
||||
```
|
||||
|
||||
Updated `gam create project` to prompt user to mark `GAM Project Creation` as a trusted app.
|
||||
|
||||
6.63.09
|
||||
|
||||
Updated `gam create teamdrive` to handle the following error:
|
||||
|
@ -191,6 +191,8 @@ GAM_USER_AGENT = (f'{GAM} {__version__} - {GAM_URL} / '
|
||||
GAM_RELEASES = f'https://github.com/{GIT_USER}/{GAM}/releases'
|
||||
GAM_WIKI = f'https://github.com/{GIT_USER}/{GAM}/wiki'
|
||||
GAM_LATEST_RELEASE = f'https://api.github.com/repos/{GIT_USER}/{GAM}/releases/latest'
|
||||
GAM_PROJECT_CREATION = 'GAM Project Creation'
|
||||
GAM_PROJECT_CREATION_CLIENT_ID = '297408095146-fug707qsjv4ikron0hugpevbrjhkmsk7.apps.googleusercontent.com'
|
||||
|
||||
TRUE = 'true'
|
||||
FALSE = 'false'
|
||||
@ -10027,6 +10029,20 @@ def doListCrOS(entityList):
|
||||
def doListUser(entityList):
|
||||
_doList(entityList, Cmd.ENTITY_USERS)
|
||||
|
||||
def _showCount(entityList, entityType):
|
||||
buildGAPIObject(API.DIRECTORY)
|
||||
checkForExtraneousArguments()
|
||||
_, count, entityList = getEntityArgument(entityList)
|
||||
actionPerformedNumItems(count, entityType)
|
||||
|
||||
# gam <CrOSTypeEntity> show count
|
||||
def showCountCrOS(entityList):
|
||||
_showCount(entityList, Ent.CHROME_DEVICE)
|
||||
|
||||
# gam <UserTypeEntity> show count
|
||||
def showCountUser(entityList):
|
||||
_showCount(entityList, Ent.USER)
|
||||
|
||||
VALIDEMAIL_PATTERN = re.compile(r'^[^@]+@[^@]+\.[^@]+$')
|
||||
|
||||
def _getValidateLoginHint(login_hint, projectId=None):
|
||||
@ -10717,7 +10733,7 @@ def doOAuthExport():
|
||||
|
||||
def getCRMService(login_hint):
|
||||
scopes = [API.CLOUD_PLATFORM_SCOPE]
|
||||
client_id = '297408095146-fug707qsjv4ikron0hugpevbrjhkmsk7.apps.googleusercontent.com'
|
||||
client_id = GAM_PROJECT_CREATION_CLIENT_ID
|
||||
client_secret = 'qM3dP8f_4qedwzWQE1VR4zzU'
|
||||
credentials = Credentials.from_client_secrets(
|
||||
client_id,
|
||||
@ -10933,7 +10949,7 @@ def _createClientSecretsOauth2service(httpObj, login_hint, appInfo, projectInfo,
|
||||
}}'''
|
||||
writeFile(GC.Values[GC.CLIENT_SECRETS_JSON], cs_data, continueOnError=False)
|
||||
sys.stdout.write(Msg.GO_BACK_TO_YOUR_BROWSER_AND_CLICK_OK_TO_CLOSE_THE_OAUTH_CLIENT_POPUP)
|
||||
sys.stdout.write(Msg.TRUST_GAM_CLIENT_ID.format(client_id))
|
||||
sys.stdout.write(Msg.TRUST_GAM_CLIENT_ID.format(GAM, client_id))
|
||||
readStdin('')
|
||||
sys.stdout.write(Msg.YOUR_GAM_PROJECT_IS_CREATED_AND_READY_TO_USE)
|
||||
|
||||
@ -11238,6 +11254,8 @@ def doCreateGCPFolder():
|
||||
# [saname <ServiceAccountName>] [sadisplayname <ServiceAccountDisplayName>>] [sadescription <ServiceAccountDescription>]
|
||||
def doCreateProject():
|
||||
_checkForExistingProjectFiles([GC.Values[GC.OAUTH2SERVICE_JSON], GC.Values[GC.CLIENT_SECRETS_JSON]])
|
||||
sys.stdout.write(Msg.TRUST_GAM_CLIENT_ID.format(GAM_PROJECT_CREATION, GAM_PROJECT_CREATION_CLIENT_ID))
|
||||
readStdin('')
|
||||
crm, httpObj, login_hint, appInfo, projectInfo, svcAcctInfo = _getLoginHintProjectInfo(True)
|
||||
login_domain = getEmailAddressDomain(login_hint)
|
||||
body = {'projectId': projectInfo['projectId'], 'displayName': projectInfo['name']}
|
||||
@ -70415,10 +70433,16 @@ CROS_COMMANDS_WITH_OBJECTS = {
|
||||
{Cmd.ARG_DEVICEFILE: getCrOSDeviceFiles,
|
||||
}
|
||||
),
|
||||
'show':
|
||||
(Act.SHOW,
|
||||
{Cmd.ARG_COUNT: showCountCrOS,
|
||||
}
|
||||
),
|
||||
}
|
||||
|
||||
CROS_COMMANDS_OBJ_ALIASES = {
|
||||
Cmd.ARG_DEVICEFILES: Cmd.ARG_DEVICEFILE,
|
||||
Cmd.ARG_COUNTS: Cmd.ARG_COUNT,
|
||||
}
|
||||
|
||||
# <UserTypeEntity> commands
|
||||
@ -70807,6 +70831,7 @@ USER_COMMANDS_WITH_OBJECTS = {
|
||||
Cmd.ARG_CLASSROOMINVITATION: printShowClassroomInvitations,
|
||||
Cmd.ARG_CLASSROOMPROFILE: printShowClassroomProfile,
|
||||
Cmd.ARG_CONTACTDELEGATE: printShowContactDelegates,
|
||||
Cmd.ARG_COUNT: showCountUser,
|
||||
Cmd.ARG_DATASTUDIOASSET: printShowDataStudioAssets,
|
||||
Cmd.ARG_DATASTUDIOPERMISSION: printShowDataStudioPermissions,
|
||||
Cmd.ARG_DELEGATE: printShowDelegates,
|
||||
@ -71006,6 +71031,7 @@ USER_COMMANDS_OBJ_ALIASES = {
|
||||
Cmd.ARG_CONTACTGROUPS: Cmd.ARG_PEOPLECONTACTGROUP,
|
||||
Cmd.ARG_CONTACTPHOTO: Cmd.ARG_PEOPLECONTACTPHOTO,
|
||||
Cmd.ARG_CONTACTPHOTOS: Cmd.ARG_PEOPLECONTACTPHOTO,
|
||||
Cmd.ARG_COUNTS: Cmd.ARG_COUNT,
|
||||
Cmd.ARG_DATASTUDIOASSETS: Cmd.ARG_DATASTUDIOASSET,
|
||||
Cmd.ARG_DATASTUDIOPERMISSIONS: Cmd.ARG_DATASTUDIOPERMISSION,
|
||||
Cmd.ARG_DELEGATES: Cmd.ARG_DELEGATE,
|
||||
|
@ -503,6 +503,8 @@ class GamCLArgs():
|
||||
ARG_CONTACTGROUPS = 'contactgroups'
|
||||
ARG_CONTACTPHOTO = 'contactphoto'
|
||||
ARG_CONTACTPHOTOS = 'contactphotos'
|
||||
ARG_COUNT = 'count'
|
||||
ARG_COUNTS = 'counts'
|
||||
ARG_COURSE = 'course'
|
||||
ARG_COURSES = 'courses'
|
||||
ARG_COURSEANNOUNCEMENTS = 'courseannouncements'
|
||||
|
@ -72,7 +72,7 @@ Is not a valid Client Secret.
|
||||
Please make sure you are following the directions exactly and that there are no extra spaces in your Client Secret.
|
||||
'''
|
||||
TRUST_GAM_CLIENT_ID = '''
|
||||
Now it's important to mark the GAM Client ID as trusted by your Workspace instance.
|
||||
It's important to mark the {0} Client ID as trusted by your Workspace instance.
|
||||
|
||||
Please go to:
|
||||
|
||||
@ -81,13 +81,14 @@ Please go to:
|
||||
1. Click on: Add app > OAuth App Name Or Client ID.
|
||||
2. Enter the following Client ID value:
|
||||
|
||||
{0}
|
||||
{1}
|
||||
|
||||
3. Press Search, select the GAM app, press Select, check the box and press Select.
|
||||
3. Press Search, select the {0} app, press Select, check the box and press Select.
|
||||
4. Keep the default scope or select a preferred scope that includes your GAM admin.
|
||||
5. Press Continue
|
||||
6. Select Trusted radio button, press Continue and Finish.
|
||||
7. Press enter once trust is complete.'
|
||||
7. Press Confirm if Confirm parental consent pops up
|
||||
8. Press enter here on the terminal once trust is complete.
|
||||
'''
|
||||
|
||||
YOUR_GAM_PROJECT_IS_CREATED_AND_READY_TO_USE = 'That\'s it! Your GAM Project is created and ready to use.\n'
|
||||
|
Reference in New Issue
Block a user