mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core: allow user file upload
This commit is contained in:
1 parent
b13b8835ec
commit
7bdf580e7d
13 files changed
+333
-11
No files matched your search
@@ -242,6 +242,9 @@ export const PRIV = {
|
||||
PRIV_UNLIMITED_ACCESS: 1 << 22,
|
||||
PRIV_VIEW_SYSTEM_NOTIFICATION: 1 << 23,
|
||||
PRIV_SEND_MESSAGE: 1 << 24,
|
||||
PRIV_CREATE_FILE: 1 << 16,
|
||||
PRIV_UNLIMITED_QUOTA: 1 << 17,
|
||||
PRIV_DELETE_FILE: 1 << 18,
|
||||
|
||||
PRIV_ALL: -1,
|
||||
PRIV_DEFAULT: 0,
|
||||
@@ -252,12 +255,6 @@ export const PRIV = {
|
||||
/** @deprecated */
|
||||
PRIV_READ_PRETEST_DATA_SELF: 1 << 6,
|
||||
/** @deprecated */
|
||||
PRIV_CREATE_FILE: 1 << 16,
|
||||
/** @deprecated */
|
||||
PRIV_UNLIMITED_QUOTA: 1 << 17,
|
||||
/** @deprecated */
|
||||
PRIV_DELETE_FILE: 1 << 18,
|
||||
/** @deprecated */
|
||||
PRIV_DELETE_FILE_SELF: 1 << 19,
|
||||
};
|
||||
|
||||
|
||||
@@ -184,6 +184,8 @@ SystemSetting(
|
||||
Setting('setting_server', 'server.login', true, 'boolean', 'server.login', 'Allow builtin-login', FLAG_PRO),
|
||||
Setting('setting_limits', 'limit.problem_files_max', 100, 'number', 'limit.problem_files_max', 'Max files per problem'),
|
||||
Setting('setting_limits', 'limit.problem_files_size_max', 128 * 1024 * 1024, 'number', 'limit.problem_files_size_max', 'Max files size per problem'),
|
||||
Setting('setting_limits', 'limit.user_files', 100, 'number', 'limit.user_files', 'Max files for user'),
|
||||
Setting('setting_limits', 'limit.user_files_size', 128 * 1024 * 1024, 'number', 'limit.user_files_size', 'Max total file size for user'),
|
||||
Setting('setting_basic', 'default.priv', builtin.PRIV.PRIV_DEFAULT, 'number', 'default.priv', 'Default Privilege', FLAG_PRO),
|
||||
Setting('setting_basic', 'problem.categories', builtin.CATEGORIES, 'yaml', 'problem.categories', 'Problem Categories'),
|
||||
Setting('setting_basic', 'pagination.problem', 100, 'number', 'pagination.problem', 'Problems per page'),
|
||||
|
||||
@@ -8,7 +8,9 @@ import domain from './domain';
|
||||
import { PERM, PRIV } from './builtin';
|
||||
import { ArgMethod } from '../utils';
|
||||
import { UserNotFoundError, UserAlreadyExistError, LoginError } from '../error';
|
||||
import { User as _User, Udoc, Udict } from '../interface';
|
||||
import {
|
||||
User as _User, Udoc, Udict, FileInfo,
|
||||
} from '../interface';
|
||||
import { Value } from '../typeutils';
|
||||
import { Logger } from '../logger';
|
||||
import pwhash from '../lib/hash.hydro';
|
||||
@@ -51,6 +53,7 @@ class User implements _User {
|
||||
perm: bigint;
|
||||
role: string;
|
||||
scope: bigint;
|
||||
_files: FileInfo[];
|
||||
[key: string]: any;
|
||||
|
||||
constructor(udoc: Udoc, dudoc, scope = PERM.PERM_ALL) {
|
||||
@@ -62,6 +65,7 @@ class User implements _User {
|
||||
this._hash = udoc.hash;
|
||||
this._regip = udoc.regip;
|
||||
this._loginip = udoc.loginip;
|
||||
this._files = udoc._files || [];
|
||||
|
||||
this.mail = udoc.mail;
|
||||
this.uname = udoc.uname;
|
||||
|
||||
Reference in new issue
Block a user