mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: disable view contest code by default
This commit is contained in:
1 parent
eb6f1abc8b
commit
4b09a83ede
3 files changed
+3
-2
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "4.0.10",
|
||||
"version": "4.0.11",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "src/plugin-api",
|
||||
"module": "src/plugin-api",
|
||||
|
||||
@@ -155,7 +155,7 @@ class RecordDetailHandler extends Handler {
|
||||
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_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);
|
||||
canViewCode ||= tsdoc?.attend;
|
||||
}
|
||||
|
||||
@@ -351,6 +351,7 @@ export interface Tdoc<docType = document['TYPE_CONTEST'] | document['TYPE_TRAINI
|
||||
_code?: string;
|
||||
assign?: string[];
|
||||
files?: FileInfo[];
|
||||
allowViewCode?: boolean;
|
||||
|
||||
// For contest
|
||||
lockAt?: Date;
|
||||
|
||||
Reference in new issue
Block a user