mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 17:46:28 +08:00
core: allow user with PERM_VIEW_PROBLEM_HIDDEN view all problems
This commit is contained in:
1 parent
9a2256fb0d
commit
ecde94fee5
3 files changed
+4
-3
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.3.11",
|
"version": "3.3.12",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -366,7 +366,8 @@ export class ProblemModel {
|
|||||||
static canViewBy(pdoc: ProblemDoc, udoc: User) {
|
static canViewBy(pdoc: ProblemDoc, udoc: User) {
|
||||||
if (!udoc.hasPerm(PERM.PERM_VIEW_PROBLEM)) return false;
|
if (!udoc.hasPerm(PERM.PERM_VIEW_PROBLEM)) return false;
|
||||||
if (udoc.own(pdoc)) return true;
|
if (udoc.own(pdoc)) return true;
|
||||||
if (pdoc.hidden && !udoc.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) return false;
|
if (udoc.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) return true;
|
||||||
|
if (pdoc.hidden) return false;
|
||||||
if (!pdoc.assign.length) return true;
|
if (!pdoc.assign.length) return true;
|
||||||
return !!Set.intersection(pdoc.assign, udoc.group).size;
|
return !!Set.intersection(pdoc.assign, udoc.group).size;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.29.8",
|
"version": "4.29.9",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
Reference in new issue
Block a user