From fb7f66ac4ea394b87e110175b6d7ebe0fd843bdf Mon Sep 17 00:00:00 2001 From: qyx <565485304@qq.com> Date: Tue, 10 Aug 2021 16:39:48 +0800 Subject: [PATCH] =?UTF-8?q?[Bug=E4=BF=AE=E5=A4=8D](master):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BA=86=E4=B8=80=E4=BA=9B=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复了一些问题 --- .../rest/TbUploadFileNewController.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/rest/TbUploadFileNewController.java b/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/rest/TbUploadFileNewController.java index cfadcaa..ae9be9b 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/rest/TbUploadFileNewController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/rest/TbUploadFileNewController.java @@ -30,6 +30,7 @@ import me.zhengjie.exception.BadRequestException; import me.zhengjie.modules.constant.DefaultConstant; import me.zhengjie.modules.formdata.service.FormdataService; import me.zhengjie.modules.formdata.service.dto.FormdataDto; +import me.zhengjie.modules.upload.consts.SysConst; import me.zhengjie.modules.uploadnew.domain.TbUploadFileNew; import me.zhengjie.modules.uploadnew.redis.RedisParentDao; import me.zhengjie.modules.uploadnew.service.TbUploadFileNewService; @@ -60,6 +61,7 @@ import java.util.Objects; import static me.zhengjie.modules.constant.FileConstant.*; import static me.zhengjie.modules.upload.consts.UploadFileConst.FILE_PATH_SPLIT; +import static me.zhengjie.modules.upload.consts.UploadFileConst.WHITE_LIST; import static me.zhengjie.modules.uploadnew.consts.SysConstNew.*; @@ -105,9 +107,29 @@ public class TbUploadFileNewController { @ApiOperation("查询文件上传接口") @PreAuthorize("@el.check('tbUploadFileNew:list')") public ResponseEntity query(TbUploadFileNewQueryCriteria criteria, Pageable pageable) { + filterOfWriteList(criteria); + log.info("======= [ criteria is {} ] =======", criteria.toString()); return new ResponseEntity<>(tbUploadFileNewService.queryAll(criteria, pageable), HttpStatus.OK); } + + /** + * 加一个判断,除了白名单账户外,其他的人查询只能返回自己上传的列表 + * + * @param criteria 查询的参数 + * + * @return + */ + private void filterOfWriteList(TbUploadFileNewQueryCriteria criteria) { + if (!SysConst.sysDebug){ + if (!CollectionUtil.contains(WHITE_LIST, SecurityUtils.getCurrentUsername())){ + criteria.setOperation(SecurityUtils.getCurrentUsername()); + log.info("======= [TbUploadFileNewController|filterOfWriteList, userName is {} ] =======", SecurityUtils.getCurrentUsername()); + } + } + } + + @PostMapping @Log("新增文件上传接口") @ApiOperation("新增文件上传接口")