perf: EAB授权支持绑定邮箱,支持公共EAB设置

This commit is contained in:
xiaojunnuo
2024-10-14 03:17:10 +08:00
parent e8b617b80c
commit 07043aff0c
32 changed files with 374 additions and 57 deletions
@@ -24,7 +24,7 @@ export class CnameRecordController extends CrudController<CnameRecordService> {
const bq = qb => {
if (domain) {
qb.where('domain like :domain', { domain: `%${domain}%` });
qb.andWhere('domain like :domain', { domain: `%${domain}%` });
}
};
@@ -21,7 +21,7 @@ export class AccessController extends CrudController<AccessService> {
body.query = body.query ?? {};
delete body.query.userId;
const buildQuery = qb => {
qb.where('user_id = :userId', { userId: this.getUserId() });
qb.andWhere('user_id = :userId', { userId: this.getUserId() });
};
const res = await this.service.page({
query: body.query,
@@ -51,7 +51,7 @@ export class HistoryController extends CrudController<HistoryService> {
const pipelines = await this.pipelineService.list({
query: pipelineQuery,
buildQuery: qb => {
qb.where('title like :title', { title: `%${pipelineTitle}%` });
qb.andWhere('title like :title', { title: `%${pipelineTitle}%` });
},
});
pipelineIds = pipelines.map(p => p.id);
@@ -59,7 +59,7 @@ export class HistoryController extends CrudController<HistoryService> {
const buildQuery = qb => {
if (pipelineIds) {
qb.where({
qb.andWhere({
pipelineId: In(pipelineIds),
});
}
@@ -37,7 +37,7 @@ export class PipelineController extends CrudController<PipelineService> {
const buildQuery = qb => {
if (title) {
qb.where('title like :title', { title: `%${title}%` });
qb.andWhere('title like :title', { title: `%${title}%` });
}
};
if (!body.sort || !body.sort?.prop) {
@@ -1,6 +1,7 @@
import { ALL, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
import { BaseController, Constants } from '@certd/lib-server';
import { PluginService } from '../../modules/plugin/service/plugin-service.js';
import { PluginConfigService } from '../../modules/plugin/service/plugin-config-service.js';
/**
* 插件
@@ -11,6 +12,9 @@ export class PluginController extends BaseController {
@Inject()
service: PluginService;
@Inject()
pluginConfigService: PluginConfigService;
@Post('/list', { summary: Constants.per.authOnly })
async list(@Query(ALL) query: any) {
query.userId = this.getUserId();
@@ -24,4 +28,10 @@ export class PluginController extends BaseController {
const group = await this.service.getEnabledBuildInGroup();
return this.ok(group);
}
@Post('/config', { summary: Constants.per.authOnly })
async config(@Body(ALL) body: { id?: number; name?: string; type: string }) {
const config = await this.pluginConfigService.getPluginConfig(body);
return this.ok(config);
}
}
@@ -3,6 +3,7 @@ import { merge } from 'lodash-es';
import { CrudController } from '@certd/lib-server';
import { PluginService } from '../../../modules/plugin/service/plugin-service.js';
import { checkComm } from '@certd/pipeline';
import { CommPluginConfig, PluginConfigService } from '../../../modules/plugin/service/plugin-config-service.js';
/**
* 插件
@@ -13,6 +14,9 @@ export class PluginController extends CrudController<PluginService> {
@Inject()
service: PluginService;
@Inject()
pluginConfigService: PluginConfigService;
getService() {
checkComm();
return this.service;
@@ -65,4 +69,15 @@ export class PluginController extends CrudController<PluginService> {
await this.service.setDisabled(body);
return this.ok();
}
@Post('/getCommPluginConfigs', { summary: 'sys:settings:edit' })
async getCommPluginConfigs() {
const res = await this.pluginConfigService.getCommPluginConfig();
return this.ok(res);
}
@Post('/saveCommPluginConfigs', { summary: 'sys:settings:edit' })
async saveCommPluginConfigs(@Body(ALL) body: CommPluginConfig) {
const res = await this.pluginConfigService.saveCommPluginConfig(body);
return this.ok(res);
}
}