Skip to content

Commit

Permalink
Merge branch 'devel' into dbeaver/dbeaver-devops#1630-migretion-to-no…
Browse files Browse the repository at this point in the history
…n-root-user
  • Loading branch information
dariamarutkina authored Jan 20, 2025
2 parents e3659e4 + a6da712 commit f94b000
Show file tree
Hide file tree
Showing 170 changed files with 1,907 additions and 792 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ You can see a live demo of CloudBeaver here: https://demo.cloudbeaver.io

## Changelog

### 24.3.3. 2025-01-20
- Administration:
- Added an ability to match users from LDAP configuration with CloudBeaver users;
- New environment variables were introduced for theme styling, SQL editor, and log viewer settings. You can use them for quick setup during the initial Docker configuration stage.
- General:
- An ability to show metadata object comments was added in the Navigator tree. You can enable it in the database navigator settings panel;
- Added transaction log viewing for connections with manual commit mode. This allows users to see all modifying statements before committing;
- Added an ability to import data in tables without unique keys;
- Added an ability to insert data in tables without unique keys;
- Added Ctrl + Shift + S (Cmd + Shift + S on Mac) shortcut for "Save As Script" action.

### 24.3.2. 2025-01-06
- Added an ability to specify a user login as an attribute parameter for LDAP providers;
- The collapse of the grouping panel doesn't lead to the full panel cleaning anymore.
Expand Down
18 changes: 9 additions & 9 deletions config/core/cloudbeaver.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@

productSettings: {
# Global properties
core.theming.theme: 'light',
core.localization.localization: 'en',
plugin.sql-editor.autoSave: true,
plugin.sql-editor.disabled: false,
core.theming.theme: "${CLOUDBEAVER_CORE_THEMING_THEME:light}",
core.localization.localization: "${CLOUDBEAVER_CORE_LOCALIZATION:en}",
plugin.sql-editor.autoSave: "${CLOUDBEAVER_SQL_EDITOR_AUTOSAVE:true}",
plugin.sql-editor.disabled: "${CLOUDBEAVER_SQL_EDITOR_DISABLED:false}",
# max size of the file that can be uploaded to the editor (in kilobytes)
plugin.sql-editor.maxFileSize: 10240,
plugin.log-viewer.disabled: false,
plugin.log-viewer.logBatchSize: 1000,
plugin.log-viewer.maxLogRecords: 2000,
sql.proposals.insert.table.alias: PLAIN
plugin.sql-editor.maxFileSize: "${CLOUDBEAVER_SQL_EDITOR_MAX_FILE_SIZE:10240}",
plugin.log-viewer.disabled: "${CLOUDBEAVER_LOG_VIEWER_DISABLED:false}",
plugin.log-viewer.logBatchSize: "${CLOUDBEAVER_LOG_VIEWER_LOG_BATCH_SIZE:1000}",
plugin.log-viewer.maxLogRecords: "${CLOUDBEAVER_LOG_VIEWER_MAX_LOG_RECORDS:2000}",
sql.proposals.insert.table.alias: "${CLOUDBEAVER_SQL_PROPOSALS_INSERT_TABLE_ALIAS:PLAIN}"
},

expireSessionAfterPeriod: "${CLOUDBEAVER_EXPIRE_SESSION_AFTER_PERIOD:1800000}",
Expand Down
4 changes: 2 additions & 2 deletions server/bundles/io.cloudbeaver.model/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
Bundle-Vendor: DBeaver Corp
Bundle-Name: Cloudbeaver Web Model
Bundle-SymbolicName: io.cloudbeaver.model;singleton:=true
Bundle-Version: 1.0.69.qualifier
Bundle-Release-Date: 20250120
Bundle-Version: 1.0.70.qualifier
Bundle-Release-Date: 20250203
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Expand Down
2 changes: 1 addition & 1 deletion server/bundles/io.cloudbeaver.model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<relativePath>../</relativePath>
</parent>
<artifactId>io.cloudbeaver.model</artifactId>
<version>1.0.69-SNAPSHOT</version>
<version>1.0.70-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@
import java.util.stream.Collectors;

