Merge pull request #1336 from dataease/pr@dev@fix_auth_tree

feat(权限): 统一授权数据集tree
This commit is contained in:
XiaJunjie2020 2021-11-30 16:31:24 +08:00 committed by GitHub
commit 83f69f0804
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,16 +27,18 @@ public class VAuthModelService {
public List<VAuthModelDTO> queryAuthModel(VAuthModelRequest request) {
request.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
List<VAuthModelDTO> result = extVAuthModelMapper.queryAuthModel(request);
result = filterData(request, result);
List<VAuthModelDTO> vAuthModelDTOS = TreeUtils.mergeTree(result);
// 定时任务选数据集时列表需去除空目录
if (request.isClearEmptyDir()) {
result = filterData(request, result);
List<VAuthModelDTO> vAuthModelDTOS = TreeUtils.mergeTree(result);
setAllLeafs(vAuthModelDTOS);
removeEmptyDir(vAuthModelDTOS);
return vAuthModelDTOS;
}
return vAuthModelDTOS;
return TreeUtils.mergeTree(result);
}
private List<VAuthModelDTO> filterData(VAuthModelRequest request, List<VAuthModelDTO> result){
private List<VAuthModelDTO> filterData(VAuthModelRequest request, List<VAuthModelDTO> result) {
if (request.getDatasetMode() != null && request.getDatasetMode() == 1) {
result = result.stream().filter(vAuthModelDTO -> {
if (vAuthModelDTO.getNodeType().equalsIgnoreCase("spine") || (vAuthModelDTO.getNodeType().equalsIgnoreCase("leaf") && vAuthModelDTO.getMode().equals(1L)) && !vAuthModelDTO.getModelInnerType().equalsIgnoreCase("excel") && !vAuthModelDTO.getModelInnerType().equalsIgnoreCase("custom")) {