增加用户查询目录树的权限校验
This commit is contained in:
parent
8921286146
commit
8b23fb63d6
|
|
@ -211,7 +211,7 @@ public class CommonService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> queryAllPrjInfo(boolean isAdminQuery) {
|
public List<String> queryAllPrjInfo(boolean isAdminQuery, List<String> prjIds) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
|
@ -219,7 +219,7 @@ public class CommonService {
|
||||||
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
|
.eq(EdFileInfo::getParentId, PRJ_PARENT_ID)
|
||||||
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code);
|
.eq(EdFileInfo::getEffectFlag, EffectFlagEnum.EFFECT.code);
|
||||||
if (!isAdminQuery) {
|
if (!isAdminQuery) {
|
||||||
queryWrapper.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code);
|
queryWrapper.eq(EdFileInfo::getDataStatus, EleDataStatusEnum.PUBLISHED.code).in(EdFileInfo::getId, prjIds);
|
||||||
}
|
}
|
||||||
List<String> ids = edFileInfoMapper.selectList(queryWrapper).stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
List<String> ids = edFileInfoMapper.selectList(queryWrapper).stream().map(EdFileInfo::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,11 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ElectromagneticResult<?> tree() {
|
public ElectromagneticResult<?> tree() {
|
||||||
List<String> strings = commonService.queryAllPrjInfo(false);
|
List<String> prjIds = permissionService.getAccessibleTree();
|
||||||
|
if (CollUtil.isEmpty(prjIds)) {
|
||||||
|
return ElectromagneticResultUtil.success(new ArrayList<>());
|
||||||
|
}
|
||||||
|
List<String> strings = commonService.queryAllPrjInfo(false, prjIds);
|
||||||
List<FileProjectVO> res = new ArrayList<>();
|
List<FileProjectVO> res = new ArrayList<>();
|
||||||
strings.forEach(e -> {
|
strings.forEach(e -> {
|
||||||
FileProjectVO fileProjectVO = JSONUtil.toList(e, FileProjectVO.class).get(0);
|
FileProjectVO fileProjectVO = JSONUtil.toList(e, FileProjectVO.class).get(0);
|
||||||
|
|
@ -686,6 +690,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ElectromagneticResult<?> upload(String parentId, MultipartFile file, Integer strategy) {
|
public ElectromagneticResult<?> upload(String parentId, MultipartFile file, Integer strategy) {
|
||||||
|
|
||||||
|
Assert.isTrue(!file.isEmpty(), "禁止上传空文件");
|
||||||
Assert.isTrue(EleCommonUtil.isFileNameValid(file.getOriginalFilename()), NAME_VALID_MSG);
|
Assert.isTrue(EleCommonUtil.isFileNameValid(file.getOriginalFilename()), NAME_VALID_MSG);
|
||||||
// 查找下一层,看是否存在顶级定义相关文件,如果存在,则该层属于管理员层级定义的,不允许上传文件
|
// 查找下一层,看是否存在顶级定义相关文件,如果存在,则该层属于管理员层级定义的,不允许上传文件
|
||||||
long dirCount = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)
|
long dirCount = this.baseMapper.selectCount(Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ public class EdPrjServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileInfo>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ElectromagneticResult<?> queryAllPrjInfo() {
|
public ElectromagneticResult<?> queryAllPrjInfo() {
|
||||||
List<String> res = commonService.queryAllPrjInfo(true);
|
List<String> res = commonService.queryAllPrjInfo(true, null);
|
||||||
List<ProjectVO> projectVOS = new ArrayList<>();
|
List<ProjectVO> projectVOS = new ArrayList<>();
|
||||||
res.forEach(e -> {
|
res.forEach(e -> {
|
||||||
ProjectVO projectVO = JSONUtil.toList(e, ProjectVO.class).get(0);
|
ProjectVO projectVO = JSONUtil.toList(e, ProjectVO.class).get(0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue