mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: 修复无PERM_VIEW_PROBLEM在user_detail能够查看到题目标题的错误
This commit is contained in:
1 parent
bc3fc23ff3
commit
2328bada9d
3 files changed
+18
-11
No files matched your search
@@ -162,16 +162,22 @@ class UserDetailHandler extends Handler {
|
||||
const [sdoc, rdocs, [pdocs, pcount]] = await Promise.all([
|
||||
token.getMostRecentSessionByUid(uid),
|
||||
record.getByUid(domainId, uid, 30),
|
||||
paginate(
|
||||
problem.getMulti(domainId, { owner: this.user._id }),
|
||||
1,
|
||||
100,
|
||||
),
|
||||
this.user.hasPerm(PERM.PERM_VIEW_PROBLEM)
|
||||
? paginate(
|
||||
problem.getMulti(domainId, { owner: this.user._id }),
|
||||
1,
|
||||
100,
|
||||
)
|
||||
: [[], 0, 0] as [problem.Pdoc[], number, number],
|
||||
]);
|
||||
const pdict = await problem.getList(
|
||||
domainId, rdocs.map((rdoc) => rdoc.pid),
|
||||
this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN), false,
|
||||
);
|
||||
const pdict = this.user.hasPerm(PERM.PERM_VIEW_PROBLEM)
|
||||
? await problem.getList(
|
||||
domainId, rdocs.map((rdoc) => rdoc.pid),
|
||||
this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN), false,
|
||||
)
|
||||
: Object.fromEntries(rdocs.map(
|
||||
(rdoc) => [rdoc.pid, problem.Pdoc.create(undefined, rdoc.pid.toString())],
|
||||
));
|
||||
// Remove sensitive data
|
||||
if (!isSelfProfile && sdoc) {
|
||||
sdoc.createIp = '';
|
||||
|
||||
Reference in new issue
Block a user