From 254f14f863d824122d1e0f957304c24fb20c8a61 Mon Sep 17 00:00:00 2001 From: Tobias Werth Date: Sat, 5 Oct 2024 13:58:00 +0200 Subject: [PATCH] Add warning message in case the judgehost is not enabled. --- judge/judgedaemon.main.php | 8 ++++++++ webapp/src/Controller/API/JudgehostController.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/judge/judgedaemon.main.php b/judge/judgedaemon.main.php index b5c962ae2e..a25a229df7 100644 --- a/judge/judgedaemon.main.php +++ b/judge/judgedaemon.main.php @@ -765,6 +765,14 @@ function fetch_executable_internal( $lastWorkdir = null; } logmsg(LOG_INFO, "No submissions in queue (for endpoint $endpointID), waiting..."); + $judgehosts = request('judgehosts', 'GET'); + if ($judgehosts !== null) { + $judgehosts = dj_json_decode($judgehosts); + $judgehost = array_filter($judgehosts, fn($j) => $j['hostname'] === $myhost); + if (!isset($judgehost['enabled']) || !$judgehost['enabled']) { + logmsg(LOG_WARNING, "Judgehost needs to be enabled in web interface."); + } + } } continue; } diff --git a/webapp/src/Controller/API/JudgehostController.php b/webapp/src/Controller/API/JudgehostController.php index f9252cc5d3..21856eb082 100644 --- a/webapp/src/Controller/API/JudgehostController.php +++ b/webapp/src/Controller/API/JudgehostController.php @@ -77,7 +77,7 @@ public function __construct( * * @return Judgehost[] */ - #[IsGranted('ROLE_JURY')] + #[IsGranted(new Expression("is_granted('ROLE_JURY') or is_granted('ROLE_JUDGEHOST')"))] #[Rest\Get('')] #[OA\Response( response: 200,