core: disable view contest code by default

This commit is contained in:
undefined committed 2022-10-08 22:05:58 +08:00
1 parent eb6f1abc8b
commit 4b09a83ede
3 files changed
+3 -2

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "4.0.10", "version": "4.0.11",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "src/plugin-api", "main": "src/plugin-api",
"module": "src/plugin-api", "module": "src/plugin-api",
+1 -1
View File
@@ -155,7 +155,7 @@ class RecordDetailHandler extends Handler {
canViewCode ||= this.user.hasPriv(PRIV.PRIV_READ_RECORD_CODE); canViewCode ||= this.user.hasPriv(PRIV.PRIV_READ_RECORD_CODE);
canViewCode ||= this.user.hasPerm(PERM.PERM_READ_RECORD_CODE); canViewCode ||= this.user.hasPerm(PERM.PERM_READ_RECORD_CODE);
canViewCode ||= this.user.hasPerm(PERM.PERM_READ_RECORD_CODE_ACCEPT) && self?.status === STATUS.STATUS_ACCEPTED; canViewCode ||= this.user.hasPerm(PERM.PERM_READ_RECORD_CODE_ACCEPT) && self?.status === STATUS.STATUS_ACCEPTED;
if (tdoc && contest.isDone(tdoc)) { if (tdoc && tdoc.allowViewCode && contest.isDone(tdoc)) {
const tsdoc = await contest.getStatus(domainId, tdoc.docId, this.user._id); const tsdoc = await contest.getStatus(domainId, tdoc.docId, this.user._id);
canViewCode ||= tsdoc?.attend; canViewCode ||= tsdoc?.attend;
} }
+1
View File
@@ -351,6 +351,7 @@ export interface Tdoc<docType = document['TYPE_CONTEST'] | document['TYPE_TRAINI
_code?: string; _code?: string;
assign?: string[]; assign?: string[];
files?: FileInfo[]; files?: FileInfo[];
allowViewCode?: boolean;
// For contest // For contest
lockAt?: Date; lockAt?: Date;