mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-08 21:53:36 +00:00
Merge branch 'master' of https://github.com/jay0lee/GAM
This commit is contained in:
11
src/gam.py
11
src/gam.py
@ -1214,17 +1214,17 @@ def doCheckServiceAccount(users):
|
|||||||
for scope in scopes:
|
for scope in scopes:
|
||||||
if scope in all_scopes:
|
if scope in all_scopes:
|
||||||
continue # don't check same scope twice
|
continue # don't check same scope twice
|
||||||
all_scopes.append(scope)
|
all_scopes.append((api, scope))
|
||||||
all_scopes = sorted(all_scopes)
|
all_scopes = sorted(all_scopes)
|
||||||
for scope in all_scopes:
|
for scope in all_scopes:
|
||||||
try:
|
try:
|
||||||
service = buildGAPIServiceObject(api, act_as=user, use_scopes=scope)
|
service = buildGAPIServiceObject(scope[0], act_as=user, use_scopes=scope[1])
|
||||||
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'
|
||||||
all_scopes_pass = False
|
all_scopes_pass = False
|
||||||
print u' Scope: {0:60} {1}'.format(scope, result)
|
print u' Scope: {0:60} {1}'.format(scope[1], result)
|
||||||
service_account = service._http.request.credentials.serialization_data[u'client_id']
|
service_account = service._http.request.credentials.serialization_data[u'client_id']
|
||||||
if all_scopes_pass:
|
if all_scopes_pass:
|
||||||
print u'\nAll scopes passed!\nService account %s is fully authorized.' % service_account
|
print u'\nAll scopes passed!\nService account %s is fully authorized.' % service_account
|
||||||
@ -1241,7 +1241,7 @@ and grant Client name:
|
|||||||
|
|
||||||
Access to scopes:
|
Access to scopes:
|
||||||
|
|
||||||
%s\n''' % (user_domain, service_account, ',\n'.join(all_scopes))
|
%s\n''' % (user_domain, service_account, ',\n'.join([scope[1] for scope in all_scopes]))
|
||||||
sys.exit(int(not all_scopes_pass))
|
sys.exit(int(not all_scopes_pass))
|
||||||
|
|
||||||
def showReport():
|
def showReport():
|
||||||
@ -10805,6 +10805,9 @@ def ProcessGAMCommand(args):
|
|||||||
checkWhat = sys.argv[4].replace(u'_', '').lower()
|
checkWhat = sys.argv[4].replace(u'_', '').lower()
|
||||||
if checkWhat == u'serviceaccount':
|
if checkWhat == u'serviceaccount':
|
||||||
doCheckServiceAccount(users)
|
doCheckServiceAccount(users)
|
||||||
|
else:
|
||||||
|
print u'ERROR: %s is not a valid argument for "gam <users> check"' % checkWhat
|
||||||
|
sys.exit(2)
|
||||||
elif command == u'profile':
|
elif command == u'profile':
|
||||||
doProfile(users)
|
doProfile(users)
|
||||||
elif command == u'imap':
|
elif command == u'imap':
|
||||||
|
Reference in New Issue
Block a user