mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 17:46:28 +08:00
core: 移除权限节点PERM_READ_PROBLEM_DATA_SELF
This commit is contained in:
1 parent
c3b314f8dd
commit
5a7114ed8c
3 files changed
+3
-10
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.15.14",
|
"version": "2.15.15",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -217,8 +217,7 @@ export class ProblemDetailHandler extends ProblemHandler {
|
|||||||
|
|
||||||
export class ProblemExportHandler extends ProblemDetailHandler {
|
export class ProblemExportHandler extends ProblemDetailHandler {
|
||||||
async get() {
|
async get() {
|
||||||
const hasPerm = (this.user._id === this.pdoc.owner && this.user.hasPerm(PERM.PERM_READ_PROBLEM_DATA_SELF))
|
const hasPerm = this.user._id === this.pdoc.owner || this.user.hasPerm(PERM.PERM_READ_PROBLEM_DATA);
|
||||||
|| this.user.hasPerm(PERM.PERM_READ_PROBLEM_DATA);
|
|
||||||
const pdoc = pick(this.pdoc, ['pid', 'acMsg', 'content', 'config', 'title', 'html', 'tag', 'category']);
|
const pdoc = pick(this.pdoc, ['pid', 'acMsg', 'content', 'config', 'title', 'html', 'tag', 'category']);
|
||||||
const zip = new AdmZip();
|
const zip = new AdmZip();
|
||||||
if (hasPerm) {
|
if (hasPerm) {
|
||||||
@@ -455,7 +454,7 @@ export class ProblemFilesHandler extends ProblemDetailHandler {
|
|||||||
if (type === 'testdata' && !isJudge) {
|
if (type === 'testdata' && !isJudge) {
|
||||||
if (this.user._id !== this.pdoc.owner) {
|
if (this.user._id !== this.pdoc.owner) {
|
||||||
this.checkPerm(PERM.PERM_READ_PROBLEM_DATA);
|
this.checkPerm(PERM.PERM_READ_PROBLEM_DATA);
|
||||||
} else this.checkPerm(PERM.PERM_READ_PROBLEM_DATA_SELF);
|
}
|
||||||
}
|
}
|
||||||
const links = {};
|
const links = {};
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
|
|||||||
@@ -26,10 +26,6 @@ export const PERM = {
|
|||||||
PERM_VIEW_PROBLEM_HIDDEN: 1n << 8n,
|
PERM_VIEW_PROBLEM_HIDDEN: 1n << 8n,
|
||||||
PERM_SUBMIT_PROBLEM: 1n << 9n,
|
PERM_SUBMIT_PROBLEM: 1n << 9n,
|
||||||
PERM_READ_PROBLEM_DATA: 1n << 10n,
|
PERM_READ_PROBLEM_DATA: 1n << 10n,
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
PERM_READ_PROBLEM_DATA_SELF: 1n << 11n,
|
|
||||||
PERM_READ_RECORD_CODE: 1n << 12n,
|
PERM_READ_RECORD_CODE: 1n << 12n,
|
||||||
PERM_REJUDGE_PROBLEM: 1n << 13n,
|
PERM_REJUDGE_PROBLEM: 1n << 13n,
|
||||||
PERM_REJUDGE: 1n << 14n,
|
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_VIEW_PROBLEM_HIDDEN, 'View hidden problems'),
|
||||||
Permission('perm_problem', PERM.PERM_SUBMIT_PROBLEM, 'Submit problem'),
|
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, '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_READ_RECORD_CODE, 'Read record codes'),
|
||||||
Permission('perm_record', PERM.PERM_REJUDGE_PROBLEM, 'Rejudge problems'),
|
Permission('perm_record', PERM.PERM_REJUDGE_PROBLEM, 'Rejudge problems'),
|
||||||
Permission('perm_record', PERM.PERM_REJUDGE, 'Rejudge records'),
|
Permission('perm_record', PERM.PERM_REJUDGE, 'Rejudge records'),
|
||||||
@@ -180,7 +175,6 @@ PERM.PERM_DEFAULT = PERM.PERM_VIEW
|
|||||||
| PERM.PERM_VIEW_PROBLEM
|
| PERM.PERM_VIEW_PROBLEM
|
||||||
| PERM.PERM_EDIT_PROBLEM_SELF
|
| PERM.PERM_EDIT_PROBLEM_SELF
|
||||||
| PERM.PERM_SUBMIT_PROBLEM
|
| PERM.PERM_SUBMIT_PROBLEM
|
||||||
| PERM.PERM_READ_PROBLEM_DATA_SELF
|
|
||||||
| PERM.PERM_VIEW_PROBLEM_SOLUTION
|
| PERM.PERM_VIEW_PROBLEM_SOLUTION
|
||||||
| PERM.PERM_CREATE_PROBLEM_SOLUTION
|
| PERM.PERM_CREATE_PROBLEM_SOLUTION
|
||||||
| PERM.PERM_VOTE_PROBLEM_SOLUTION
|
| PERM.PERM_VOTE_PROBLEM_SOLUTION
|
||||||
|
|||||||
Reference in new issue
Block a user