From 5067aa19a28a32bab8d4489f9948fef9a58bbd68 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 10 Jun 2026 15:26:26 +0200 Subject: cockpit: only fetch a student if the user is a teacher Fetching a student needs access to the participants of the course, which only teachers have. --- cockpit/js/cockpit.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cockpit/js/cockpit.js b/cockpit/js/cockpit.js index c6524d6..2babcea 100644 --- a/cockpit/js/cockpit.js +++ b/cockpit/js/cockpit.js @@ -9,7 +9,7 @@ import { submitGraduationChange } from "./graduation-ENV.js"; -import { fetchStudent, fetchStudents } from "./student-ENV.js"; +import { Student, fetchStudent, fetchStudents } from "./student-ENV.js"; import { isTeacher as getIsTeacher } from "../../utils-ENV.js"; import { initSelection } from "./selection.js"; @@ -26,7 +26,11 @@ function initCurrentName() { } async function loadNewStudent(id, name, group) { - student = await fetchStudent(id, name, group); + if (isTeacher) { + student = await fetchStudent(id, name, group); + } else { + student = new Student(id, name, group); + } await loadStudent(student); } -- cgit v1.2.3