javascript - How do I edit scopes? // Google Classroom control permission scopes in google apps scripts for student access -


i high school teacher writing google apps script against google classroom. want create spreadsheet view of students grades students can access credentials.

i have written code can run privileges explicitly placing student's id in code. additionally, have written code in python can explicitly set 2 scopes student needs access (and this) information. however, google apps scripts automatic scope generation has me stymied because can't explicitly ask 2 scopes want.

here 2 scopes worked when wrote in python:

scopes = ['https://www.googleapis.com/auth/classroom.coursework.me.readonly https://www.googleapis.com/auth/classroom.student-submissions.me.readonly'] 

and here scopes automatically generated google apps scripts.

5 oauth scopes required script: https://www.googleapis.com/auth/classroom.courses https://www.googleapis.com/auth/classroom.coursework.students https://www.googleapis.com/auth/classroom.profile.emails https://www.googleapis.com/auth/classroom.profile.photos https://www.googleapis.com/auth/classroom.rosters 

here code:

function doget() {   return htmlservice.createhtmloutputfromfile('index'); }  function getmygrades() {   var pagetoken;   var studentsubmissionsarray = [];     //get student submissions logged in student running app   {   var optionalargs = {     'pagetoken': pagetoken,     'userid' : 'me',   };   var response = classroom.courses.coursework.studentsubmissions.list(courseid='7131560586', courseworkid='-', optionalargs);   var studentsubmissions = response.studentsubmissions;   if (studentsubmissions && studentsubmissions.length > 0) {     (i = 0; < studentsubmissions.length; i++) {       var studentsubmission = studentsubmissions[i];       var courseworkresponse = classroom.courses.coursework.get(courseid = '7131560586', id = studentsubmission.courseworkid)       var studentsubmissionarray = [courseworkresponse.title, courseworkresponse.maxpoints];       studentsubmissionarray.push(studentsubmission.assignedgrade, studentsubmission.courseworktype, studentsubmission.late, studentsubmission.state, studentsubmission.courseworkid);       studentsubmissionsarray.push(studentsubmissionarray);     }   } else {     studentsubmissionstable = "no students found";   }         pagetoken = response.nextpagetoken;    } while (pagetoken);    studentsubmissionsarray.sort()    var studentsubmissionstable = "<table border = 1, cellpadding = 8><tr><th>#</th><th>title</th><th>max points</th><th>assigned grade</th><th>type</th><th>late</th><th>state</th><th>coursework id</th></tr>"   if (studentsubmissionsarray && studentsubmissionsarray.length > 0) {     (i = 0; < studentsubmissionsarray.length; i++) {       c = + 1;       studentsubmissionarray = studentsubmissionsarray[i];       studentsubmissionstable = studentsubmissionstable + '<tr><td>'+c+'</td><td>'+ studentsubmissionarray[0] + '</td><td>' + studentsubmissionarray[1] + '</td><td>' + studentsubmissionarray[2] + '</td><td>' + studentsubmissionarray[3] + '</td><td>' + studentsubmissionarray[4] + '</td><td>' + studentsubmissionarray[5] + '</td><td>' + studentsubmissionarray[6] + '</td></tr>'     }     studentsubmissionstable = studentsubmissionstable + '</table>'   }    return studentsubmissionstable } 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -