From 8d33fafb3224360f49f6ebc9e1b98f4fbdc1d1ad Mon Sep 17 00:00:00 2001
From: alex <alex@alexloehr.net>
Date: Wed, 25 Jun 2025 07:09:10 +0000
Subject: [PATCH] GS-2169
---
lib/db.js | 27 +++++++++++++++++++++++++--
1 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/lib/db.js b/lib/db.js
index 028b5b0..48215e6 100644
--- a/lib/db.js
+++ b/lib/db.js
@@ -41,6 +41,8 @@
getKursTeilnehmerCount,
getUdf,
+
+ getMemberRoleForCourse,
}
/////////////////////////////////////////////////////////////////////////
@@ -355,9 +357,30 @@
/////// UDF ////////////////////////////////////////////////////////////////
-async function getUdf() {
+async function getUdf () {
const pool = await poolP
- const q = `SELECT field_id, field_name, field_type from ${database}.udf_definition;`
+ const q = `SELECT field_id, field_name, field_type
+ from ${database}.udf_definition;`
const [results] = await pool.query(q)
return results
}
+
+/////// ROLLEN ////////////////////////////////////////////////////////////////
+
+async function getMemberRoleForCourse (obj_id) {
+ const pool = await poolP
+ const q = `SELECT obj_id, title, description
+ from object_data od
+ WHERE type = "role" #AND title LIKE 'il_crs_member_157'
+ AND od.description LIKE 'Member%${obj_id}'
+ `
+ const [results] = await pool.query(q)
+ // darf nur einen Treffer ergeben
+ if (results.length) {
+ const {obj_id, title, description} = results[0]
+ return obj_id
+ }
+ else {
+ return null
+ }
+}
--
Gitblit v1.8.0