REST Service for POPCORN - ILIAS
alex
2025-07-11 3a06e3121dd540e7c26fa691b967717a9300731a
lib/db.js
@@ -44,7 +44,8 @@
   getUdf,
   getMemberRoleForCourse,
   getKursTeilnehmerRolle,
   getKursTeilnehmerByRole,
   setStatus,
}
@@ -172,6 +173,10 @@
/////// obj_id / ref_id ////////////////////////////////////////////////////////////////
/**
 * @param refId
 * @returns {Promise<{ref_id,obj_id}|undefined>}
 */
async function getObjIdFromRefId (refId) {
   const pool = await poolP
   const [results] = await pool.query(
@@ -402,7 +407,7 @@
/////// ROLLEN ////////////////////////////////////////////////////////////////
async function getMemberRoleForCourse (obj_id) {
async function getKursTeilnehmerRolle (obj_id) {
   const pool = await poolP
   const q = `SELECT obj_id, title, description
              from object_data od
@@ -420,6 +425,22 @@
   }
}
async function getKursTeilnehmerByRole (obj_id) {
   const pool = await poolP
   const q = `
       SELECT obj_id as role_id, ru.usr_id, ud.firstname, ud.lastname
       FROM ${database}.object_data od
                INNER JOIN ${database}.rbac_ua ru ON ru.rol_id = od.obj_id
                INNER JOIN ${database}.usr_data ud ON ud.usr_id = ru.usr_id
       WHERE type = "role" #AND title LIKE 'il_crs_member_157'
                AND od.description LIKE 'Member%${obj_id}'
   `
   const [results] = await pool.query(q)
   return results
}
/////// STATUS ////////////////////////////////////////////////////////////////
/**