|
|
|
@ -103,7 +103,7 @@ class JudgeState extends Model {
|
|
|
|
|
await this.loadRelationships(); |
|
|
|
|
|
|
|
|
|
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) { |
|
|
|
|
let contest = await Contest.fromID(this.type_info); |
|
|
|
|
if (await contest.isRunning()) { |
|
|
|
@ -111,7 +111,7 @@ class JudgeState extends Model {
|
|
|
|
|
} else { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} else if (this.type === 2) return true; |
|
|
|
|
} else if (this.type === 2) return user && (await user.hasPrivilege('manage_problem')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async isAllowedSeeCodeBy(user) { |
|
|
|
@ -141,7 +141,7 @@ class JudgeState extends Model {
|
|
|
|
|
} else { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} else if (this.type === 2) return true; |
|
|
|
|
} else if (this.type === 2) return user && (await user.hasPrivilege('manage_problem')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async isAllowedSeeDataBy(user) { |
|
|
|
|