Open afehnker opened 4 years ago
Copy the student to the sports day course. Change the permissions.
For the sports day, I made this work using this script:
#r "nuget:FSharp.Data"
open FSharp.Data
let courseId = ""
let sportsdayCourseId = ""
let token = ""
let atelierUrl = "https://linux571.ewi.utwente.nl/api/"
type CourseUsers = JsonProvider<"""[{"userID":"A","courseID":"A","userName":"A","email":"A","permission":{"globalRole":"A","courseRole":"A","permissions":64898873567}}]""">
let users =
Http.RequestString(atelierUrl + "user/course/" + courseId, headers = [ "Authorization", token ])
|> CourseUsers.Parse
[ for user in users -> async {
let! addRes =
Http.AsyncRequest(
atelierUrl + "course/" + sportsdayCourseId + "/user/" + user.UserId + "/role/" + user.Permission.CourseRole,
httpMethod = "PUT",
headers = [ "Authorization", token ])
printfn "Adding %s, status: %i" user.UserName addRes.StatusCode
if user.Permission.CourseRole = "student" then
let! permRes =
Http.AsyncRequest(
atelierUrl + "permission/course/" + sportsdayCourseId + "/user/" + user.UserId,
httpMethod = "PUT",
headers = [ "Authorization", token; "Content-Type", "application/json" ],
body = TextRequest (sprintf """{ "permissions": { "viewRestrictedComments": true } }""")
)
printfn "Set permission for %s, status: %i" user.UserName permRes.StatusCode
} ]
|> Async.Parallel
|> Async.RunSynchronously
In general, we would want to have the option to change the permissions of any role in a course, for all the users with that role.
In a course, give them the right to see zita comments (for peer reviews)