This commit is contained in:
Ross Scroggs
2024-06-21 20:48:36 -07:00
parent 3f6f6a191d
commit 6964f10aa3
6 changed files with 42 additions and 22 deletions

View File

@@ -10,6 +10,15 @@ 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 See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation
### 6.77.01
Thanks to Jay, added column `verificationCodesCount` to `gam <UserTypeEntity> print backupcodes`
that displays the number of available backup codes in addtion to the codes.
Added option `countsonly` that displays only the number of available backup codes but not the codes themselves.
Thanks to Jay, added option `nokey` to `gam create project` that creates a project with no service account key, `oauth2service.json`.
### 6.77.00 ### 6.77.00
Added option `individualstudentassignments copy|delete|maptoall` to `gam create|update course ... copyfrom` Added option `individualstudentassignments copy|delete|maptoall` to `gam create|update course ... copyfrom`

View File

@@ -335,7 +335,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$ rm -f /Users/admin/GAMConfig/oauth2.txt
admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version 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 WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
GAMADV-XTD3 6.77.00 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.77.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.4 64-bit final Python 3.12.4 64-bit final
MacOS Sonoma 14.5 x86_64 MacOS Sonoma 14.5 x86_64
@@ -1009,7 +1009,7 @@ writes the credentials into the file oauth2.txt.
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
C:\GAMADV-XTD3>gam version C:\GAMADV-XTD3>gam version
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
GAMADV-XTD3 6.77.00 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.77.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.4 64-bit final Python 3.12.4 64-bit final
Windows-10-10.0.17134 AMD64 Windows-10-10.0.17134 AMD64

View File

@@ -3,7 +3,7 @@
Print the current version of Gam with details Print the current version of Gam with details
``` ```
gam version gam version
GAMADV-XTD3 6.77.00 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.77.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.4 64-bit final Python 3.12.4 64-bit final
MacOS Sonoma 14.5 x86_64 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 Print the current version of Gam with details and time offset information
``` ```
gam version timeoffset gam version timeoffset
GAMADV-XTD3 6.77.00 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.77.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.4 64-bit final Python 3.12.4 64-bit final
MacOS Sonoma 14.5 x86_64 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 Print the current version of Gam with extended details and SSL information
``` ```
gam version extended gam version extended
GAMADV-XTD3 6.77.00 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.77.01 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.4 64-bit final Python 3.12.4 64-bit final
MacOS Sonoma 14.5 x86_64 MacOS Sonoma 14.5 x86_64
@@ -64,7 +64,7 @@ MacOS High Sierra 10.13.6 x86_64
Path: /Users/Admin/bin/gamadv-xtd3 Path: /Users/Admin/bin/gamadv-xtd3
Version Check: Version Check:
Current: 5.35.08 Current: 5.35.08
Latest: 6.77.00 Latest: 6.77.01
echo $? echo $?
1 1
``` ```
@@ -72,7 +72,7 @@ echo $?
Print the current version number without details Print the current version number without details
``` ```
gam version simple gam version simple
6.77.00 6.77.01
``` ```
In Linux/MacOS you can do: In Linux/MacOS you can do:
``` ```
@@ -82,7 +82,7 @@ echo $VER
Print the current version of Gam and address of this Wiki Print the current version of Gam and address of this Wiki
``` ```
gam help gam help
GAM 6.77.00 - https://github.com/taers232c/GAMADV-XTD3 GAM 6.77.01 - https://github.com/taers232c/GAMADV-XTD3
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.4 64-bit final Python 3.12.4 64-bit final
MacOS Sonoma 14.5 x86_64 MacOS Sonoma 14.5 x86_64

View File

