From d67cad925d2f914c3fbf265d0a608ff709711903 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Wed, 14 Jan 2026 13:59:42 +0100 Subject: [PATCH] externe ueberwachung deaktivieren ueber config params in die config verlagert --- cis/testtool/login.php | 2 +- cis/testtool/resetconnection.php | 3 +- composer.json | 4 +- composer.lock | 59 ++++++++++++++++++- config/cis.config-default.inc.php | 2 + config/global.config-default.inc.php | 3 + include/externe_ueberwachung.class.php | 14 +++-- vilesci/stammdaten/reihungstestverwaltung.php | 2 + 8 files changed, 77 insertions(+), 12 deletions(-) diff --git a/cis/testtool/login.php b/cis/testtool/login.php index 2b4e678fa..88e8827ff 100644 --- a/cis/testtool/login.php +++ b/cis/testtool/login.php @@ -173,7 +173,7 @@ if (isset($_REQUEST['prestudent'])) $reload_menu = true; } - if ($rt->externe_ueberwachung) + if ($rt->externe_ueberwachung && defined('TESTTOOL_EXTERNE_UEBERWACHUNG_ALLOWED') && TESTTOOL_EXTERNE_UEBERWACHUNG_ALLOWED) { $_SESSION['externe_ueberwachung'] = true; $_SESSION['externe_ueberwachung_verified'] = false; diff --git a/cis/testtool/resetconnection.php b/cis/testtool/resetconnection.php index e0141ae0b..ab2806a1f 100644 --- a/cis/testtool/resetconnection.php +++ b/cis/testtool/resetconnection.php @@ -8,8 +8,7 @@ require_once('../../config/global.config.inc.php'); require_once '../../include/externe_ueberwachung.class.php'; if (!$db = new basis_db()) die('Fehler beim Oeffnen der Datenbankverbindung'); - -if (isset($_SESSION['externe_ueberwachung']) && $_SESSION['externe_ueberwachung'] === true) +if ((defined('TESTTOOL_EXTERNE_UEBERWACHUNG_ALLOWED') && TESTTOOL_EXTERNE_UEBERWACHUNG_ALLOWED) && isset($_SESSION['externe_ueberwachung']) && $_SESSION['externe_ueberwachung'] === true) { $ueberwachung = new externeUeberwachung(); $url = $ueberwachung->start($_SESSION['prestudent_id'], $_SESSION['reihungstestID'], $_SESSION['sprache']); diff --git a/composer.json b/composer.json index 35499ec61..c1f4506c6 100644 --- a/composer.json +++ b/composer.json @@ -456,6 +456,7 @@ "fortawesome/font-awesome4": "4.7.*", "fortawesome/font-awesome6": "6.1.*", "fzaninotto/faker": "1.*", + "firebase/php-jwt": "^6.0", "highcharts/highcharts-dist": "^7.1.2", @@ -517,7 +518,6 @@ "phpmd/phpmd": "2.*", "phpmetrics/phpmetrics": "2.*", "sebastian/phpcpd": "3.*", - "phpunit/phpunit": "^6", - "firebase/php-jwt": "^6.0" + "phpunit/phpunit": "^6" } } diff --git a/composer.lock b/composer.lock index f2ce3923c..7525b7f5b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1de37a74ba51a66057eb2712b21340c8", + "content-hash": "f4f0af4586f46f97d8b6092c1ac0fb3a", "packages": [ { "name": "afarkas/html5shiv", @@ -882,6 +882,63 @@ }, "type": "library" }, + { + "name": "firebase/php-jwt", + "version": "v6.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "0541cba75ab108ef901985e68055a92646c73534" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/0541cba75ab108ef901985e68055a92646c73534", + "reference": "0541cba75ab108ef901985e68055a92646c73534", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8 <=9" + }, + "suggest": { + "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "keywords": [ + "jwt", + "php" + ], + "support": { + "issues": "https://github.com/firebase/php-jwt/issues", + "source": "https://github.com/firebase/php-jwt/tree/v6.0.0" + }, + "time": "2022-01-24T15:18:34+00:00" + }, { "name": "fortawesome/font-awesome4", "version": "4.7.0", diff --git a/config/cis.config-default.inc.php b/config/cis.config-default.inc.php index 0bef3a523..cac05ec7a 100644 --- a/config/cis.config-default.inc.php +++ b/config/cis.config-default.inc.php @@ -308,5 +308,7 @@ define('EXTERNE_UEBERWACHUNG_SECRET_KEY', null); define('EXTERNE_UEBERWACHUNG_INTEGRATION_NAME', 'example'); define('EXTERNE_UEBERWACHUNG_SESSION_URL', 'https://example.com'); define('EXTERNE_UEBERWACHUNG_TRIAL_TEST', false); +define('EXTERNE_UEBERWACHUNG_EXAM_PARAMS', []); + ?> diff --git a/config/global.config-default.inc.php b/config/global.config-default.inc.php index f24a302cc..c074b7559 100644 --- a/config/global.config-default.inc.php +++ b/config/global.config-default.inc.php @@ -360,4 +360,7 @@ define('SANCHO_MAIL_HEADER_IMG', 'sancho_header_DEFAULT.jpg'); // footer image for eigene Mails define('SANCHO_MAIL_FOOTER_IMG', 'sancho_footer_DEFAULT.jpg'); + +//externe Ueberwachung im Testtool erlauben +define('TESTTOOL_EXTERNE_UEBERWACHUNG_ALLOWED', false); ?> diff --git a/include/externe_ueberwachung.class.php b/include/externe_ueberwachung.class.php index b28a8439a..a047dfd9a 100644 --- a/include/externe_ueberwachung.class.php +++ b/include/externe_ueberwachung.class.php @@ -153,18 +153,20 @@ class externeUeberwachung extends basis_db "accountId" => "technikum_wien", "examId" => $reihungstest_id . '_' . $today, "examName" => !is_null(trim($reihungstest->anmerkung)) ? ($reihungstest->anmerkung . '_' . $today) : ($reihungstest_id . '_' . $today), - "allowMultipleDisplays" => true, - "allowMakingRoomScanSecondCamera" => false, - "duration" => 600, + "duration" => 1440, "schedule" => false, "trial" => EXTERNE_UEBERWACHUNG_TRIAL_TEST, "proctoring" => "offline", - "identification" => "skip", - "startDate" => "2018-03-27T00:00:00Z", //TODO anpassen - "endDate" => "2027-03-30T12:55:00Z", // TODO anpassen + "startDate" => $reihungstest->datum . 'T00:00:00Z', + "endDate" => $reihungstest->datum . 'T23:59:59Z', "sessionId" => $session_id, "sessionUrl" => EXTERNE_UEBERWACHUNG_SESSION_URL ]; + + if (defined('EXTERNE_UEBERWACHUNG_EXAM_PARAMS')) + { + $payload = array_merge($payload, EXTERNE_UEBERWACHUNG_EXAM_PARAMS); + } return $payload; } diff --git a/vilesci/stammdaten/reihungstestverwaltung.php b/vilesci/stammdaten/reihungstestverwaltung.php index babbc3ce4..990b3e129 100644 --- a/vilesci/stammdaten/reihungstestverwaltung.php +++ b/vilesci/stammdaten/reihungstestverwaltung.php @@ -2573,12 +2573,14 @@ $studienplaene_list = implode(',', array_keys($studienplaene_arr)); (Verpflichtend, wenn die Zugangsüberprüfung aktiviert ist) + Externe Überwachnung externe_ueberwachung ? 'checked="checked"' : '' ?>> +