Browse Source

Fix normal user can see hidden submission data

master
Menci 8 years ago
parent
commit
4c15440966
  1. 6
      models/judge_state.js

6
models/judge_state.js

@ -103,7 +103,7 @@ class JudgeState extends Model {
await this.loadRelationships(); await this.loadRelationships();
if (user && user.id === this.problem.user_id) return true; if (user && user.id === this.problem.user_id) return true;
else if (this.type === 0) return true; else if (this.type === 0) return this.problem.is_public || (user && (await user.hasPrivilege('manage_problem')));
else if (this.type === 1) { else if (this.type === 1) {
let contest = await Contest.fromID(this.type_info); let contest = await Contest.fromID(this.type_info);
if (await contest.isRunning()) { if (await contest.isRunning()) {
@ -111,7 +111,7 @@ class JudgeState extends Model {
} else { } else {
return true; return true;
} }
} else if (this.type === 2) return true; } else if (this.type === 2) return user && (await user.hasPrivilege('manage_problem'));
} }
async isAllowedSeeCodeBy(user) { async isAllowedSeeCodeBy(user) {
@ -141,7 +141,7 @@ class JudgeState extends Model {
} else { } else {
return true; return true;
} }
} else if (this.type === 2) return true; } else if (this.type === 2) return user && (await user.hasPrivilege('manage_problem'));
} }
async isAllowedSeeDataBy(user) { async isAllowedSeeDataBy(user) {

Loading…
Cancel
Save