fix: 安全更新,备份数据库插件仅限管理员运行

This commit is contained in:
xiaojunnuo
2025-07-22 11:51:27 +08:00
parent 9d9cd8a362
commit 13dfca1749
8 changed files with 25 additions and 6 deletions

View File

@@ -59,6 +59,7 @@ export type PluginDefine = Registrable & {
form: any;
};
};
onlyAdmin?: boolean;
needPlus?: boolean;
showRunStrategy?: boolean;
pluginType?: string; //类型
@@ -162,6 +163,14 @@ export abstract class AbstractTaskPlugin implements ITaskPlugin {
this.registerSecret(cert.key);
this.registerSecret(cert.one);
}
debugger
// @ts-ignore
if (this.ctx.step.onlyAdmin) {
if (!this.isAdmin()) {
throw new Error("只有管理员才能运行此任务");
}
}
}
async getAccess<T = any>(accessId: string | number, isCommon = false) {

View File

@@ -30,4 +30,5 @@ export const pluginGroups = {
qiniu: new PluginGroup("qiniu", "七牛云", 5, "svg:icon-qiniuyun"),
aws: new PluginGroup("aws", "亚马逊云", 6, "svg:icon-aws"),
other: new PluginGroup("other", "其他", 10, "clarity:plugin-line"),
admin: new PluginGroup("admin", "管理", 11, "ion:settings-outline"),
};