aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2026-06-10 15:26:26 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2026-06-10 15:26:26 +0200
commit5067aa19a28a32bab8d4489f9948fef9a58bbd68 (patch)
tree7de56cae43036933fc3acb86e837ab72e8927ee1
parent159b0fdc75dccecdf6b33b98a3eca6072ae33a83 (diff)
downloadbycs-sol-5067aa19a28a32bab8d4489f9948fef9a58bbd68.tar.gz
bycs-sol-5067aa19a28a32bab8d4489f9948fef9a58bbd68.zip
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.
-rw-r--r--cockpit/js/cockpit.js8
1 files 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);
}