core: RecordDetail页面检查pdoc.hidden权限

This commit is contained in:
undefined committed 2020-11-17 12:19:05 +08:00
1 parent 3389a490fc
commit addda1b789
2 files changed
+8 -2

No files matched your search

+7 -1
View File
@@ -78,10 +78,16 @@ class RecordDetailHandler extends RecordHandler {
if (rdoc.uid !== this.user.uid && !this.user.hasPerm(PERM.PERM_READ_RECORD_CODE)) {
rdoc.code = null;
}
const [pdoc, udoc] = await Promise.all([
// eslint-disable-next-line prefer-const
let [pdoc, udoc] = await Promise.all([
problem.get(domainId, rdoc.pid),
user.getById(domainId, rdoc.uid),
]);
if (!rdoc.contest && pdoc.hidden && pdoc.owner !== this.user._id) {
if (this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) {
pdoc = problem.Pdoc.create(pdoc.docId, pdoc.pid);
}
}
this.response.body = {
path: [
['Hydro', 'homepage'],