要设置哪些管理员角色设置才能访问域的 Google 课堂 API?

What Admin Roles settings to set to be able to access Google Classroom API for the domain?

我们正在尝试创建一个单独的管理员角色来分配给用户,以便能够调用 Google 课堂 API(域)。如果我们将它们设置为 'super admin' 它可以工作,但我们不想给这些用户超级管理员权限。有人知道任何指南或设置吗?

答案:

除了 Super Admin 之外,没有任何角色可以让用户执行所有这些操作。您可以通过 assigning custom admin roles 向用户核实。即使检查了所有可能的权限,如果用户不是 Super Admin,则用户不能在课堂 API.

中充当域管理员

非超级管理员可以做什么:

非超级管理员用户只能访问他们属于的课程(作为教师或学生),而不是域中的所有课程。

他们可以直接通过courses.teachers.delete and courses.students.delete, but they cannot directly add new students and teachers to their courses via courses.teachers.create and courses.students.create. Only domain administrators (Super Admins) can do that. Non-admins must first send an invitation via invitations.create()从他们拥有的课程中删除学生和其他教师,并获得用户的同意。

更新:服务帐户:

您还可以让您的应用程序使用服务帐户来模拟超级管理员,这样该帐户就可以代表该管理员执行操作,并执行管理员可以执行的操作。为此,您必须 create the Service Account and delegate domain-wide authority to it, by visiting the Admin console and following the steps specified here.

注意,授予全域授权是一个非常强大的工具,因为它赋予服务帐户代表域中任何用户的能力domain,所以管理不当很容易被滥用(没有domain-wide delegation,Service Account和普通account一样,只能访问资源由它创建、与它共享等,就像普通帐户一样)。

无论如何,一旦创建了域范围的委派,在您的应用程序中使用服务帐户与使用常规帐户非常相似。在应用程序中,您必须构建凭据,然后通过写入用户的电子邮件地址来指定该帐户应模拟哪个用户。我不知道您使用的是哪种语言,但您可以在 Java 和 Python here, or with Node .

中找到执行此操作的代码片段

参考: