mirror of
https://github.com/certd/certd.git
synced 2025-11-25 09:10:11 +08:00
fix: 安全更新,备份数据库插件仅限管理员运行
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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"),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user