Browse Source

Pull request #14798: REPORT-134200 & REPORT-133424 & REPORT-134249

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

* commit '338bf30be1efb7b8f6ab3f793fd185e1fb1528a8':
  REPORT-134249 【fr-fbp回归】模板数据集会触发权限校验
  REPORT-133424 【fr-fbp回归】打开模板A,切换环境,模板A的锁定状态不会解除
  REPORT-134200 【fr-fbp回归】建立hsql数据驱动的数据连接失败
fbp/release
Destiny.Lin-林锦龙 3 months ago
parent
commit
7dc9201cd2
  1. 26
      designer-base/src/main/java/com/fr/design/backup/EnvBackupHelper.java
  2. 10
      designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java
  3. 3
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

26
designer-base/src/main/java/com/fr/design/backup/EnvBackupHelper.java

@ -4,11 +4,13 @@ import com.fanruan.carina.Carina;
import com.fanruan.config.realm.ConfigRepositoryFactory; import com.fanruan.config.realm.ConfigRepositoryFactory;
import com.fanruan.config.realm.local.LocalConfigRepositoryBuilder; import com.fanruan.config.realm.local.LocalConfigRepositoryBuilder;
import com.fr.design.ConfigHelper; import com.fr.design.ConfigHelper;
import com.fr.design.env.RemoteWorkspace;
import com.fr.design.mem.MemConfigBackupManager; import com.fr.design.mem.MemConfigBackupManager;
import com.fr.design.mem.MemConfigRepositoryBuilder; import com.fr.design.mem.MemConfigRepositoryBuilder;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.fr.workspace.Workspace; import com.fr.workspace.Workspace;
import com.fr.workspace.server.repository.connect.FineWorkspaceHttpClient;
import java.util.Properties; import java.util.Properties;
@ -42,11 +44,13 @@ public class EnvBackupHelper {
FineLoggerFactory.getLogger().info("[EnvBackup] 1.back start..."); FineLoggerFactory.getLogger().info("[EnvBackup] 1.back start...");
this.swtiching = true; this.swtiching = true;
local = WorkContext.getCurrent().isLocal(); local = WorkContext.getCurrent().isLocal();
origin = WorkContext.getCurrent();
if (local) { if (local) {
properties = ConfigHelper.getEnvProperties(); properties = ConfigHelper.getEnvProperties();
path = ConfigHelper.getEnvPropertiesPath(); path = ConfigHelper.getEnvPropertiesPath();
} else {
closeEnv();
} }
origin = WorkContext.getCurrent();
} }
/** /**
@ -107,10 +111,30 @@ public class EnvBackupHelper {
} else { } else {
// 如果是远程,则新环境的配置全部弃用,直接走老的 // 如果是远程,则新环境的配置全部弃用,直接走老的
MemConfigBackupManager.getInstance().failed(); MemConfigBackupManager.getInstance().failed();
rollbackEnv();
} }
} }
/**
* 关闭环境
*/
public void closeEnv() {
// 如果原来是远程,要先发请求告诉原来的环境我这边要断开
if (origin instanceof RemoteWorkspace) {
origin.close();
}
}
/**
* 重新进入老环境
*/
public void rollbackEnv() {
if (origin instanceof RemoteWorkspace && ((RemoteWorkspace) origin).getClient() instanceof FineWorkspaceHttpClient) {
((FineWorkspaceHttpClient) ((RemoteWorkspace) origin).getClient()).startHeartBeat();
}
}
public boolean isSwtiching() { public boolean isSwtiching() {
return swtiching; return swtiching;
} }

10
designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java

@ -157,7 +157,7 @@ public class ConnectionInfoBeanHelper {
.user(jdbcConnection.getUser()) .user(jdbcConnection.getUser())
.driver(jdbcConnection.getDriver()) .driver(jdbcConnection.getDriver())
// 关键中的关键,由设计器发出的请求如果要携带密码,不能传明文,必须必须必须传加密后的密码 // 关键中的关键,由设计器发出的请求如果要携带密码,不能传明文,必须必须必须传加密后的密码
.password(withPassword ? encrypt(jdbcConnection.getPassword()) : DecisionServiceConstants.DEFAULT_PASSWORD) .password(withPassword ? DataEncryptionHelper.encrypt(jdbcConnection.getPassword()) : DecisionServiceConstants.DEFAULT_PASSWORD)
.schema(jdbcConnection.getSchema()) .schema(jdbcConnection.getSchema())
.url(jdbcConnection.getURL()) .url(jdbcConnection.getURL())
.creator(jdbcConnection.getCreator()) .creator(jdbcConnection.getCreator())
@ -188,14 +188,6 @@ public class ConnectionInfoBeanHelper {
.verifyCa(jdbcConnection.getSsl().getSslType() == SslType.NORMAL && ((NormalSsl) jdbcConnection.getSsl()).isVerifyCa()); .verifyCa(jdbcConnection.getSsl().getSslType() == SslType.NORMAL && ((NormalSsl) jdbcConnection.getSsl()).isVerifyCa());
} }
private static String encrypt(String password) {
// 如果是空密码或者默认密码,就返回默认的星号回去
if (StringUtils.isEmpty(password) || StringUtils.equals(password, DecisionServiceConstants.DEFAULT_PASSWORD)) {
return DecisionServiceConstants.DEFAULT_PASSWORD;
}
return TransmissionEncryptionManager.getInstance().getEncryption(WorkplaceConstants.getEncryptionMode()).encrypt(password, WorkplaceConstants.getEncryptionKey());
}
private static Connection createJDBCConnection(ConnectionInfoBean connectionInfoBean) throws Exception { private static Connection createJDBCConnection(ConnectionInfoBean connectionInfoBean) throws Exception {
String name = connectionInfoBean.getConnectionName(); String name = connectionInfoBean.getConnectionName();

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

@ -1751,6 +1751,9 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
private boolean checkJTemplateAuthority() { private boolean checkJTemplateAuthority() {
if (WorkContext.getCurrent().isRoot()) {
return true;
}
ConnectionAuthorityConfigBean bean = ConnectionRepository.getInstance().getConnectionAuthorityConfig(); ConnectionAuthorityConfigBean bean = ConnectionRepository.getInstance().getConnectionAuthorityConfig();
if (!(bean !=null && bean.isConnectionEditAuth())) { if (!(bean !=null && bean.isConnectionEditAuth())) {
return true; return true;

Loading…
Cancel
Save