Browse Source

Pull request #14794: REPORT-133183 & REPORT-133535

Merge in DESIGN/design from ~DESTINY.LIN/design:fbp/release to fbp/release

* commit 'd6508e670b49fc46e92ff1bc295d8debd63aaf2e':
  REPORT-133535 【fr-fbp回归】模板内数据连接鉴权失败
  REPORT-133535 【fr-fbp回归】模板内数据连接鉴权失败
  REPORT-133183 【fr-fbp回归】【数据集】236环境,新建/编辑存在驱动的mysql数据连接,保存报错
fbp/merge
Destiny.Lin-林锦龙 4 months ago
parent
commit
3250101685
  1. 7
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  2. 5
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  3. 12
      designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java

7
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -262,7 +262,12 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
*/
private boolean needUpdate0(Connection origin, Connection connection) {
// 先不考虑插件
return !connection.equals(origin);
try {
return !connection.equals(origin);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false;
}
}
/**

5
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -1,5 +1,6 @@
package com.fr.design.mainframe;
import com.fanruan.datasource.web.bean.ConnectionAuthorityConfigBean;
import com.fanruan.product.ProductConstants;
import com.fine.theme.icon.LazyIcon;
import com.fr.base.Parameter;
@ -101,6 +102,7 @@ import com.fr.widgettheme.designer.WidgetThemeDisplayAction;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
import com.fr.workspace.server.repository.WorkplaceConstants;
import com.fr.workspace.server.repository.connection.ConnectionRepository;
import com.fr.workspace.server.repository.template.TemplateRepository;
import javax.swing.BorderFactory;
@ -1749,7 +1751,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
private boolean checkJTemplateAuthority() {
if (!WorkplaceConstants.isConnectionEditAuth()) {
ConnectionAuthorityConfigBean bean = ConnectionRepository.getInstance().getConnectionAuthorityConfig();
if (!(bean !=null && bean.isConnectionEditAuth())) {
return true;
}
JTemplateAuthorityChecker jTemplateAuthorityChecker = new JTemplateAuthorityChecker(this);

12
designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java

@ -29,9 +29,7 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE;
public class JTemplateAuthorityChecker {
JTemplate<?, ?> jTemplate;
Set<String> allConnectionNames;
Set<String> authConnectionNames;
Set<String> allDatasetNames;
Set<String> authDatasetNames;
Map<String, ElementAuthorityChecker> checkerMap = new HashMap<>();
Set<String> authFailConnectionNames = new HashSet<>();
@ -47,13 +45,7 @@ public class JTemplateAuthorityChecker {
}
private void initAuthNames() {
allDatasetNames = new HashSet<>();
for (String authServerDataSetName : TableDataConfigProviderFactory.getInstance().getTableDatas().keySet()) {
allDatasetNames.add(authServerDataSetName);
}
allConnectionNames = ConnectionConfigProviderFactory.getConfigProvider().getConnections().keySet();
// 无需获取所有数据集和数据连接了,当前只能获取自己有权限的
Map<String, Set<String>> authNamesMap = RemoteAuthorityRepository.getInstance().getAuthServerDataSetAndConnectionNames(WorkContext.getCurrent().getConnection().getUserName());
if (authNamesMap != null) {
//有权限的数据连接名称
@ -95,8 +87,6 @@ public class JTemplateAuthorityChecker {
}
}
}
authFailConnectionNames.retainAll(allConnectionNames);
authFailDatasetNames.retainAll(allDatasetNames);
FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker check time consume:" + (System.currentTimeMillis() - s));
return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0;
}

Loading…
Cancel
Save