@@ -1346,7 +1346,7 @@ gam create project [admin <EmailAddress>] [project <ProjectID>]
[(algorithm KEY_ALG_RSA_1024|KEY_ALG_RSA_2048)| [(algorithm KEY_ALG_RSA_1024|KEY_ALG_RSA_2048)|
(localkeysize 1024|2048|4096 [validityhours <Number>])| (localkeysize 1024|2048|4096 [validityhours <Number>])|
(yubikey yubikey_pin yubikey_slot AUTHENTICATION|SIGNATURE yubikey_serialnumber <Number>)| (yubikey yubikey_pin yubikey_slot AUTHENTICATION|SIGNATURE yubikey_serialnumber <Number>)|
(nokey)] nokey]
gam use project [<EmailAddress>] [<ProjectID>] gam use project [<EmailAddress>] [<ProjectID>]
gam use project [admin <EmailAddress>] [project <ProjectID>] gam use project [admin <EmailAddress>] [project <ProjectID>]
[saname <ServiceAccountName>] [sadisplayname <ServiceAccountDisplayName>] [saname <ServiceAccountName>] [sadisplayname <ServiceAccountDisplayName>]
@@ -5628,8 +5628,7 @@ gam <UserTypeEntity> update backupcodes|verificationcodes
gam <UserTypeEntity> delete backupcodes|verificationcodes gam <UserTypeEntity> delete backupcodes|verificationcodes
gam <UserTypeEntity> show backupcodes|verificationcodes gam <UserTypeEntity> show backupcodes|verificationcodes
gam <UserTypeEntity> print backupcodes|verificationcodes [todrive <ToDriveAttribute>*] gam <UserTypeEntity> print backupcodes|verificationcodes [todrive <ToDriveAttribute>*]
[delimiter <Character>] [delimiter <Character>] [countsonly]
[countsonly]
# Users - Calendars # Users - Calendars

View File

@@ -2,6 +2,15 @@
Merged GAM-Team version Merged GAM-Team version
6.77.01
Thanks to Jay, added column `verificationCodesCount` to `gam <UserTypeEntity> print backupcodes`
that displays the number of available backup codes in addtion to the codes.
Added option `countsonly` that displays only the number of available backup codes but not the codes themselves.
Thanks to Jay, added option `nokey` to `gam create project` that creates a project with no service account key, `oauth2service.json`.
6.77.00 6.77.00
Added option `individualstudentassignments copy|delete|maptoall` to `gam create|update course ... copyfrom` Added option `individualstudentassignments copy|delete|maptoall` to `gam create|update course ... copyfrom`

View File

