mirror of https://github.com/certd/certd
fix: 修复授权配置复制功能,无法复制已加密字段的问题
parent
1bdceeecf4
commit
221e068bac
|
@ -34,7 +34,18 @@ export class AccessService extends BaseService<AccessEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async add(param) {
|
async add(param) {
|
||||||
this.encryptSetting(param, null);
|
let oldEntity = null;
|
||||||
|
if (param._copyFrom){
|
||||||
|
oldEntity = await this.info(param._copyFrom);
|
||||||
|
if (oldEntity == null) {
|
||||||
|
throw new ValidateException('该授权配置不存在,请确认是否已被删除');
|
||||||
|
}
|
||||||
|
if (oldEntity.userId !== param.userId) {
|
||||||
|
throw new ValidateException('您无权查看该授权配置');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete param._copyFrom
|
||||||
|
this.encryptSetting(param, oldEntity);
|
||||||
return await super.add(param);
|
return await super.add(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,20 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||||
},
|
},
|
||||||
rowHandle: {
|
rowHandle: {
|
||||||
width: 200,
|
width: 200,
|
||||||
|
buttons: {
|
||||||
|
copy: {
|
||||||
|
async click(ctx: any) {
|
||||||
|
const { row, index } = ctx;
|
||||||
|
await crudExpose.openCopy({
|
||||||
|
row: {
|
||||||
|
...row,
|
||||||
|
_copyFrom: row.id,
|
||||||
|
},
|
||||||
|
index: index,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
columns: {
|
columns: {
|
||||||
id: {
|
id: {
|
||||||
|
|
Loading…
Reference in New Issue