mirror of
https://github.com/certd/certd.git
synced 2025-11-25 09:10:11 +08:00
fix: 修复授权配置复制功能,无法复制已加密字段的问题
This commit is contained in:
@@ -34,7 +34,18 @@ export class AccessService extends BaseService<AccessEntity> {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user