mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: RecordDetail页面检查pdoc.hidden权限
This commit is contained in:
1 parent
3389a490fc
commit
addda1b789
2 files changed
+8
-2
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.13.51",
|
||||
"version": "2.13.52",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -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'],
|
||||
|
||||
Reference in new issue
Block a user