mirror of
https://github.com/certd/certd.git
synced 2026-04-23 19:57:27 +08:00
chore:
This commit is contained in:
@@ -4,6 +4,20 @@
|
||||
# server:
|
||||
# baseUrl: 'http://127.0.0.1:11007'
|
||||
|
||||
#flyway:
|
||||
# scriptDir: './db/migration-pg'
|
||||
|
||||
#typeorm:
|
||||
# dataSource:
|
||||
# default:
|
||||
# type: postgres
|
||||
# host: localhost
|
||||
# port: 5433
|
||||
# username: postgres
|
||||
# password: root
|
||||
# database: postgres
|
||||
|
||||
|
||||
plus:
|
||||
server:
|
||||
baseUrls: ['https://api.ai.handsfree.work', 'https://api.ai.docmirror.cn']
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"build": "mwtsc --cleanOutDir --skipLibCheck",
|
||||
"build-on-docker": "node ./before-build.js && npm run build",
|
||||
"up-mw-deps": "npx midway-version -u -w",
|
||||
"heap": "clinic heapprofiler -- node ./bootstrap.js",
|
||||
"heap": "clinic heapprofiler -- node ./bootstrap.js",
|
||||
"flame": "clinic flame -- node ./bootstrap.js"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -37,22 +37,19 @@ export class HandleController extends BaseController {
|
||||
//@ts-ignore
|
||||
const access = new accessCls();
|
||||
|
||||
let isNew = true;
|
||||
let inputAccess = body.input.access;
|
||||
if (body.input.id > 0) {
|
||||
const oldEntity = await this.accessService.info(body.input.id);
|
||||
if (!oldEntity) {
|
||||
isNew = false;
|
||||
const param = {
|
||||
if (oldEntity) {
|
||||
const param: any = {
|
||||
type: body.typeName,
|
||||
setting: JSON.stringify(body.input.access),
|
||||
};
|
||||
this.accessService.encryptSetting(param, oldEntity);
|
||||
body.input.access = JSON.parse(param.setting);
|
||||
inputAccess = this.accessService.decryptAccessEntity(param);
|
||||
}
|
||||
}
|
||||
if (isNew) {
|
||||
mergeUtils.merge(access, body.input.access);
|
||||
}
|
||||
mergeUtils.merge(access, inputAccess);
|
||||
|
||||
const ctx: AccessRequestHandleContext = {
|
||||
http: http,
|
||||
|
||||
@@ -108,6 +108,14 @@ export class AccessService extends BaseService<AccessEntity> implements IAccessS
|
||||
throw new Error(`该授权配置不存在,请确认是否已被删除:id=${id}`);
|
||||
}
|
||||
// const access = accessRegistry.get(entity.type);
|
||||
const setting = this.decryptAccessEntity(entity);
|
||||
return {
|
||||
id: entity.id,
|
||||
...setting,
|
||||
};
|
||||
}
|
||||
|
||||
decryptAccessEntity(entity: AccessEntity): any {
|
||||
let setting = {};
|
||||
if (entity.encryptSetting && entity.encryptSetting !== '{}') {
|
||||
setting = JSON.parse(entity.encryptSetting);
|
||||
@@ -123,10 +131,7 @@ export class AccessService extends BaseService<AccessEntity> implements IAccessS
|
||||
} else if (entity.setting) {
|
||||
setting = JSON.parse(entity.setting);
|
||||
}
|
||||
return {
|
||||
id: entity.id,
|
||||
...setting,
|
||||
};
|
||||
return setting;
|
||||
}
|
||||
|
||||
getDefineList() {
|
||||
|
||||
Reference in New Issue
Block a user