def deleteTokens(users):
cd = buildGAPIObject(API.DIRECTORY)
checkArgumentPresent(u'clientid', required=True)
clientId = commonClientIds(getString(Cmd.OB_CLIENT_ID))
checkForExtraneousArguments()
i, count, users = getEntityArgument(users)
for user in users:
i += 1
user = normalizeEmailAddressOrUID(user)
try:
callGAPI(cd.tokens(), u'get',
throw_reasons=[GAPI.USER_NOT_FOUND, GAPI.DOMAIN_NOT_FOUND, GAPI.DOMAIN_CANNOT_USE_APIS, GAPI.FORBIDDEN, GAPI.NOT_FOUND, GAPI.RESOURCE_NOT_FOUND],
userKey=user, clientId=clientId, fields=u'')
callGAPI(cd.tokens(), u'delete',
throw_reasons=[GAPI.USER_NOT_FOUND, GAPI.DOMAIN_NOT_FOUND, GAPI.DOMAIN_CANNOT_USE_APIS, GAPI.FORBIDDEN, GAPI.NOT_FOUND, GAPI.RESOURCE_NOT_FOUND],
userKey=user, clientId=clientId)
entityActionPerformed([Ent.USER, user, Ent.ACCESS_TOKEN, clientId], i, count)
except (GAPI.notFound, GAPI.resourceNotFound) as e:
entityActionFailedWarning([Ent.USER, user, Ent.ACCESS_TOKEN, clientId], str(e), i, count)
except (GAPI.userNotFound, GAPI.domainNotFound, GAPI.domainCannotUseApis, GAPI.forbidden):
entityUnknownWarning(Ent.USER, user, i, count)
评论列表
文章目录