forked from github/dataease
commit
719394dd1d
@ -18,12 +18,13 @@ public class VAuthModelDTO extends VAuthModelWithBLOBs implements ITreeBase<VAut
|
|||||||
|
|
||||||
private List<VAuthModelDTO> children;
|
private List<VAuthModelDTO> children;
|
||||||
|
|
||||||
private long allLeafs = 0l;
|
private long allLeafs = 0L;
|
||||||
|
|
||||||
private String innerId;
|
private String innerId;
|
||||||
|
|
||||||
private Boolean isPlugin = false;
|
private Boolean isPlugin = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
return this.getName();
|
return this.getName();
|
||||||
}
|
}
|
||||||
|
@ -45,13 +45,10 @@ public class VAuthModelService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (request.getPrivileges() != null) {
|
if (request.getPrivileges() != null) {
|
||||||
result = result.stream().filter(vAuthModelDTO -> {
|
result = result.stream().filter(vAuthModelDTO -> "spine".equalsIgnoreCase(vAuthModelDTO.getNodeType())
|
||||||
if (vAuthModelDTO.getNodeType().equalsIgnoreCase("spine") || (vAuthModelDTO.getNodeType().equalsIgnoreCase("leaf") && vAuthModelDTO.getPrivileges() != null && vAuthModelDTO.getPrivileges().contains(request.getPrivileges()))) {
|
|| ("leaf".equalsIgnoreCase(vAuthModelDTO.getNodeType())
|
||||||
return true;
|
&& vAuthModelDTO.getPrivileges() != null
|
||||||
} else {
|
&& vAuthModelDTO.getPrivileges().contains(request.getPrivileges()))).collect(Collectors.toList());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -60,10 +57,10 @@ public class VAuthModelService {
|
|||||||
if (CollectionUtils.isEmpty(result)) {
|
if (CollectionUtils.isEmpty(result)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Iterator iterator = result.listIterator();
|
Iterator<VAuthModelDTO> iterator = result.listIterator();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
VAuthModelDTO tmp = (VAuthModelDTO) iterator.next();
|
VAuthModelDTO tmp = iterator.next();
|
||||||
if (tmp.getNodeType().equalsIgnoreCase("spine") && tmp.getAllLeafs() == 0) {
|
if ("spine".equalsIgnoreCase(tmp.getNodeType()) && tmp.getAllLeafs() == 0) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
} else {
|
} else {
|
||||||
removeEmptyDir(tmp.getChildren());
|
removeEmptyDir(tmp.getChildren());
|
||||||
@ -77,9 +74,9 @@ public class VAuthModelService {
|
|||||||
vAuthModelDTO.setAllLeafs(0);
|
vAuthModelDTO.setAllLeafs(0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
long leafs = 0l;
|
long leafs = 0L;
|
||||||
for (VAuthModelDTO child : vAuthModelDTO.getChildren()) {
|
for (VAuthModelDTO child : vAuthModelDTO.getChildren()) {
|
||||||
if (child.getNodeType().equalsIgnoreCase("leaf")) {
|
if ("leaf".equalsIgnoreCase(child.getNodeType())) {
|
||||||
leafs = leafs + 1;
|
leafs = leafs + 1;
|
||||||
} else {
|
} else {
|
||||||
leafs = +leafs + getLeafs(child);
|
leafs = +leafs + getLeafs(child);
|
||||||
@ -90,13 +87,13 @@ public class VAuthModelService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private long getLeafs(VAuthModelDTO child) {
|
private long getLeafs(VAuthModelDTO child) {
|
||||||
long leafs = 0l;
|
long leafs = 0L;
|
||||||
if (CollectionUtils.isEmpty(child.getChildren())) {
|
if (CollectionUtils.isEmpty(child.getChildren())) {
|
||||||
child.setAllLeafs(0);
|
child.setAllLeafs(0);
|
||||||
return leafs;
|
return leafs;
|
||||||
}
|
}
|
||||||
for (VAuthModelDTO childChild : child.getChildren()) {
|
for (VAuthModelDTO childChild : child.getChildren()) {
|
||||||
if (childChild.getNodeType().equalsIgnoreCase("leaf")) {
|
if ("leaf".equalsIgnoreCase(childChild.getNodeType())) {
|
||||||
leafs = leafs + 1;
|
leafs = leafs + 1;
|
||||||
} else {
|
} else {
|
||||||
leafs = +leafs + getLeafs(childChild);
|
leafs = +leafs + getLeafs(childChild);
|
||||||
|
Loading…
Reference in New Issue
Block a user