mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: restore PERM_EDIT_PROBLEM_SELF
This commit is contained in:
1 parent
5b0478fb3f
commit
866aa56f78
11 files changed
+25
-21
No files matched your search
@@ -26,7 +26,6 @@ export const PERM = {
|
||||
// Problem and Record
|
||||
PERM_CREATE_PROBLEM: 1n << 4n,
|
||||
PERM_EDIT_PROBLEM: 1n << 5n,
|
||||
/** @deprecated */
|
||||
PERM_EDIT_PROBLEM_SELF: 1n << 6n,
|
||||
PERM_VIEW_PROBLEM: 1n << 7n,
|
||||
PERM_VIEW_PROBLEM_HIDDEN: 1n << 8n,
|
||||
|
||||
@@ -87,8 +87,9 @@ class User implements _User {
|
||||
return this;
|
||||
}
|
||||
|
||||
own<T extends { owner: number, maintainer?: number[] }>(doc: T, exact = false) {
|
||||
return exact
|
||||
own(doc: any, arg1: any = false): boolean {
|
||||
if (typeof arg1 === 'bigint' && !this.hasPerm(arg1)) return false;
|
||||
return (typeof arg1 === 'boolean' && arg1)
|
||||
? doc.owner === this._id
|
||||
: doc.owner === this._id || (doc.maintainer || []).includes(this._id);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user