mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-09 14:13:35 +00:00
Merge branch 'master' of https://github.com/jay0lee/GAM
This commit is contained in:
17
src/gam.py
17
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():
|
||||||
@ -6853,9 +6853,9 @@ def doCreateProject():
|
|||||||
for i in range(3):
|
for i in range(3):
|
||||||
project_id += u'-%s' % ''.join(random.choice(string.digits + string.ascii_lowercase) for i in range(3))
|
project_id += u'-%s' % ''.join(random.choice(string.digits + string.ascii_lowercase) for i in range(3))
|
||||||
project_name = u'project:%s' % project_id
|
project_name = u'project:%s' % project_id
|
||||||
scope=u'https://www.googleapis.com/auth/cloud-platform'
|
scope = u'https://www.googleapis.com/auth/cloud-platform'
|
||||||
client_id=u'297408095146-fug707qsjv4ikron0hugpevbrjhkmsk7.apps.googleusercontent.com'
|
client_id = u'297408095146-fug707qsjv4ikron0hugpevbrjhkmsk7.apps.googleusercontent.com'
|
||||||
client_secret=u'qM3dP8f_4qedwzWQE1VR4zzU'
|
client_secret = u'qM3dP8f_4qedwzWQE1VR4zzU'
|
||||||
flow = oauth2client.client.OAuth2WebServerFlow(client_id=client_id,
|
flow = oauth2client.client.OAuth2WebServerFlow(client_id=client_id,
|
||||||
client_secret=client_secret, scope=scope, redirect_uri=oauth2client.client.OOB_CALLBACK_URN,
|
client_secret=client_secret, scope=scope, redirect_uri=oauth2client.client.OOB_CALLBACK_URN,
|
||||||
user_agent=GAM_INFO, access_type=u'online', response_type=u'code', login_hint=login_hint)
|
user_agent=GAM_INFO, access_type=u'online', response_type=u'code', login_hint=login_hint)
|
||||||
@ -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