Skip to content

Commit

Permalink
CB-5570 Merge conflicts resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-rider committed Sep 13, 2024
1 parent 9043913 commit 2e5572e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
*/
package io.cloudbeaver.model.app;

import io.cloudbeaver.DataSourceFilter;
import io.cloudbeaver.WebProjectImpl;
import io.cloudbeaver.WebSessionProjectImpl;
import io.cloudbeaver.model.log.SLF4JLogHandler;
import io.cloudbeaver.model.session.WebSession;
import org.eclipse.core.runtime.Platform;
import org.eclipse.equinox.app.IApplicationContext;
import org.jkiss.code.NotNull;
Expand All @@ -36,7 +32,6 @@
import org.jkiss.dbeaver.model.impl.app.BaseApplicationImpl;
import org.jkiss.dbeaver.model.impl.app.BaseWorkspaceImpl;
import org.jkiss.dbeaver.model.rm.RMController;
import org.jkiss.dbeaver.model.rm.RMProject;
import org.jkiss.dbeaver.model.secret.DBSSecretController;
import org.jkiss.dbeaver.model.websocket.event.WSEventController;
import org.jkiss.dbeaver.runtime.IVariableResolver;
Expand Down Expand Up @@ -161,19 +156,6 @@ private Path getCustomConfigPath(Path configPath, String fileName) {
return Files.exists(customConfigPath) ? customConfigPath : configPath.resolve(fileName);
}

@Override
public WebProjectImpl createProjectImpl(
@NotNull WebSession webSession,
@NotNull RMProject project,
@NotNull DataSourceFilter dataSourceFilter
) {
return new WebSessionProjectImpl(
webSession,
project,
dataSourceFilter
);
}

/**
* There is no secret controller in base web app.
* Method returns VoidSecretController instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.jkiss.dbeaver.model.app.DBPWorkspace;
import org.jkiss.dbeaver.model.auth.SMCredentials;
import org.jkiss.dbeaver.model.auth.SMCredentialsProvider;
import org.jkiss.dbeaver.model.impl.app.BaseProjectImpl;
import org.jkiss.dbeaver.model.impl.auth.SessionContextImpl;
import org.jkiss.dbeaver.model.rm.*;
import org.jkiss.dbeaver.model.runtime.VoidProgressMonitor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import io.cloudbeaver.DBWConstants;
import io.cloudbeaver.DBWebException;
import io.cloudbeaver.WebSessionProjectImpl;
import io.cloudbeaver.WebSessionProjectImpl;
import io.cloudbeaver.model.WebConnectionInfo;
import io.cloudbeaver.model.WebNetworkHandlerConfigInput;
import io.cloudbeaver.model.session.WebSession;
Expand Down Expand Up @@ -115,7 +114,7 @@ private static void setSecureProperties(DBWHandlerConfiguration handlerConfig, W

@Nullable
public static DBPDataSourceContainer getLocalOrGlobalDataSource(
WebApplication application, WebSession webSession, @Nullable String projectId, String connectionId
WebSession webSession, @Nullable String projectId, String connectionId
) throws DBWebException {
DBPDataSourceContainer dataSource = null;
if (!CommonUtils.isEmpty(connectionId)) {
Expand All @@ -124,9 +123,13 @@ public static DBPDataSourceContainer getLocalOrGlobalDataSource(
throw new DBWebException("Project '" + projectId + "' not found");
}
dataSource = project.getDataSourceRegistry().getDataSource(connectionId);
if (dataSource == null && (webSession.hasPermission(DBWConstants.PERMISSION_ADMIN) || application.isConfigurationMode())) {
if (dataSource == null &&
(webSession.hasPermission(DBWConstants.PERMISSION_ADMIN) || webSession.getApplication().isConfigurationMode())) {
// If called for new connection in admin mode then this connection may absent in session registry yet
dataSource = getGlobalDataSourceRegistry().getDataSource(connectionId);
project = webSession.getGlobalProject();
if (project != null) {
dataSource = project.getDataSourceRegistry().getDataSource(connectionId);
}
}
}
return dataSource;
Expand Down

0 comments on commit 2e5572e

Please sign in to comment.