Skip to content

Commit effc7da

Browse files
authored
core: check perm for solution voting (#1089)
1 parent 6bed7e4 commit effc7da

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

packages/hydrooj/src/handler/problem.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,12 +922,14 @@ export class ProblemSolutionHandler extends ProblemDetailHandler {
922922

923923
@param('psid', Types.ObjectId)
924924
async postUpvote(domainId: string, psid: ObjectId) {
925+
this.checkPerm(PERM.PERM_VOTE_PROBLEM_SOLUTION);
925926
const psdoc = await solution.vote(domainId, psid, this.user._id, 1);
926927
this.back({ vote: psdoc.vote, user_vote: 1 });
927928
}
928929

929930
@param('psid', Types.ObjectId)
930931
async postDownvote(domainId: string, psid: ObjectId) {
932+
this.checkPerm(PERM.PERM_VOTE_PROBLEM_SOLUTION);
931933
const psdoc = await solution.vote(domainId, psid, this.user._id, -1);
932934
this.back({ vote: psdoc.vote, user_vote: -1 });
933935
}

0 commit comments

Comments
 (0)