REST Service for POPCORN - ILIAS
alex
2025-06-16 bf026e2c06576854685a665ecbb77f3779f2cda6
lib/libIlias.js
@@ -2,6 +2,7 @@
module.exports = {
   deleteUser,
   deleteAllUsers,
   deleteTeilnahme,
}
@@ -9,6 +10,7 @@
const settings = require("../settings")
const {getObjIdFromRefId} = require("./db")
const db = require("./db")
const {url} = settings.ilias
/////////////////////////////////////////////////////////////////////////
@@ -23,7 +25,27 @@
   let url2 = `${url}?${sp.toString()}`
   const res = await fetch(url2, {method: "DELETE"})
   const data = await res.json()
   return data
   return data //
}
async function deleteAllUsers () {
   const users = await db.getUsers()
   const res = {
      command: "deleteAllUsers",
      start: new Date(),
      end: new Date(),
      duration: null,
      count: 0,
      userIds: [],
   }
   for (const user of users) {
      await deleteUser(user.usr_id)
      res.count += 1
      res.userIds.push(user.usr_id)
   }
   res.end = new Date()
   res.duration = res.end - res.start
   return res
}
async function deleteTeilnahme (ref_id, usr_id, dry = false) {