1

有一个带有子域的域 - school.com 和 students.school.com 分别。

我使用谷歌应用脚​​本为每个班级创建了谷歌教室。

现在问题来了,
我正在尝试将教师和学生添加到谷歌教室。
我使用的“超级管理员”帐户在我的主域 (school.com) 中。

因此,我可以将教师添加到教室,但我不能将学生添加到教室,因为它属于子域(students.school.com)

这是我的代码的样子,

function addTeachers() {
  Classroom.Courses.Teachers.create({
    userId: "teacher1@school.com",
  }, "123456789");
}

function addStudents() {
  Classroom.Courses.Students.create({
    userId: "student@students.school.com",
  }, "123456789");
}

当我运行addStudents函数时,出现此错误,

Execution failed: The caller does not have permission
4

2 回答 2

2

您需要确保域已将彼此列入白名单,并允许将来自其他域的用户添加到课程中。

于 2016-12-27T10:31:49.497 回答
0

对于 Google 课堂,班级/教师在一个域中,而学生在另一个域中。在学生域中设置服务帐户。然后将域范围的权限委派给服务帐户,具有所需的范围,应该是

auth/classroom.rosters

auth/classroom.profile.emails

auth/classroom.profile.photos

并使用该服务帐户代表学生的谷歌帐户执行 course.students.create 方法(也就是同时使用 courseid 和enrollmentCode。)

于 2017-02-07T14:23:48.423 回答