mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +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) {
|
||||
config.lockAt = this.tdoc.lockAt;
|
||||
}
|
||||
const [, rows, udict, pdict] = await contest.getScoreboard.call(this, domainId, tid, config);
|
||||
const groups = this.user.hasPerm(PERM.PERM_EDIT_DOMAIN)
|
||||
? await user.listGroup(domainId) : [];
|
||||
const allGroups = this.user.hasPerm(PERM.PERM_EDIT_CONTEST_SELF) || (this.user.own(this.tdoc) && this.user.hasPerm(PERM.PERM_EDIT_CONTEST))
|
||||
const [[, rows, udict, pdict], groups] = await Promise.all([
|
||||
contest.getScoreboard.call(this, domainId, tid, config),
|
||||
user.listGroup(domainId, allGroups ? undefined : this.user._id),
|
||||
]);
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
const page_name = this.tdoc.rule === 'homework'
|
||||
? 'homework_scoreboard'
|
||||
|
||||
Reference in new issue
Block a user