From 627ce77d30ad9dba29365dfa22cdd56f545ef5e4 Mon Sep 17 00:00:00 2001 From: panda Date: Mon, 7 Jul 2025 22:30:00 +0800 Subject: [PATCH] core: fix admin can not view all related contest (#1011) --- packages/hydrooj/src/handler/problem.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index c7ee4bb66..2a266849c 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -391,7 +391,9 @@ export class ProblemDetailHandler extends ContestDetailBaseHandler { [this.response.body.ctdocs, this.response.body.htdocs] = (await Promise.all([ contest.getRelated(this.args.domainId, this.pdoc.docId), contest.getRelated(this.args.domainId, this.pdoc.docId, 'homework'), - ])).map((tdocs) => tdocs.filter((tdoc) => !tdoc.assign?.length || Set.intersection(tdoc.assign, this.user.group).size)); + ])).map((tdocs) => tdocs.filter((tdoc) => + this.user.hasPerm(PERM.PERM_VIEW_HIDDEN_CONTEST) || !tdoc.assign?.length || Set.intersection(tdoc.assign, this.user.group).size, + )); } }