core: fix accept check on problem solution (#574)

pull/577/head
panda 1 year ago committed by GitHub
parent 34bbb5b2cf
commit c1bd317e97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -822,7 +822,7 @@ export class ProblemSolutionHandler extends ProblemDetailHandler {
async get(domainId: string, page = 1, tid?: ObjectId, sid?: ObjectId) {
if (tid) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_SOLUTION);
this.response.template = 'problem_solution.html';
const accepted = this.tsdoc?.status === STATUS.STATUS_ACCEPTED;
const accepted = this.psdoc?.status === STATUS.STATUS_ACCEPTED;
if (!accepted || !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION_ACCEPT)) {
this.checkPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION);
}
@ -933,7 +933,7 @@ export class ProblemSolutionRawHandler extends ProblemDetailHandler {
@param('tid', Types.ObjectId, true)
async get(domainId: string, psid: ObjectId, psrid?: ObjectId, tid?: ObjectId) {
if (tid) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_SOLUTION);
const accepted = this.tsdoc?.status === STATUS.STATUS_ACCEPTED;
const accepted = this.psdoc?.status === STATUS.STATUS_ACCEPTED;
if (!accepted || !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION_ACCEPT)) {
this.checkPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION);
}

Loading…
Cancel
Save