public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSourcePersistentRegistry, DBPDataSourceRegistryCache {
@NotNull
private final DataSourceFilter dataSourceFilter;
@NotNull
private final DataSourceRegistry<?> dataSourceRegistry;

public WebDataSourceRegistryProxy(DataSourceRegistry<?> dataSourceRegistry, DataSourceFilter filter) {
public WebDataSourceRegistryProxy(@NotNull DataSourceRegistry<?> dataSourceRegistry, @NotNull DataSourceFilter filter) {
this.dataSourceRegistry = dataSourceRegistry;
this.dataSourceFilter = filter;
}
Expand All @@ -62,7 +64,7 @@ public DBPProject getProject() {
@Override
public DBPDataSourceContainer getDataSource(@NotNull String id) {
DBPDataSourceContainer dataSource = dataSourceRegistry.getDataSource(id);
if (dataSource == null || dataSourceFilter != null && !dataSourceFilter.filter(dataSource)) {
if (dataSource == null || !dataSourceFilter.filter(dataSource)) {
return null;
}
return dataSource;
Expand All @@ -71,7 +73,7 @@ public DBPDataSourceContainer getDataSource(@NotNull String id) {
@Nullable
@Override
public DBPDataSourceContainer getDataSource(@NotNull DBPDataSource dataSource) {
if (dataSourceFilter != null && !dataSourceFilter.filter(dataSource.getContainer())) {
if (!dataSourceFilter.filter(dataSource.getContainer())) {
return null;
}
return dataSourceRegistry.getDataSource(dataSource);
Expand All @@ -81,10 +83,8 @@ public DBPDataSourceContainer getDataSource(@NotNull DBPDataSource dataSource) {
@Override
public DBPDataSourceContainer findDataSourceByName(String name) {
var dataSource = dataSourceRegistry.findDataSourceByName(name);
if (dataSource != null) {
if (dataSourceFilter == null || dataSourceFilter.filter(dataSource)) {
return dataSource;
}
if (dataSource != null && dataSourceFilter.filter(dataSource)) {
return dataSource;
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ protected DBPDataSourceRegistry createDataSourceRegistry() {
);
}

@NotNull
protected DataSourceRegistry<?> createRMRegistry() {
return new DataSourceRegistryRM<>(this, getResourceController(), preferenceStore);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.cloudbeaver.utils.ServletAppUtils;
import io.cloudbeaver.utils.WebCommonUtils;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.*;
Expand Down Expand Up @@ -76,6 +77,8 @@ public class WebConnectionInfo {
private String connectTime;
private String serverVersion;
private String clientVersion;
@Nullable
private Boolean credentialsSavedInSession;

private transient Map<String, Object> savedAuthProperties;
private transient List<WebNetworkHandlerConfigInput> savedNetworkCredentials;
Expand Down Expand Up @@ -195,7 +198,8 @@ public boolean isSaveCredentials() {

@Property
public boolean isCredentialsSaved() throws DBException {
return dataSourceContainer.isCredentialsSaved();
// isCredentialsSaved can be true if credentials were saved during connection init for global project
return dataSourceContainer.isCredentialsSaved() && !(credentialsSavedInSession != null && credentialsSavedInSession);
}

@Property
Expand Down Expand Up @@ -514,4 +518,10 @@ public List<String> getTools() {
return tools;
}

/**
* Updates param that checks whether credentials were saved only in session.
*/
public void setCredentialsSavedInSession(@Nullable Boolean credentialsSavedInSession) {
this.credentialsSavedInSession = credentialsSavedInSession;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,20 @@
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.connection.DBPDataSourceProviderDescriptor;
import org.jkiss.dbeaver.model.connection.DBPDriver;
import org.jkiss.dbeaver.model.connection.DBPDriverLibrary;
import org.jkiss.dbeaver.registry.DataSourceProviderRegistry;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class WebDriverRegistry {

Expand All @@ -42,6 +51,7 @@ public synchronized static WebDriverRegistry getInstance() {
return instance;
}

private final List<DBPDriver> applicableDrivers = new ArrayList<>();
private final Set<String> webDrivers = new HashSet<>();

protected WebDriverRegistry() {
Expand All @@ -59,8 +69,48 @@ private void loadExtensions(IExtensionRegistry registry) {
}
}

public boolean isDriverEnabled(DBPDriver driver) {
return webDrivers.contains(driver.getFullId());
public List<DBPDriver> getApplicableDrivers() {
return applicableDrivers;
}

/**
* Updates info about applicable drivers (f.e. some changes were made in driver config file).
*/
public void refreshApplicableDrivers() {
this.applicableDrivers.clear();
this.applicableDrivers.addAll(
DataSourceProviderRegistry.getInstance().getEnabledDataSourceProviders().stream()
.map(DBPDataSourceProviderDescriptor::getEnabledDrivers)
.flatMap(List::stream)
.filter(this::isDriverApplicable)
.toList());
log.info("Available drivers: " + applicableDrivers.stream().map(DBPDriver::getFullName).collect(Collectors.joining(",")));
}

protected boolean isDriverApplicable(@NotNull DBPDriver driver) {
List<? extends DBPDriverLibrary> libraries = driver.getDriverLibraries();
if (!webDrivers.contains(driver.getFullId())) {
return false;
}
boolean hasAllFiles = true;
for (DBPDriverLibrary lib : libraries) {
if (!isDriverLibraryFilePresent(lib)) {
hasAllFiles = false;
log.error("\tDriver '" + driver.getId() + "' is missing library '" + lib.getDisplayName() + "'");
} else {
if (lib.getType() == DBPDriverLibrary.FileType.jar) {
return true;
}
}
}
return hasAllFiles;
}

private boolean isDriverLibraryFilePresent(@NotNull DBPDriverLibrary lib) {
if (lib.getType() == DBPDriverLibrary.FileType.license) {
return true;
}
Path localFile = lib.getLocalFile();
return localFile != null && Files.exists(localFile);
}
}
4 changes: 2 additions & 2 deletions server/bundles/io.cloudbeaver.product.ce/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
Bundle-Vendor: DBeaver Corp
Bundle-Name: Cloudbeaver Community Product
Bundle-SymbolicName: io.cloudbeaver.product.ce;singleton:=true
Bundle-Version: 24.3.3.qualifier
Bundle-Release-Date: 20250120
Bundle-Version: 24.3.4.qualifier
Bundle-Release-Date: 20250203
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Expand Down
2 changes: 1 addition & 1 deletion server/bundles/io.cloudbeaver.product.ce/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<relativePath>../</relativePath>
</parent>
<artifactId>io.cloudbeaver.product.ce</artifactId>
<version>24.3.3-SNAPSHOT</version>
<version>24.3.4-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Base JDBC drivers
Bundle-SymbolicName: io.cloudbeaver.resources.drivers.base;singleton:=true
Bundle-Version: 1.0.114.qualifier
Bundle-Release-Date: 20250120
Bundle-Version: 1.0.115.qualifier
Bundle-Release-Date: 20250203
Bundle-Vendor: DBeaver Corp
Bundle-ActivationPolicy: lazy
Automatic-Module-Name: io.cloudbeaver.resources.drivers.base
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<relativePath>../</relativePath>
</parent>
<artifactId>io.cloudbeaver.resources.drivers.base</artifactId>
<version>1.0.114-SNAPSHOT</version>
<version>1.0.115-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
4 changes: 2 additions & 2 deletions server/bundles/io.cloudbeaver.server.ce/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
Bundle-Vendor: DBeaver Corp
Bundle-Name: Cloudbeaver CE Server
Bundle-SymbolicName: io.cloudbeaver.server.ce;singleton:=true
Bundle-Version: 24.3.3.qualifier
Bundle-Release-Date: 20250120
Bundle-Version: 24.3.4.qualifier
Bundle-Release-Date: 20250203
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Bundle-Activator: io.cloudbeaver.server.CBPlatformActivator
Expand Down
2 changes: 1 addition & 1 deletion server/bundles/io.cloudbeaver.server.ce/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<relativePath>../</relativePath>
</parent>
<artifactId>io.cloudbeaver.server.ce</artifactId>
<version>24.3.3-SNAPSHOT</version>
<version>24.3.4-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,10 @@ protected void sendConfigChangedEvent(SMCredentialsProvider credentialsProvider)
public abstract CBServerConfigurationController<T> getServerConfigurationController();

private void refreshDisabledDriversConfig() {
getDriverRegistry().refreshApplicableDrivers();
CBAppConfig config = getAppConfiguration();
Set<String> disabledDrivers = new LinkedHashSet<>(Arrays.asList(config.getDisabledDrivers()));
for (DBPDriver driver : CBPlatform.getInstance().getApplicableDrivers()) {
for (DBPDriver driver : getDriverRegistry().getApplicableDrivers()) {
if (!driver.isEmbedded() || config.isDriverForceEnabled(driver.getFullId())) {
continue;
}
Expand Down
Loading

0 comments on commit f94b000

Please sign in to comment.