perf: 检查cname是否正确配置

This commit is contained in:
xiaojunnuo
2024-10-09 02:34:28 +08:00
parent 9498d189e4
commit b5d8935159
36 changed files with 321 additions and 190 deletions
@@ -15,6 +15,7 @@ import {
import { BaseController } from '@certd/lib-server';
import { AccessService } from '../service/access-service.js';
import { EmailService } from '../../basic/service/email-service.js';
import { AccessGetter } from '../service/access-getter.js';
@Provide()
@Controller('/api/pi/handle')
@@ -49,6 +50,7 @@ export class HandleController extends BaseController {
@Post('/plugin', { summary: Constants.per.authOnly })
async pluginRequest(@Body(ALL) body: PluginRequestHandleReq) {
const userId = this.getUserId();
const pluginDefine = pluginRegistry.get(body.typeName);
const pluginCls = pluginDefine.target;
if (pluginCls == null) {
@@ -59,6 +61,9 @@ export class HandleController extends BaseController {
const plugin: PluginRequestHandler = new pluginCls();
//@ts-ignore
const instance = plugin as ITaskPlugin;
const accessGetter = new AccessGetter(userId, this.accessService.getById.bind(this.accessService));
//@ts-ignore
const taskCtx: TaskInstanceContext = {
pipeline: undefined,
@@ -67,7 +72,7 @@ export class HandleController extends BaseController {
http,
logger: logger,
inputChanged: true,
accessService: this.accessService,
accessService: accessGetter,
emailService: this.emailService,
pipelineContext: undefined,
userContext: undefined,
@@ -1,11 +1,9 @@
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
import { CrudController } from '@certd/lib-server';
import { Constants, CrudController, SysSettingsService } from '@certd/lib-server';
import { PipelineService } from '../service/pipeline-service.js';
import { PipelineEntity } from '../entity/pipeline.js';
import { Constants } from '@certd/lib-server';
import { HistoryService } from '../service/history-service.js';
import { AuthService } from '../../sys/authority/service/auth-service.js';
import { SysSettingsService } from '@certd/lib-server';
/**
* 证书
@@ -18,6 +18,7 @@ export class AccessService extends BaseService<AccessEntity> {
@Inject()
encryptService: EncryptService;
//@ts-ignore
getRepository() {
return this.repository;
}
@@ -101,13 +102,13 @@ export class AccessService extends BaseService<AccessEntity> {
return await super.update(param);
}
async getById(id: any, userId?: number): Promise<any> {
async getById(id: any, userId: number): Promise<any> {
const entity = await this.info(id);
if (entity == null) {
throw new Error(`该授权配置不存在,请确认是否已被删除:id=${id}`);
}
if (userId !== entity.userId) {
throw new PermissionException('您对该授权无访问权限');
throw new PermissionException('您对该Access授权无访问权限');
}
// const access = accessRegistry.get(entity.type);
const setting = this.decryptAccessEntity(entity);
@@ -13,6 +13,7 @@ export class HistoryLogService extends BaseService<HistoryLogEntity> {
@InjectEntityModel(HistoryLogEntity)
repository: Repository<HistoryLogEntity>;
//@ts-ignore
getRepository() {
return this.repository;
}
@@ -27,6 +27,7 @@ export class HistoryService extends BaseService<HistoryEntity> {
@Config('certd')
private certdConfig: any;
//@ts-ignore
getRepository() {
return this.repository;
}
@@ -54,6 +54,7 @@ export class PipelineService extends BaseService<PipelineEntity> {
@Config('certd')
private certdConfig: any;
//@ts-ignore
getRepository() {
return this.repository;
}
@@ -12,6 +12,7 @@ export class StorageService extends BaseService<StorageEntity> {
@InjectEntityModel(StorageEntity)
repository: Repository<StorageEntity>;
//@ts-ignore
getRepository() {
return this.repository;
}