Skip to content

Commit 949ab85

Browse files
committed
fix 403 for teacher viewing enrolments of course
1 parent 0dd58e4 commit 949ab85

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/client/components/ErrorBoundary.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next'
44
import { setErrorStateHandler } from '../util/apiClient'
55
import { OutlineButtonBlack } from './ChatV2/generics/Buttons'
66
import { ArrowBack, Replay } from '@mui/icons-material'
7+
import { inDevelopment } from '../../config'
78

89
// todo: setup sentry
910

@@ -91,7 +92,6 @@ const ErrorPage = ({ error, setErrorState }: { error?: Error; setErrorState: Voi
9192
textAlign: 'center',
9293
}}
9394
>
94-
<b>{t('error:errorName')}:</b> {error.name} <br />
9595
<b>{t('error:errorMessage')}:</b> {error.message} <br />
9696
<b>{t('error:stackTrace')}:</b> {error.stack}
9797
<br />

src/server/routes/course.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ courseRouter.get('/:id/enrolments', async (req: express.Request, res: express.Re
123123
const chatInstance = await ChatInstance.findOne({
124124
where: { courseId: id },
125125
include: [
126+
{
127+
model: Responsibility,
128+
as: 'responsibilities',
129+
attributes: ['userId'],
130+
},
126131
{
127132
model: Enrolment,
128133
as: 'enrolments',
@@ -145,7 +150,7 @@ courseRouter.get('/:id/enrolments', async (req: express.Request, res: express.Re
145150
const hasFullAccess =
146151
user.isAdmin ||
147152
chatInstance.responsibilities
148-
?.map((r) => r.user?.id)
153+
?.map((r) => r.userId)
149154
.filter(Boolean)
150155
.includes(user.id)
151156

0 commit comments

Comments
 (0)