dbeaver/pro#8757 Test connection permissions required (#4434)

* dbeaver/pro#8757 Test connection permissions required (the same as createConnection)

* dbeaver/pro#8757 Anno added

* dbeaver/pro#8757 restrict private project use for gql

* dbeaver/pro#8757 change error message

---------

Co-authored-by: Ainur <ainur.iagudin@dbeaver.com>
This commit is contained in:
Serge Rider
2026-07-07 14:10:26 +02:00
committed by GitHub
co-authored by Ainur
parent af11aaa8fe
commit 4221ea7fe0
2 changed files with 10 additions and 4 deletions
@@ -275,6 +275,12 @@ public abstract class WebServiceBindingBase<API_TYPE extends DBWService> impleme
if (project == null) {
throw new DBException("Project not found:" + projectId);
}
var customConnectionsEnabled =
ServletAppUtils.getServletApplication().getAppConfiguration().isSupportsCustomConnections();
if (!customConnectionsEnabled && project.isPrivateProject()) {
throw new DBWebExceptionAccessDenied("Access to private project is denied");
}
RMProject rmProject = project.getRMProject();
for (String reqProjectPermission : requireProjectPermissions) {
@@ -163,17 +163,17 @@ public interface DBWServiceCore extends DBWService {
@NotNull Map<String, Object> connectionConfig
) throws DBWebException;
@WebAction
@WebProjectAction(requireProjectPermissions = {RMConstants.PERMISSION_PROJECT_DATASOURCES_EDIT})
WebConnectionInfo testConnection(
@NotNull WebSession webSession,
@Nullable String projectId,
@Nullable @WebObjectId String projectId,
@NotNull Map<String, Object> connectionConfig
) throws DBWebException;
@WebAction
@WebProjectAction(requireProjectPermissions = {RMConstants.PERMISSION_PROJECT_DATASOURCES_EDIT})
WebNetworkEndpointInfo testNetworkHandler(
@NotNull WebSession webSession,
@Nullable String projectId,
@Nullable @WebObjectId String projectId,
@Nullable String connectionId,
@NotNull WebNetworkHandlerConfigInput nhConfig
) throws DBWebException;