Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.sql.SQLException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;

@Service
@Slf4j
Expand Down Expand Up @@ -214,7 +215,8 @@ private void excludeColumns(Dataframe data, Set<SelectColumn> include) {
.noneMatch(selectColumn ->
column.columnKey().equals(selectColumn.getColumnKey())
|| column.columnKey().equals(selectColumn.getAlias())
|| column.columnKey().contains(selectColumn.getColumnKey()))) {
// 用正则做聚合函数权限的判断 剔除原来的contains判断

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @vip2193 should we avoid to using Chinese? cc @scottsut

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok i will change to use english

|| Pattern.matches("(\\w+\\(" + selectColumn.getColumnKey() +"\\))",column.columnKey()) )) {
excludeIndex.add(i);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,11 @@ private Set<SelectColumn> parseColumnPermission(View view) {
try {
Set<SelectColumn> columns = new HashSet<>();
List<RelSubjectColumns> relSubjectColumns = rscMapper.listByUser(view.getId(), getCurrentUser().getId());
if(relSubjectColumns.isEmpty()){
return Collections.singleton(SelectColumn.of(null, "*"));
}else if(relSubjectColumns.size() == 1 && relSubjectColumns.get(0).getColumnPermission().equals("[]")){
return Collections.singleton(SelectColumn.of(null, "''"));
}
for (RelSubjectColumns relSubjectColumn : relSubjectColumns) {
List<String> cols = (List<String>) objectMapper.readValue(relSubjectColumn.getColumnPermission(), ArrayList.class);
if (!CollectionUtils.isEmpty(cols)) {
Expand Down