diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 4ffcfc8cda..573b35f791 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -1019,7 +1019,6 @@ public class TableDataTreePane extends BasicTableDataTreePane { AbstractTableDataPane tableDataPane = wrapper.creatTableDataPane(); - String tableDataName = wrapper.getTableDataName(); if (TableDataAuthHelper.needCheckAuthWhenEdit(wrapper.getTableData())) { // 先打开一个Loading面板 TableDataLoadingPane loadingPane = new TableDataLoadingPane(); @@ -1028,8 +1027,11 @@ public class TableDataTreePane extends BasicTableDataTreePane { new SwingWorker() { @Override protected Boolean doInBackground() throws Exception { + // 获取无权限连接名称集合 Collection noAuthConnections = TableDataAuthHelper.getNoAuthConnections(); - return !noAuthConnections.contains(tableDataName); + // 获取当前数据集对应的数据连接名称 + String connectionName = TableDataAuthHelper.getConnectionNameByDBTableData((DBTableData) wrapper.getTableData()); + return !noAuthConnections.contains(connectionName); } @Override diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/auth/TableDataAuthHelper.java b/designer-base/src/main/java/com/fr/design/data/datapane/auth/TableDataAuthHelper.java index 2d7a6c4c7a..382e04dd94 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/auth/TableDataAuthHelper.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/auth/TableDataAuthHelper.java @@ -1,13 +1,13 @@ package com.fr.design.data.datapane.auth; import com.fr.base.TableData; +import com.fr.data.impl.Connection; import com.fr.data.impl.DBTableData; -import com.fr.decision.base.util.CollectionUtil; -import com.fr.stable.collections.CollectionUtils; +import com.fr.data.impl.NameDatabaseConnection; +import com.fr.stable.StringUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.server.connection.DBConnectAuth; -import javax.swing.SwingWorker; import java.util.Collection; import java.util.Collections; @@ -37,4 +37,21 @@ public class TableDataAuthHelper { Collection noAuthConnections = WorkContext.getCurrent().get(DBConnectAuth.class).getNoAuthConnections(); return noAuthConnections == null ? Collections.emptyList() : noAuthConnections; } + + /** + * 通过数据集获取其数据连接的名称 + * + * 注意: + * 1. Connection接口本身是不提供名称的,只有我们内部为了使用方便,将其包装成了NameDataBaseConnection + * 如果不是NameDataBaseConnection类型,则无名称,因此这里只能用判断类型的方式获取名称 + * 2. 仅支持DBTableData获取连接名 + * @return + */ + public static String getConnectionNameByDBTableData(DBTableData tableData) { + Connection database = tableData.getDatabase(); + if (database instanceof NameDatabaseConnection) { + return ((NameDatabaseConnection) database).getName(); + } + return StringUtils.EMPTY; + } }