mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: add showSelfRecord for contest
This commit is contained in:
1 parent
33208a0d1f
commit
3761a5c77d
4 files changed
+20
-3
No files matched your search
@@ -95,7 +95,12 @@ class RecordDetailHandler extends Handler {
|
||||
if (!rdoc) throw new RecordNotFoundError(rid);
|
||||
if (rdoc.contest) {
|
||||
const tdoc = await contest.get(domainId, rdoc.contest.tid, rdoc.contest.type);
|
||||
if (!contest.canShowRecord.call(this, tdoc, true)) throw new PermissionError(rid);
|
||||
if (
|
||||
(rdoc.uid !== this.user._id && !contest.canShowRecord.call(this, tdoc, true))
|
||||
|| (rdoc.uid === this.user._id && !contest.canShowSelfRecord.call(this, tdoc, true))
|
||||
) {
|
||||
throw new PermissionError(rid);
|
||||
}
|
||||
}
|
||||
if (rdoc.uid !== this.user._id && !this.user.hasPriv(PRIV.PRIV_READ_RECORD_CODE)) {
|
||||
if (!this.user.hasPerm(PERM.PERM_READ_RECORD_CODE)) rdoc.code = null;
|
||||
|
||||
Reference in new issue
Block a user