@@ -11213,8 +11213,10 @@ def _createOauth2serviceJSON(httpObj, projectInfo, svcAcctInfo, create_key=True)
entityActionFailedWarning([Ent.PROJECT, projectInfo['projectId'], Ent.SVCACCT, svcAcctInfo['name']], str(e)) entityActionFailedWarning([Ent.PROJECT, projectInfo['projectId'], Ent.SVCACCT, svcAcctInfo['name']], str(e))
return False return False
GM.Globals[GM.SVCACCT_SCOPES_DEFINED] = False GM.Globals[GM.SVCACCT_SCOPES_DEFINED] = False
if create_key and not doProcessSvcAcctKeys(mode='retainexisting', iam=iam, projectId=service_account['projectId'], if create_key and not doProcessSvcAcctKeys(mode='retainexisting', iam=iam,
clientEmail=service_account['email'], clientId=service_account['uniqueId']): projectId=service_account['projectId'],
clientEmail=service_account['email'],
clientId=service_account['uniqueId']):
return False return False
sa_email = service_account['name'].rsplit('/', 1)[-1] sa_email = service_account['name'].rsplit('/', 1)[-1]
_grantRotateRights(iam, projectInfo['projectId'], sa_email, sa_email) _grantRotateRights(iam, projectInfo['projectId'], sa_email, sa_email)
@@ -11231,7 +11233,6 @@ def setGAMProjectConsentScreen(httpObj, projectId, appInfo):
pass pass
def _createClientSecretsOauth2service(httpObj, login_hint, appInfo, projectInfo, svcAcctInfo, create_key=True): def _createClientSecretsOauth2service(httpObj, login_hint, appInfo, projectInfo, svcAcctInfo, create_key=True):
def _checkClientAndSecret(csHttpObj, client_id, client_secret): def _checkClientAndSecret(csHttpObj, client_id, client_secret):
post_data = {'client_id': client_id, 'client_secret': client_secret, post_data = {'client_id': client_id, 'client_secret': client_secret,
'code': 'ThisIsAnInvalidCodeOnlyBeingUsedToTestIfClientAndSecretAreValid', 'code': 'ThisIsAnInvalidCodeOnlyBeingUsedToTestIfClientAndSecretAreValid',
@@ -11391,7 +11392,7 @@ def _getLoginHintProjectInfo(createCmd):
svcAcctInfo = {'name': '', 'displayName': '', 'description': ''} svcAcctInfo = {'name': '', 'displayName': '', 'description': ''}
if not Cmd.PeekArgumentPresent(['admin', 'appname', 'supportemail', 'project', 'parent', if not Cmd.PeekArgumentPresent(['admin', 'appname', 'supportemail', 'project', 'parent',
'projectname', 'saname', 'sadisplayname', 'sadescription', 'projectname', 'saname', 'sadisplayname', 'sadescription',
'algorithm', 'localkeysize', 'validityhours', 'yubikey']): 'algorithm', 'localkeysize', 'validityhours', 'yubikey', 'nokey']):
login_hint = getString(Cmd.OB_EMAIL_ADDRESS, optional=True) login_hint = getString(Cmd.OB_EMAIL_ADDRESS, optional=True)
if login_hint and login_hint.find('@') == -1: if login_hint and login_hint.find('@') == -1:
Cmd.Backup() Cmd.Backup()
@@ -11611,7 +11612,7 @@ def doCreateGCPFolder():
# [(algorithm KEY_ALG_RSA_1024|KEY_ALG_RSA_2048)| # [(algorithm KEY_ALG_RSA_1024|KEY_ALG_RSA_2048)|
# (localkeysize 1024|2048|4096 [validityhours <Number>])| # (localkeysize 1024|2048|4096 [validityhours <Number>])|
# (yubikey yubikey_pin yubikey_slot AUTHENTICATION yubikey_serialnumber <String>)| # (yubikey yubikey_pin yubikey_slot AUTHENTICATION yubikey_serialnumber <String>)|
# (nokey)] # nokey]
def doCreateProject(): def doCreateProject():
_checkForExistingProjectFiles([GC.Values[GC.OAUTH2SERVICE_JSON], GC.Values[GC.CLIENT_SECRETS_JSON]]) _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)) sys.stdout.write(Msg.TRUST_GAM_CLIENT_ID.format(GAM_PROJECT_CREATION, GAM_PROJECT_CREATION_CLIENT_ID))
@@ -48587,11 +48588,12 @@ def deleteBackupCodes(users):
entityActionNotPerformedWarning([Ent.USER, user, Ent.BACKUP_VERIFICATION_CODES, None], entityActionNotPerformedWarning([Ent.USER, user, Ent.BACKUP_VERIFICATION_CODES, None],
Msg.IS_SUSPENDED_NO_BACKUPCODES, i, count) Msg.IS_SUSPENDED_NO_BACKUPCODES, i, count)
# gam <UserTypeEntity> print backupcodes|verificationcodes [todrive <ToDriveAttribute>*] [delimiter <Character>] [countsonly] # gam <UserTypeEntity> print backupcodes|verificationcodes [todrive <ToDriveAttribute>*]
# [delimiter <Character>] [countsonly]
# gam <UserTypeEntity> show backupcodes|verificationcodes # gam <UserTypeEntity> show backupcodes|verificationcodes
def printShowBackupCodes(users): def printShowBackupCodes(users):
cd = buildGAPIObject(API.DIRECTORY) cd = buildGAPIObject(API.DIRECTORY)
csvPF = CSVPrintFile(['User', 'verificationCodes', 'verificationCodesCount']) if Act.csvFormat() else None csvPF = CSVPrintFile(['User', 'verificationCodesCount', 'verificationCodes']) if Act.csvFormat() else None
delimiter = GC.Values[GC.CSV_OUTPUT_FIELD_DELIMITER] delimiter = GC.Values[GC.CSV_OUTPUT_FIELD_DELIMITER]
counts_only = False counts_only = False
while Cmd.ArgumentsRemaining(): while Cmd.ArgumentsRemaining():
@@ -48604,12 +48606,13 @@ def printShowBackupCodes(users):
counts_only = True counts_only = True
else: else:
unknownArgumentExit() unknownArgumentExit()
i, count, users = getEntityArgument(users)
# if we're only getting counts, we don't want actual codes pulled down # if we're only getting counts, we don't want actual codes pulled down
if counts_only: if counts_only:
csvPF.RemoveTitles('verificationCodes')
fields = 'items(etag)' fields = 'items(etag)'
else: else:
fields = 'items(verificationCode)' fields = 'items(verificationCode)'
i, count, users = getEntityArgument(users)
for user in users: for user in users:
i += 1 i += 1
user = normalizeEmailAddressOrUID(user) user = normalizeEmailAddressOrUID(user)