Skip to content

Commit 7fb2a92

Browse files
committed
🚨 Block non-admin from creating workbook (#2199)
1 parent b1ba19e commit 7fb2a92

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/routes/workbooks/create/+page.server.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ export const actions = {
4747
return fail(FORBIDDEN, { message: 'ログインが必要です。' });
4848
}
4949

50+
// Security check: Only admins can create workbooks
51+
if (author.role !== Roles.ADMIN) {
52+
return fail(FORBIDDEN, { message: '管理者のみ問題集を作成できます。' });
53+
}
54+
5055
const form = await superValidate(request, zod(workBookSchema));
5156

5257
if (!form.valid) {

0 commit comments

Comments
 (0)