diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index ead0253d0..5acf8bd56 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.15.14", + "version": "2.15.15", "bin": "bin/hydrooj.js", "main": "dist/loader.js", "typings": "dist/loader.d.ts", diff --git a/packages/hydrooj/src/handler/problem.ts b/packages/hydrooj/src/handler/problem.ts index 5a586c9f8..35003bed4 100644 --- a/packages/hydrooj/src/handler/problem.ts +++ b/packages/hydrooj/src/handler/problem.ts @@ -217,8 +217,7 @@ export class ProblemDetailHandler extends ProblemHandler { export class ProblemExportHandler extends ProblemDetailHandler { async get() { - const hasPerm = (this.user._id === this.pdoc.owner && this.user.hasPerm(PERM.PERM_READ_PROBLEM_DATA_SELF)) - || this.user.hasPerm(PERM.PERM_READ_PROBLEM_DATA); + const hasPerm = this.user._id === this.pdoc.owner || this.user.hasPerm(PERM.PERM_READ_PROBLEM_DATA); const pdoc = pick(this.pdoc, ['pid', 'acMsg', 'content', 'config', 'title', 'html', 'tag', 'category']); const zip = new AdmZip(); if (hasPerm) { @@ -455,7 +454,7 @@ export class ProblemFilesHandler extends ProblemDetailHandler { if (type === 'testdata' && !isJudge) { if (this.user._id !== this.pdoc.owner) { this.checkPerm(PERM.PERM_READ_PROBLEM_DATA); - } else this.checkPerm(PERM.PERM_READ_PROBLEM_DATA_SELF); + } } const links = {}; for (const file of files) { diff --git a/packages/hydrooj/src/model/builtin.ts b/packages/hydrooj/src/model/builtin.ts index 14e21ad1c..6f4c3c495 100644 --- a/packages/hydrooj/src/model/builtin.ts +++ b/packages/hydrooj/src/model/builtin.ts @@ -26,10 +26,6 @@ export const PERM = { PERM_VIEW_PROBLEM_HIDDEN: 1n << 8n, PERM_SUBMIT_PROBLEM: 1n << 9n, PERM_READ_PROBLEM_DATA: 1n << 10n, - /** - * @deprecated - */ - PERM_READ_PROBLEM_DATA_SELF: 1n << 11n, PERM_READ_RECORD_CODE: 1n << 12n, PERM_REJUDGE_PROBLEM: 1n << 13n, PERM_REJUDGE: 1n << 14n, @@ -111,7 +107,6 @@ export const PERMS = [ Permission('perm_problem', PERM.PERM_VIEW_PROBLEM_HIDDEN, 'View hidden problems'), Permission('perm_problem', PERM.PERM_SUBMIT_PROBLEM, 'Submit problem'), Permission('perm_problem', PERM.PERM_READ_PROBLEM_DATA, 'Read data of problem'), - Permission('perm_problem', PERM.PERM_READ_PROBLEM_DATA_SELF, 'Read data of own problems'), Permission('perm_record', PERM.PERM_READ_RECORD_CODE, 'Read record codes'), Permission('perm_record', PERM.PERM_REJUDGE_PROBLEM, 'Rejudge problems'), Permission('perm_record', PERM.PERM_REJUDGE, 'Rejudge records'), @@ -180,7 +175,6 @@ PERM.PERM_DEFAULT = PERM.PERM_VIEW | PERM.PERM_VIEW_PROBLEM | PERM.PERM_EDIT_PROBLEM_SELF | PERM.PERM_SUBMIT_PROBLEM - | PERM.PERM_READ_PROBLEM_DATA_SELF | PERM.PERM_VIEW_PROBLEM_SOLUTION | PERM.PERM_CREATE_PROBLEM_SOLUTION | PERM.PERM_VOTE_PROBLEM_SOLUTION