mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-09 14:13:35 +00:00
more details on check serviceaccount
This commit is contained in:
@ -1199,16 +1199,25 @@ def buildGplusGAPIObject(user):
|
|||||||
|
|
||||||
def doCheckServiceAccount(users):
|
def doCheckServiceAccount(users):
|
||||||
for user in users:
|
for user in users:
|
||||||
|
failed_scopes = False
|
||||||
|
all_scopes = []
|
||||||
for api, scopes in API_SCOPE_MAPPING.items():
|
for api, scopes in API_SCOPE_MAPPING.items():
|
||||||
#print u'Checking %s access for %s' % (user, api)
|
#print u'Checking %s access for %s' % (user, api)
|
||||||
for scope in scopes:
|
for scope in scopes:
|
||||||
|
all_scopes.append(scope)
|
||||||
try:
|
try:
|
||||||
service = buildGAPIServiceObject(api, act_as=user, use_scopes=scope)
|
service = buildGAPIServiceObject(api, act_as=user, use_scopes=scope)
|
||||||
service._http.request.credentials.refresh(httplib2.Http(disable_ssl_certificate_validation=GC_Values[GC_NO_VERIFY_SSL]))
|
service._http.request.credentials.refresh(httplib2.Http(disable_ssl_certificate_validation=GC_Values[GC_NO_VERIFY_SSL]))
|
||||||
result = u'PASS'
|
result = u'PASS'
|
||||||
except oauth2client.client.HttpAccessTokenRefreshError:
|
except oauth2client.client.HttpAccessTokenRefreshError:
|
||||||
result = u'FAIL'
|
result = u'FAIL'
|
||||||
|
failed_scopes = True
|
||||||
print u'Scope: {0:60} {1}'.format(scope, result)
|
print u'Scope: {0:60} {1}'.format(scope, result)
|
||||||
|
if failed_scopes:
|
||||||
|
print u'\nSome scopes failed. Please make sure your service account is authorized for:\n\n%s' % ','.join(all_scopes)
|
||||||
|
else:
|
||||||
|
print u'\nAll scopes passed!'
|
||||||
|
return not failed_scopes
|
||||||
|
|
||||||
def showReport():
|
def showReport():
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user