mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: optimize permission control for group filter in contest_scoreboard
This commit is contained in:
1 file changed
+5
-3
@@ -328,9 +328,11 @@ export class ContestScoreboardHandler extends ContestDetailBaseHandler {
|
|||||||
if (!realtime && this.tdoc.lockAt && !this.tdoc.unlocked) {
|
if (!realtime && this.tdoc.lockAt && !this.tdoc.unlocked) {
|
||||||
config.lockAt = this.tdoc.lockAt;
|
config.lockAt = this.tdoc.lockAt;
|
||||||
}
|
}
|
||||||
const [, rows, udict, pdict] = await contest.getScoreboard.call(this, domainId, tid, config);
|
const allGroups = this.user.hasPerm(PERM.PERM_EDIT_CONTEST_SELF) || (this.user.own(this.tdoc) && this.user.hasPerm(PERM.PERM_EDIT_CONTEST))
|
||||||
const groups = this.user.hasPerm(PERM.PERM_EDIT_DOMAIN)
|
const [[, rows, udict, pdict], groups] = await Promise.all([
|
||||||
? await user.listGroup(domainId) : [];
|
contest.getScoreboard.call(this, domainId, tid, config),
|
||||||
|
user.listGroup(domainId, allGroups ? undefined : this.user._id),
|
||||||
|
]);
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
const page_name = this.tdoc.rule === 'homework'
|
const page_name = this.tdoc.rule === 'homework'
|
||||||
? 'homework_scoreboard'
|
? 'homework_scoreboard'
|
||||||
|
|||||||
Reference in new issue
Block a user