mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: allow view problem files in contest when user doesnt have PERM_VIEW_PROBLEM
This commit is contained in:
1 file changed
+4
-2
@@ -819,7 +819,9 @@ export class ProblemFileDownloadHandler extends ProblemDetailHandler {
|
||||
@query('type', Types.Range(['additional_file', 'testdata']), true)
|
||||
@param('filename', Types.Filename)
|
||||
@param('noDisposition', Types.Boolean)
|
||||
async get(domainId: string, type = 'additional_file', filename: string, noDisposition = false) {
|
||||
@query('tid', Types.ObjectId, true)
|
||||
async get(domainId: string, type = 'additional_file', filename: string, noDisposition = false, tid: ObjectId) {
|
||||
if (!tid) this.checkPerm(PERM.PERM_VIEW_PROBLEM);
|
||||
if (this.pdoc.reference) {
|
||||
if (type === 'testdata') throw new ProblemIsReferencedError('download testdata');
|
||||
this.pdoc = await problem.get(this.pdoc.reference.domainId, this.pdoc.reference.pid);
|
||||
@@ -1045,7 +1047,7 @@ export async function apply(ctx) {
|
||||
ctx.Route('problem_edit', '/p/:pid/edit', ProblemEditHandler);
|
||||
ctx.Route('problem_config', '/p/:pid/config', ProblemConfigHandler);
|
||||
ctx.Route('problem_files', '/p/:pid/files', ProblemFilesHandler, PERM.PERM_VIEW_PROBLEM);
|
||||
ctx.Route('problem_file_download', '/p/:pid/file/:filename', ProblemFileDownloadHandler, PERM.PERM_VIEW_PROBLEM);
|
||||
ctx.Route('problem_file_download', '/p/:pid/file/:filename', ProblemFileDownloadHandler);
|
||||
ctx.Route('problem_solution', '/p/:pid/solution', ProblemSolutionHandler, PERM.PERM_VIEW_PROBLEM);
|
||||
ctx.Route('problem_solution_detail', '/p/:pid/solution/:sid', ProblemSolutionHandler, PERM.PERM_VIEW_PROBLEM);
|
||||
ctx.Route('problem_solution_raw', '/p/:pid/solution/:psid/raw', ProblemSolutionRawHandler, PERM.PERM_VIEW_PROBLEM);
|
||||
|
||||
Reference in new issue
Block a user