From 17a2d4732db00d3d66e05c2729c030d133b0f989 Mon Sep 17 00:00:00 2001 From: undefined Date: Tue, 22 Mar 2022 17:40:26 +0800 Subject: [PATCH] core: problem_solution edit perm fix --- packages/hydrooj/src/handler/problem.ts | 4 ++-- packages/ui-default/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index 4d8251858..704288c65 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -749,7 +749,7 @@ export class ProblemSolutionHandler extends ProblemDetailHandler { async postEditReply(domainId: string, psid: ObjectID, psrid: ObjectID, content: string) { const [psdoc, psrdoc] = await solution.getReply(domainId, psid, psrid); if ((!psdoc) || psdoc.parentId !== this.pdoc.docId) throw new SolutionNotFoundError(domainId, psid); - if (!(!this.user.own(psrdoc) + if (!(this.user.own(psrdoc) && this.user.hasPerm(PERM.PERM_EDIT_PROBLEM_SOLUTION_REPLY_SELF))) { throw new PermissionError(PERM.PERM_EDIT_PROBLEM_SOLUTION_REPLY_SELF); } @@ -762,7 +762,7 @@ export class ProblemSolutionHandler extends ProblemDetailHandler { async postDeleteReply(domainId: string, psid: ObjectID, psrid: ObjectID) { const [psdoc, psrdoc] = await solution.getReply(domainId, psid, psrid); if ((!psdoc) || psdoc.parentId !== this.pdoc.docId) throw new SolutionNotFoundError(psid); - if (!(!this.user.own(psrdoc) + if (!(this.user.own(psrdoc) && this.user.hasPerm(PERM.PERM_DELETE_PROBLEM_SOLUTION_REPLY_SELF))) { this.checkPerm(PERM.PERM_DELETE_PROBLEM_SOLUTION_REPLY); } diff --git a/packages/ui-default/package.json b/packages/ui-default/package.json index 202f3756f..71a666be1 100644 --- a/packages/ui-default/package.json +++ b/packages/ui-default/package.json @@ -1,6 +1,6 @@ { "name": "@hydrooj/ui-default", - "version": "4.34.18", + "version": "4.34.19", "author": "undefined ", "license": "AGPL-3.0", "main": "hydro.js",