core: do not allow edit for setting_storage

This commit is contained in:
undefined committed 2022-10-03 16:38:08 +08:00
1 parent efb8adfe6d
commit 0c81eea40a
3 files changed
+5 -1

No files matched your search

+1 -1
View File
@@ -67,7 +67,7 @@ export class ApiMixin extends Service {
setImmediate = T(setImmediate, clearImmediate);
provideModule = T(provideModule);
inject = T(inject);
broadcast = (event: string, ...payload) => this.ctx.emit('bus/broadcast', event, payload);
broadcast = (event: keyof EventMap, ...payload) => this.ctx.emit('bus/broadcast', event, payload);
constructor(ctx) {
super(ctx, 'api', true);
}
+1
View File
@@ -223,6 +223,7 @@ class HomeSecurityHandler extends Handler {
function set(s: Setting, key: string, value: any) {
if (s) {
if (s.family === 'setting_storage') return undefined;
if (s.flag & setting.FLAG_DISABLED) return undefined;
if ((s.flag & setting.FLAG_SECRET) && !value) return undefined;
if (s.type === 'boolean') {
+3
View File
@@ -28,6 +28,7 @@ export interface EventMap {
'app/load/model': () => VoidReturn
'app/load/handler': () => VoidReturn
'app/load/service': () => VoidReturn
'app/ready': () => VoidReturn
'app/exit': () => VoidReturn
'database/connect': (db: Db) => void
@@ -36,6 +37,8 @@ export interface EventMap {
'system/setting': (args: Record<string, any>) => VoidReturn
'bus/broadcast': (event: keyof EventMap, ...args: any[]) => VoidReturn
'monitor/update': (type: 'server' | 'judge', $set: any) => VoidReturn
'api/update': () => void;
'task/daily': () => void;
'user/message': (uid: number, mdoc: MessageDoc) => void
'user/get': (udoc: User) => void