mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
Updated gam oauth create to warn about too many scopes
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
7.18.03
|
||||||
|
|
||||||
|
Updated `gam oauth create` to give a warning if the number of selected scopes will
|
||||||
|
probably cause Google to generate a "Something went wrong" error.
|
||||||
|
|
||||||
7.18.02
|
7.18.02
|
||||||
|
|
||||||
Upgraded to OpenSSL 3.5.2.
|
Upgraded to OpenSSL 3.5.2.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
|
||||||
__version__ = '7.18.02'
|
__version__ = '7.18.03'
|
||||||
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
|
||||||
|
|
||||||
#pylint: disable=wrong-import-position
|
#pylint: disable=wrong-import-position
|
||||||
@@ -10672,9 +10672,6 @@ Select all default scopes by entering an 's'; yields [*] for default scopes, [ ]
|
|||||||
Unselect all scopes by entering a 'u'; yields [ ] for all scopes
|
Unselect all scopes by entering a 'u'; yields [ ] for all scopes
|
||||||
Exit without changes/authorization by entering an 'e'
|
Exit without changes/authorization by entering an 'e'
|
||||||
Continue to authorization by entering a 'c'
|
Continue to authorization by entering a 'c'
|
||||||
'''
|
|
||||||
if clientAccess:
|
|
||||||
oauth2_menu += ''' Note, if all scopes are selected, Google will probably generate an authorization error
|
|
||||||
'''
|
'''
|
||||||
menu = oauth2_menu % tuple(range(numScopes))
|
menu = oauth2_menu % tuple(range(numScopes))
|
||||||
selectedScopes = ['*'] * numScopes
|
selectedScopes = ['*'] * numScopes
|
||||||
@@ -10776,6 +10773,24 @@ Continue to authorization by entering a 'c'
|
|||||||
break
|
break
|
||||||
sys.stdout.write(f'{ERROR_PREFIX}Invalid input "{choice}"\n')
|
sys.stdout.write(f'{ERROR_PREFIX}Invalid input "{choice}"\n')
|
||||||
if selection == 'c':
|
if selection == 'c':
|
||||||
|
if clientAccess:
|
||||||
|
numSelectedScopes = 0
|
||||||
|
i = 0
|
||||||
|
for a_scope in scopesList:
|
||||||
|
if selectedScopes[i] == '*':
|
||||||
|
if a_scope['scope']:
|
||||||
|
numSelectedScopes += 1
|
||||||
|
elif selectedScopes[i] != ' ':
|
||||||
|
numSelectedScopes += 1
|
||||||
|
i += 1
|
||||||
|
if numSelectedScopes <= API.NUM_CLIENT_SCOPES_ERROR_LIMIT:
|
||||||
|
break
|
||||||
|
# If number of scopes is > 48 we'll probably get an error
|
||||||
|
writeStdout(Msg.NUM_SELECTED_CLIENT_SCOPES.format(numSelectedScopes, API.NUM_CLIENT_SCOPES_ERROR_LIMIT))
|
||||||
|
choice = readStdin('\nPlease enter c to continue to authorization or any other key to amend selection: ')
|
||||||
|
if choice and choice.lower() == 'c':
|
||||||
|
break
|
||||||
|
else:
|
||||||
break
|
break
|
||||||
return selectedScopes
|
return selectedScopes
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ USERINFO_PROFILE_SCOPE = 'https://www.googleapis.com/auth/userinfo.profile' # pr
|
|||||||
VAULT_SCOPES = ['https://www.googleapis.com/auth/ediscovery', 'https://www.googleapis.com/auth/ediscovery.readonly']
|
VAULT_SCOPES = ['https://www.googleapis.com/auth/ediscovery', 'https://www.googleapis.com/auth/ediscovery.readonly']
|
||||||
REQUIRED_SCOPES = [USERINFO_EMAIL_SCOPE, USERINFO_PROFILE_SCOPE]
|
REQUIRED_SCOPES = [USERINFO_EMAIL_SCOPE, USERINFO_PROFILE_SCOPE]
|
||||||
REQUIRED_SCOPES_SET = set(REQUIRED_SCOPES)
|
REQUIRED_SCOPES_SET = set(REQUIRED_SCOPES)
|
||||||
|
NUM_CLIENT_SCOPES_ERROR_LIMIT = 48
|
||||||
#
|
#
|
||||||
JWT_APIS = {
|
JWT_APIS = {
|
||||||
ACCESSCONTEXTMANAGER: [CLOUD_PLATFORM_SCOPE],
|
ACCESSCONTEXTMANAGER: [CLOUD_PLATFORM_SCOPE],
|
||||||
|
|||||||
@@ -433,6 +433,7 @@ NO_SVCACCT_ACCESS_ALLOWED = 'No Service Account Access allowed'
|
|||||||
NO_TRANSFER_LACK_OF_DISK_SPACE = 'Transfer not performed due to lack of target drive space.'
|
NO_TRANSFER_LACK_OF_DISK_SPACE = 'Transfer not performed due to lack of target drive space.'
|
||||||
NO_USAGE_PARAMETERS_DATA_AVAILABLE = 'No usage parameters data available.'
|
NO_USAGE_PARAMETERS_DATA_AVAILABLE = 'No usage parameters data available.'
|
||||||
NO_USER_COUNTS_DATA_AVAILABLE = 'No User counts data available.'
|
NO_USER_COUNTS_DATA_AVAILABLE = 'No User counts data available.'
|
||||||
|
NUM_SELECTED_CLIENT_SCOPES = '\n{0} scopes are selected, if more than {1} scopes are selected, Google will probably generate a "Something went wrong" error\n'
|
||||||
OAUTH2_GO_TO_LINK_MESSAGE = """
|
OAUTH2_GO_TO_LINK_MESSAGE = """
|
||||||
Go to the following link in a browser on this computer or on another computer:
|
Go to the following link in a browser on this computer or on another computer:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user