mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix accept check on problem solution (#574)
This commit is contained in:
1 parent
34bbb5b2cf
commit
c1bd317e97
1 file changed
+2
-2
@@ -822,7 +822,7 @@ export class ProblemSolutionHandler extends ProblemDetailHandler {
|
|||||||
async get(domainId: string, page = 1, tid?: ObjectId, sid?: ObjectId) {
|
async get(domainId: string, page = 1, tid?: ObjectId, sid?: ObjectId) {
|
||||||
if (tid) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_SOLUTION);
|
if (tid) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_SOLUTION);
|
||||||
this.response.template = 'problem_solution.html';
|
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)) {
|
if (!accepted || !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION_ACCEPT)) {
|
||||||
this.checkPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION);
|
this.checkPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION);
|
||||||
}
|
}
|
||||||
@@ -933,7 +933,7 @@ export class ProblemSolutionRawHandler extends ProblemDetailHandler {
|
|||||||
@param('tid', Types.ObjectId, true)
|
@param('tid', Types.ObjectId, true)
|
||||||
async get(domainId: string, psid: ObjectId, psrid?: ObjectId, tid?: ObjectId) {
|
async get(domainId: string, psid: ObjectId, psrid?: ObjectId, tid?: ObjectId) {
|
||||||
if (tid) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_SOLUTION);
|
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)) {
|
if (!accepted || !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION_ACCEPT)) {
|
||||||
this.checkPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION);
|
this.checkPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user