mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-10 06:33:34 +00:00
Set consent on "use project", ignore 409 project exists
This commit is contained in:
@ -6247,8 +6247,12 @@ def setGAMProjectConsentScreen(httpObj, projectId, login_hint):
|
|||||||
print('Setting GAM project consent screen...')
|
print('Setting GAM project consent screen...')
|
||||||
iap = getService('iap', httpObj)
|
iap = getService('iap', httpObj)
|
||||||
body = {'applicationTitle': 'GAM', 'supportEmail': login_hint}
|
body = {'applicationTitle': 'GAM', 'supportEmail': login_hint}
|
||||||
gapi.call(iap.projects().brands(), 'create',
|
try:
|
||||||
parent=f'projects/{projectId}', body=body)
|
gapi.call(iap.projects().brands(), 'create',
|
||||||
|
parent=f'projects/{projectId}', body=body,
|
||||||
|
throw_reasons=[gapi_errors.ErrorReason.FOUR_O_NINE])
|
||||||
|
except googleapiclient.errors.HttpError:
|
||||||
|
pass
|
||||||
|
|
||||||
def _createClientSecretsOauth2service(httpObj, projectId, login_hint, create_project):
|
def _createClientSecretsOauth2service(httpObj, projectId, login_hint, create_project):
|
||||||
|
|
||||||
@ -6579,6 +6583,7 @@ and accept the Terms of Service (ToS). As soon as you've accepted the ToS popup,
|
|||||||
def doUseProject():
|
def doUseProject():
|
||||||
_checkForExistingProjectFiles()
|
_checkForExistingProjectFiles()
|
||||||
_, httpObj, login_hint, projectId, _ = _getLoginHintProjectId(False)
|
_, httpObj, login_hint, projectId, _ = _getLoginHintProjectId(False)
|
||||||
|
setGAMProjectConsentScreen(httpObj, projectId, login_hint)
|
||||||
_createClientSecretsOauth2service(httpObj, projectId, login_hint, False)
|
_createClientSecretsOauth2service(httpObj, projectId, login_hint, False)
|
||||||
|
|
||||||
def doUpdateProjects():
|
def doUpdateProjects():
|
||||||
|
@ -110,12 +110,15 @@ class ErrorReason(Enum):
|
|||||||
BAD_REQUEST = 'badRequest'
|
BAD_REQUEST = 'badRequest'
|
||||||
CONDITION_NOT_MET = 'conditionNotMet'
|
CONDITION_NOT_MET = 'conditionNotMet'
|
||||||
CYCLIC_MEMBERSHIPS_NOT_ALLOWED = 'cyclicMembershipsNotAllowed'
|
CYCLIC_MEMBERSHIPS_NOT_ALLOWED = 'cyclicMembershipsNotAllowed'
|
||||||
|
DAILY_LIMIT_EXCEEDED = 'dailyLimitExceeded'
|
||||||
DOMAIN_CANNOT_USE_APIS = 'domainCannotUseApis'
|
DOMAIN_CANNOT_USE_APIS = 'domainCannotUseApis'
|
||||||
DOMAIN_NOT_FOUND = 'domainNotFound'
|
DOMAIN_NOT_FOUND = 'domainNotFound'
|
||||||
DUPLICATE = 'duplicate'
|
DUPLICATE = 'duplicate'
|
||||||
FAILED_PRECONDITION = 'failedPrecondition'
|
FAILED_PRECONDITION = 'failedPrecondition'
|
||||||
FORBIDDEN = 'forbidden'
|
FORBIDDEN = 'forbidden'
|
||||||
|
FOUR_O_NINE = '409'
|
||||||
FOUR_O_THREE = '403'
|
FOUR_O_THREE = '403'
|
||||||
|
FOUR_TWO_NINE = '429'
|
||||||
GATEWAY_TIMEOUT = 'gatewayTimeout'
|
GATEWAY_TIMEOUT = 'gatewayTimeout'
|
||||||
GROUP_NOT_FOUND = 'groupNotFound'
|
GROUP_NOT_FOUND = 'groupNotFound'
|
||||||
INTERNAL_ERROR = 'internalError'
|
INTERNAL_ERROR = 'internalError'
|
||||||
@ -134,8 +137,6 @@ class ErrorReason(Enum):
|
|||||||
SYSTEM_ERROR = 'systemError'
|
SYSTEM_ERROR = 'systemError'
|
||||||
USER_NOT_FOUND = 'userNotFound'
|
USER_NOT_FOUND = 'userNotFound'
|
||||||
USER_RATE_LIMIT_EXCEEDED = 'userRateLimitExceeded'
|
USER_RATE_LIMIT_EXCEEDED = 'userRateLimitExceeded'
|
||||||
FOUR_TWO_NINE = '429'
|
|
||||||
DAILY_LIMIT_EXCEEDED = 'dailyLimitExceeded'
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.value)
|
return str(self.value)
|
||||||
|
Reference in New Issue
Block a user