forge
Explore
Log in

Don't you dare go Hollow

✨ align with backend student-only gates - client: EN/TR error strings for new 400/403 messages (enroll/grade/roll-call targets, exam sit incl. exam-room WS frame) - exam-detail: own-result fetch + section gate on isStudent(), drop unused isTeacherPlus memo - docs: guard table isStudent() + student-filtered picker rows, next-steps entry

Browse files at this commit

267d95ddf461b1033558ff890c4916aac3acae10Ahmet Kaan GümüşParent: 6097c05
  • feat
    • ✨ align with backend student-only gates - client: EN/TR error strings for new 400/403 messages (enroll/grade/roll-call targets, exam sit incl. exam-room WS frame) - exam-detail: own-result fetch + section gate on isStudent(), drop unused isTeacherPlus memo - docs: guard table isStudent() + student-filtered picker rows, next-steps entry
Show full message
feat: ✨ align with backend student-only gates - client: EN/TR error strings for new 400/403 messages (enroll/grade/roll-call targets, exam sit incl. exam-room WS frame) - exam-detail: own-result fetch + section gate on isStudent(), drop unused isTeacherPlus memo - docs: guard table isStudent() + student-filtered picker rows, next-steps entry
docs/frontend-next-steps.mdmodified+1 -0
@@ -65,6 +65,7 @@ validation, and list filtering cleanup.
65 | Session edit | `patchSessionById` + edit SidePanel in course sessions |65 | Session edit | `patchSessionById` + edit SidePanel in course sessions |
66 | Manager work log | `/management/staff-work` + get/patch/delete work APIs |66 | Manager work log | `/management/staff-work` + get/patch/delete work APIs |
67 | Work route guard | `beforeLoad` teacher+ on `/work` |67 | Work route guard | `beforeLoad` teacher+ on `/work` |
68+| BE student-only gates (enroll/sit/grade/roll call) | Localized error strings for the new 400/403 messages; student-marks lookup picker filters `role=student`; exam-detail own-result gates on `isStudent()` |
68 69
69 ### Incomplete Product Features70 ### Incomplete Product Features
70 71
docs/role-scope-matrix.mdmodified+2 -1
@@ -103,7 +103,8 @@
103 | `RouteGuard exactRole` | `/marks` | Student-only page (FE presentation; BE allows the own-data read) |103 | `RouteGuard exactRole` | `/marks` | Student-only page (FE presentation; BE allows the own-data read) |
104 | `RouteGuard minRole` | Management pages | Teacher+ or manager+ |104 | `RouteGuard minRole` | Management pages | Teacher+ or manager+ |
105 | `beforeLoad` redirect (router) | Route definition | Redirects before page JS loads |105 | `beforeLoad` redirect (router) | Route definition | Redirects before page JS loads |
106-| `!isTeacherPlus()` | In-page logic | Exam room CTA, event self-mark |106+| `isStudent()` | In-page logic | Exam room CTA, own-result section on exam detail |
107+| `UserSearchSelect role="student"` | Enroll picker, student-marks lookup | Offers only students — matches the BE student-only walls |
107 | `canManage()` / `hasCourseManagementRights()` | Detail pages | Course action visibility |108 | `canManage()` / `hasCourseManagementRights()` | Detail pages | Course action visibility |
108 | `canCreate` | List pages | Create button visibility |109 | `canCreate` | List pages | Create button visibility |
109 | Nav `exactRole` | Sidebar items | Student-only nav links |110 | Nav `exactRole` | Sidebar items | Student-only nav links |
src/api/client.tsmodified+16 -0
@@ -73,6 +73,22 @@ const API_ERROR_MESSAGES: Record<string, Record<Locale, string>> = {
73 en: "This attempt is closed. Answers are read-only.",73 en: "This attempt is closed. Answers are read-only.",
74 tr: "Bu oturum kapalı. Cevaplar salt okunur.",74 tr: "Bu oturum kapalı. Cevaplar salt okunur.",
75 },75 },
76+ "only students can sit exams": {
77+ en: "Only students can take exams.",
78+ tr: "Sınava yalnızca öğrenciler girebilir.",
79+ },
80+ "user_id: only students can be enrolled in a course": {
81+ en: "Only students can be enrolled in a course.",
82+ tr: "Derse yalnızca öğrenciler kaydedilebilir.",
83+ },
84+ "user_id: only students can be graded": {
85+ en: "Only students can be graded.",
86+ tr: "Yalnızca öğrencilere not verilebilir.",
87+ },
88+ "user_id: only students can be marked present in a lesson": {
89+ en: "Only students can be marked on a lesson roll call.",
90+ tr: "Ders yoklamasında yalnızca öğrenciler işaretlenebilir.",
91+ },
76 };92 };
77 93
78 function currentLocale(): Locale {94 function currentLocale(): Locale {
src/pages/exam-detail-page.tsxmodified+2 -3
@@ -70,7 +70,6 @@ function ExamDetailContent() {
70 70
71 const [exam, { refetch: refetchExam }] = createResource(id, (examId) => getExamById(examId));71 const [exam, { refetch: refetchExam }] = createResource(id, (examId) => getExamById(examId));
72 const [settings] = createResource(() => getSettings());72 const [settings] = createResource(() => getSettings());
73- const isTeacherPlus = createMemo(() => hasMinRole(auth.user()?.role, "teacher"));
74 const isStudent = createMemo(() => auth.user()?.role === "student");73 const isStudent = createMemo(() => auth.user()?.role === "student");
75 74
76 const hasCourseManagementRights = () => {75 const hasCourseManagementRights = () => {
@@ -97,7 +96,7 @@ function ExamDetailContent() {
97 });96 });
98 97
99 const [ownResult] = createResource(98 const [ownResult] = createResource(
100- () => (!isTeacherPlus() ? id() : null),99+ () => (isStudent() ? id() : null),
101 async (examId) => {100 async (examId) => {
102 if (!examId) return null;101 if (!examId) return null;
103 try {102 try {
@@ -361,7 +360,7 @@ function ExamDetailContent() {
361 </div>360 </div>
362 </SectionDisclosure>361 </SectionDisclosure>
363 362
364- <Show when={!isTeacherPlus() && !isScheduled()}>363+ <Show when={isStudent() && !isScheduled()}>
365 <SectionDisclosure364 <SectionDisclosure
366 open={openSections().ownResult}365 open={openSections().ownResult}
367 onToggle={() => toggleSection("ownResult")}366 onToggle={() => toggleSection("ownResult")}