查找所有未使用双因素身份验证的 Google Apps 用户 [英] Find all Google Apps users not using two-factor authentication

查看:33
本文介绍了查找所有未使用双因素身份验证的 Google Apps 用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在为所有 Google Apps 用户实施两步验证.

We're implementing two-factor authentication for all of our Google Apps users.

我根据 Google 提供的示例编写了一个脚本来列出 Google Apps 域中的用户 (https://developers.google.com/apps-script/advanced/admin-sdk-directory#list_all_users)

I've written a script to list the users in a Google Apps domain based on the sample that Google provides (https://developers.google.com/apps-script/advanced/admin-sdk-directory#list_all_users)

我想按使用或未使用双因素身份验证的用户过滤该列表,但我在用户 API 中找不到任何允许我这样做的地方.

I'd like to filter that list by users who are or aren't using two-factor authentication but I cannot find anywhere in the User API that allows me to do this.

有谁知道我可以知道用户是否在使用双因素身份验证?

Does anyone know who I can find out if a user is using two-factor authentication or not?

推荐答案

我在 Reporting API(Admin SDK 的).

I found this info in the Reporting API (of the Admin SDK).

这是我刚刚写的一个片段:

Here's a snippet I just wrote:

function logUsers2step() {    
  var date = toISODate(new Date(Date.now()-3*24*60*60*1000));
  var reports = AdminReports.UserUsageReport.get('all', date).usageReports;
  nextReport: for( var r in reports ) {
    for( var p in reports[r].parameters )
      if( reports[r].parameters[p].name == 'accounts:is_2sv_enrolled' ) {
        Logger.log(reports[r].parameters[p].boolValue+' '+reports[r].entity.userEmail);
        continue nextReport;
      }
    Logger.log('not found '+reports[r].entity.userEmail);
  }
}

function toISODate(date) { return date.getFullYear()+'-'+pad(date.getMonth()+1)+'-'+pad(date.getDate()); }

function pad(number) { return number < 10 ? '0' + number : number; }

顺便说一下,您似乎可以在 Apps Dashboard 上查看此报告,甚至可以强制您的用户去做.

By the way, it seems you can have this report on the Apps Dashboard and can even enforce your users to do it.

这篇关于查找所有未使用双因素身份验证的 Google Apps 用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