diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/WebConnectionConfigInputHandler.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/WebConnectionConfigInputHandler.java index 31c25973a9b..57688cfaa56 100644 --- a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/WebConnectionConfigInputHandler.java +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/WebConnectionConfigInputHandler.java @@ -17,25 +17,32 @@ package io.cloudbeaver; import io.cloudbeaver.model.WebConnectionConfig; -import io.cloudbeaver.model.app.WebAppConfiguration; +import io.cloudbeaver.model.session.WebSession; import io.cloudbeaver.utils.ServletAppUtils; import io.cloudbeaver.utils.WebDataSourceUtils; import org.jkiss.code.NotNull; import org.jkiss.dbeaver.Log; import org.jkiss.dbeaver.model.app.DBPDataSourceRegistry; +import org.jkiss.dbeaver.model.app.DBPProject; import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration; import org.jkiss.dbeaver.model.connection.DBPDriver; +import org.jkiss.dbeaver.model.security.SMObjectType; import org.jkiss.dbeaver.registry.DataSourceDescriptor; +import org.jkiss.dbeaver.registry.DataSourceNavigatorSettings; import org.jkiss.utils.CommonUtils; +import java.util.Map; + public class WebConnectionConfigInputHandler { private static final Log log = Log.getLog(WebConnectionConfigInputHandler.class); protected final T input; protected final DBPDataSourceRegistry registry; + protected final WebSession webSession; - public WebConnectionConfigInputHandler(@NotNull DBPDataSourceRegistry registry, T configInput) { + public WebConnectionConfigInputHandler(@NotNull DBPDataSourceRegistry registry, T configInput, WebSession webSession) { this.registry = registry; this.input = configInput; + this.webSession = webSession; } public C createDataSourceContainer() throws DBWebException { @@ -47,9 +54,7 @@ public C createDataSourceContainer() throws DBWebException { C newDataSource = createDataSourceContainerFromInput(driver); - if (ServletAppUtils.getServletApplication().getAppConfiguration() instanceof WebAppConfiguration webAppConfiguration) { - newDataSource.setNavigatorSettings(webAppConfiguration.getDefaultNavigatorSettings()); - } + presetNavigatorSettings(newDataSource); WebDataSourceUtils.saveAuthProperties( newDataSource, @@ -61,6 +66,29 @@ public C createDataSourceContainer() throws DBWebException { return newDataSource; } + private void presetNavigatorSettings(C newDataSource) { +// if (ServletAppUtils.getServletApplication().getAppConfiguration() instanceof WebAppConfiguration webAppConfiguration) { +// newDataSource.setNavigatorSettings(webAppConfiguration.getDefaultNavigatorSettings()); +// } + try { + DBPProject project = newDataSource.getProject(); + String projectId = project.getId(); + Map projectNavigatorSettings = webSession.getUserContext().getSecurityController().getObjectSettings( + projectId, SMObjectType.project, + ServletAppUtils.getServletApplication().getAppConfiguration().getDefaultUserTeam(), + DataSourceNavigatorSettings.getSettingsKeySet() + ); + if (!CommonUtils.isEmpty(projectNavigatorSettings)) { + DataSourceNavigatorSettings navigatorSettings = new DataSourceNavigatorSettings(); + navigatorSettings.loadSettings(projectNavigatorSettings); + newDataSource.setNavigatorSettings(navigatorSettings); + } + } catch (Exception e) { + log.warn("Error loading navigator settings", e); + } + + } + public void updateDataSource(@NotNull C dataSource) throws DBWebException { dataSource.setId(dataSource.getId()); if (!CommonUtils.isEmpty(input.getName())) { diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/WebSessionProjectImpl.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/WebSessionProjectImpl.java index f5dcbe73505..3b6a0cd8d61 100644 --- a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/WebSessionProjectImpl.java +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/WebSessionProjectImpl.java @@ -19,6 +19,7 @@ import io.cloudbeaver.model.WebConnectionConfig; import io.cloudbeaver.model.WebConnectionInfo; import io.cloudbeaver.model.session.WebSession; +import io.cloudbeaver.utils.ServletAppUtils; import io.cloudbeaver.utils.WebDataSourceUtils; import org.jkiss.code.NotNull; import org.jkiss.code.Nullable; @@ -252,6 +253,7 @@ public void refreshProjectSettings() throws DBException { Map loadedSettings = webSession.getSecurityController().getObjectSettings( getId(), SMObjectType.project, + ServletAppUtils.getServletApplication().getAppConfiguration().getDefaultUserTeam(), null ); projectSettings.clear(); @@ -359,7 +361,7 @@ public WebConnectionConfig getConnectionConfigInput(@Nullable Map configMap) { - return new WebConnectionConfigInputHandler<>(getDataSourceRegistry(), getConnectionConfigInput(configMap)); + return new WebConnectionConfigInputHandler<>(getDataSourceRegistry(), getConnectionConfigInput(configMap), webSession); } diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/rm/local/LocalResourceController.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/rm/local/LocalResourceController.java index b8999aee62f..cbbfbd71fa6 100644 --- a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/rm/local/LocalResourceController.java +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/rm/local/LocalResourceController.java @@ -1277,6 +1277,4 @@ private static RMProject createRmProjectFromWebProject(Path path, RMLocalProject return project; } - - } diff --git a/server/bundles/io.cloudbeaver.service.rm/schema/service.rm.graphqls b/server/bundles/io.cloudbeaver.service.rm/schema/service.rm.graphqls index 021a5b26fae..e717064e9b3 100644 --- a/server/bundles/io.cloudbeaver.service.rm/schema/service.rm.graphqls +++ b/server/bundles/io.cloudbeaver.service.rm/schema/service.rm.graphqls @@ -69,6 +69,9 @@ extend type Query { "Returns project settings that are specified for a current user" rmUserProjectSettings(projectId: ID!): Object @since(version: "25.2.1") + + "Returns project settings that are specified for a subject" + rmAdminUserProjectSettings(projectId: ID!, subjectId: String!): Object @since(version: "25.2.3") } extend type Mutation { @@ -137,4 +140,9 @@ extend type Mutation { rmAddUserProjectSettings(projectId: ID!, settings: Object!): Boolean! @since(version: "25.2.1") "Deletes project settings that are specified for a current user" rmDeleteUserProjectSettings(projectId: ID!, settingIds: [String!]!): Boolean! @since(version: "25.2.1") + + "Adds project settings (e.g. enables simple view for a project) for a subject" + rmAdminAddUserProjectSettings(projectId: ID!, subjectId:String!, settings: Object!): Boolean! @since(version: "25.2.3") + "Deletes project settings that are specified for a subject" + rmAdminDeleteUserProjectSettings(projectId: ID!, subjectId:String!, settingIds: [String!]!): Boolean! @since(version: "25.2.3") } \ No newline at end of file diff --git a/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/DBWServiceRM.java b/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/DBWServiceRM.java index 287816bd48b..087767101f5 100644 --- a/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/DBWServiceRM.java +++ b/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/DBWServiceRM.java @@ -214,4 +214,29 @@ boolean deleteProjectSettings( @NotNull @WebObjectId String projectId, @Nullable List settings ) throws DBWebException; + + @NotNull + @WebProjectAction(requireProjectPermissions = DBWConstants.PERMISSION_ADMIN) + Map getProjectSettings( + @NotNull WebSession webSession, + @NotNull @WebObjectId String projectId, + @NotNull String subjectId, + @Nullable String settingId + ) throws DBWebException; + + @WebProjectAction(requireProjectPermissions = DBWConstants.PERMISSION_ADMIN) + boolean addProjectSettings( + @NotNull WebSession webSession, + @NotNull @WebObjectId String projectId, + @NotNull String subjectId, + @NotNull Map settings + ) throws DBWebException; + + @WebProjectAction(requireProjectPermissions = DBWConstants.PERMISSION_ADMIN) + boolean deleteProjectSettings( + @NotNull WebSession webSession, + @NotNull @WebObjectId String projectId, + @NotNull String subjectId, + @Nullable List settings + ) throws DBWebException; } diff --git a/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/WebServiceBindingRM.java b/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/WebServiceBindingRM.java index b51419db36b..7cbda4d3c71 100644 --- a/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/WebServiceBindingRM.java +++ b/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/WebServiceBindingRM.java @@ -70,6 +70,14 @@ public void bindWiring(DBWBindingContext model) { getArgument(env, "settingId") ) ) + .dataFetcher( + "rmAdminUserProjectSettings", env -> getService(env).getProjectSettings( + getWebSession(env), + getArgumentVal(env, "projectId"), + getArgumentVal(env, "subjectId"), + getArgument(env, "settingId") + ) + ) ; model.getMutationType() .dataFetcher("rmCreateResource", @@ -152,6 +160,22 @@ public void bindWiring(DBWBindingContext model) { getArgument(env, "settingIds") ) ) + .dataFetcher( + "rmAdminAddUserProjectSettings", env -> getService(env).addProjectSettings( + getWebSession(env), + getArgumentVal(env, "projectId"), + getArgumentVal(env, "subjectId"), + getArgumentVal(env, "settings") + ) + ) + .dataFetcher( + "rmAdminDeleteUserProjectSettings", env -> getService(env).deleteProjectSettings( + getWebSession(env), + getArgumentVal(env, "projectId"), + getArgumentVal(env, "subjectId"), + getArgument(env, "settingIds") + ) + ) ; } diff --git a/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/impl/WebServiceRM.java b/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/impl/WebServiceRM.java index 9667b8086b6..85559943e66 100644 --- a/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/impl/WebServiceRM.java +++ b/server/bundles/io.cloudbeaver.service.rm/src/io/cloudbeaver/service/rm/impl/WebServiceRM.java @@ -469,22 +469,79 @@ public List listSubjectProjectsPermissionGrants(@NotNu } } + @Override + public boolean addProjectSettings(@NotNull WebSession webSession, @NotNull String projectId, @NotNull Map settings) + throws DBWebException { + + try { + validateProject(webSession, projectId); + //fixme transactional + SMController securityController = webSession.getSecurityController(); + securityController.deleteObjectSettings( + projectId, + SMObjectType.project, + settings.keySet() + ); + securityController.setObjectSettings( + projectId, + SMObjectType.project, + settings + ); + return true; + } catch (DBException e) { + throw new DBWebException("Error adding object settings", e); + } + } + + @NotNull + @Override + public Map getProjectSettings(@NotNull WebSession webSession, @NotNull String projectId, @Nullable String settingId) + throws DBWebException { + try { + validateProject(webSession, projectId); + //todo accumulate settings from user and team. For now just return team settings + return webSession.getSecurityController().getObjectSettings( + projectId, + SMObjectType.project, + ServletAppUtils.getServletApplication().getAppConfiguration().getDefaultUserTeam(), + settingId == null ? null : Set.of(settingId) + ); + } catch (DBException e) { + throw new DBWebException("Error getting project settings", e); + } + } + + @Override + public boolean deleteProjectSettings(@NotNull WebSession webSession, @NotNull String projectId, @Nullable List settings) + throws DBWebException { + try { + validateProject(webSession, projectId); + webSession.getSecurityController().deleteObjectSettings( + projectId, + SMObjectType.project, + settings == null ? null : new HashSet<>(settings) + ); + return true; + } catch (DBException e) { + throw new DBWebException("Error deleting object settings", e); + } + } + @NotNull @Override public Map getProjectSettings( @NotNull WebSession webSession, @NotNull String projectId, + @Nullable String subjectId, @Nullable String settingId ) throws DBWebException { try { - var project = webSession.getProjectById(projectId); - if (project == null) { - throw new DBWebException("Project '" + projectId + "' not found"); - } + validateProject(webSession, projectId); return webSession.getSecurityController().getObjectSettings( projectId, SMObjectType.project, - settingId + subjectId, + settingId == null ? null : Set.of(settingId) ); } catch (DBException e) { throw new DBWebException("Error getting project settings", e); @@ -495,16 +552,23 @@ public Map getProjectSettings( public boolean addProjectSettings( @NotNull WebSession webSession, @NotNull String projectId, + @NotNull String subjectId, @NotNull Map settings ) throws DBWebException { try { - var project = webSession.getProjectById(projectId); - if (project == null) { - throw new DBWebException("Project '" + projectId + "' not found"); - } - webSession.getSecurityController().setObjectSettings( + validateProject(webSession, projectId); + //fixme transactional + SMAdminController adminSecurityController = webSession.getAdminSecurityController(); + adminSecurityController.deleteObjectSettings( + projectId, + SMObjectType.project, + subjectId, + settings.keySet() + ); + adminSecurityController.setObjectSettings( projectId, SMObjectType.project, + subjectId, settings ); return true; @@ -517,16 +581,15 @@ public boolean addProjectSettings( public boolean deleteProjectSettings( @NotNull WebSession webSession, @NotNull String projectId, + @NotNull String subjectId, @Nullable List settings ) throws DBWebException { try { - var project = webSession.getProjectById(projectId); - if (project == null) { - throw new DBWebException("Project '" + projectId + "' not found"); - } - webSession.getSecurityController().deleteObjectSettings( + validateProject(webSession, projectId); + webSession.getAdminSecurityController().deleteObjectSettings( projectId, SMObjectType.project, + subjectId, settings == null ? null : new HashSet<>(settings) ); return true; @@ -535,6 +598,13 @@ public boolean deleteProjectSettings( } } + private void validateProject(@NotNull WebSession webSession, @NotNull String projectId) throws DBWebException { + var project = webSession.getProjectById(projectId); + if (project == null) { + throw new DBWebException("Project '" + projectId + "' not found"); + } + } + private RMController getResourceController(WebSession webSession) { return webSession.getRmController(); } diff --git a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/CBEmbeddedSecurityController.java b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/CBEmbeddedSecurityController.java index 8b11c7e1acd..98072b1f7e7 100644 --- a/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/CBEmbeddedSecurityController.java +++ b/server/bundles/io.cloudbeaver.service.security/src/io/cloudbeaver/service/security/CBEmbeddedSecurityController.java @@ -111,69 +111,7 @@ public void setObjectSettings( @NotNull Map settings ) throws DBException { String userId = getUserIdOrThrow(); - try (Connection dbCon = database.openConnection()) { - try (JDBCTransaction txn = new JDBCTransaction(dbCon)) { - deleteObjectSettings(objectId, objectType, settings.keySet()); - try ( - PreparedStatement dbStat = dbCon.prepareStatement( - "INSERT INTO {table_prefix}CB_OBJECT_SETTINGS" + - "(OBJECT_ID,OBJECT_TYPE,SUBJECT_ID,SETTING_ID,SETTING_VALUE,UPDATED_BY,UPDATE_TIME) " + - "VALUES(?,?,?,?,?,?,CURRENT_TIMESTAMP)") - ) { - for (Map.Entry entry : settings.entrySet()) { - dbStat.setString(1, objectId); - dbStat.setString(2, objectType.name()); - dbStat.setString(3, userId); - dbStat.setString(4, entry.getKey()); - dbStat.setString(5, CommonUtils.toString(entry.getValue())); - dbStat.setString(6, userId); - dbStat.addBatch(); - } - dbStat.executeBatch(); - } - txn.commit(); - } - } catch (SQLException e) { - throw new DBCException("Error while adding object settings", e); - } - } - - @NotNull - @Override - public Map getObjectSettings( - @NotNull String objectId, - @NotNull SMObjectType objectType, - @Nullable String settingId - ) throws DBException { - String userId = getUserIdOrThrow(); - try (Connection dbCon = database.openConnection()) { - try ( - PreparedStatement dbStat = dbCon.prepareStatement("SELECT SETTING_ID,SETTING_VALUE " + - "FROM {table_prefix}CB_OBJECT_SETTINGS " + - "WHERE OBJECT_ID=? AND OBJECT_TYPE=? AND SUBJECT_ID=?" + - (settingId == null ? "" : " AND SETTING_ID=?")) - ) { - int index = 1; - dbStat.setString(index++, objectId); - dbStat.setString(index++, objectType.name()); - dbStat.setString(index++, userId); - if (settingId != null) { - dbStat.setString(index++, settingId); - } - try (ResultSet dbResult = dbStat.executeQuery()) { - Map result = new LinkedHashMap<>(); - while (dbResult.next()) { - result.put( - dbResult.getString(1), - dbResult.getString(2) - ); - } - return result; - } - } - } catch (SQLException e) { - throw new DBCException("Error while getting object settings", e); - } + setObjectSettings(objectId, objectType, userId, settings); } @Override @@ -183,26 +121,7 @@ public void deleteObjectSettings( @Nullable Set settingIds ) throws DBException { String userId = getUserIdOrThrow(); - String sql = "DELETE FROM {table_prefix}CB_OBJECT_SETTINGS WHERE OBJECT_ID=? AND OBJECT_TYPE=? AND SUBJECT_ID=?"; - if (settingIds != null && !settingIds.isEmpty()) { - sql += " AND SETTING_ID IN (" + SQLUtils.generateParamList(settingIds.size()) + ")"; - } - try (Connection dbCon = database.openConnection()) { - try (PreparedStatement dbStat = dbCon.prepareStatement(sql)) { - int index = 1; - dbStat.setString(index++, objectId); - dbStat.setString(index++, objectType.name()); - dbStat.setString(index++, userId); - if (settingIds != null) { - for (String settingId : settingIds) { - dbStat.setString(index++, settingId); - } - } - dbStat.executeUpdate(); - } - } catch (SQLException e) { - throw new DBCException("Error while deleting object settings", e); - } + deleteObjectSettings(objectId, objectType, userId, settingIds); } protected boolean isSubjectExists(String subjectId) throws DBCException { @@ -1363,6 +1282,112 @@ public List getTeamMembersInfo(@NotNull String teamId) throws } } + @NotNull + @Override + public Map getObjectSettings( + @NotNull String objectId, + @NotNull SMObjectType objectType, + @Nullable String subjectId, + @Nullable Set settingIds + ) throws DBException { + try (Connection dbCon = database.openConnection()) { + try ( + PreparedStatement dbStat = dbCon.prepareStatement("SELECT SETTING_ID,SETTING_VALUE " + + "FROM {table_prefix}CB_OBJECT_SETTINGS " + + "WHERE OBJECT_ID=? AND OBJECT_TYPE=? " + + (subjectId == null ? "" : " AND SUBJECT_ID=?") + + (CommonUtils.isEmpty(settingIds) ? "" : " AND SETTING_ID IN (" + SQLUtils.generateParamList(settingIds.size()) + ")")) + ) { + int index = 1; + dbStat.setString(index++, objectId); + dbStat.setString(index++, objectType.name()); + if (subjectId != null) { + dbStat.setString(index++, subjectId); + } + if (!CommonUtils.isEmpty(settingIds)) { + for (String settingId : settingIds) { + dbStat.setString(index++, settingId); + } + } + try (ResultSet dbResult = dbStat.executeQuery()) { + Map result = new LinkedHashMap<>(); + while (dbResult.next()) { + result.put( + dbResult.getString(1), + dbResult.getString(2) + ); + } + return result; + } + } + } catch (SQLException e) { + throw new DBCException("Error while getting object settings", e); + } + } + + @Override + public void setObjectSettings( + @NotNull String objectId, + @NotNull SMObjectType objectType, + @NotNull String subjectId, + @NotNull Map settings + ) throws DBException { + try (Connection dbCon = database.openConnection()) { + try (JDBCTransaction txn = new JDBCTransaction(dbCon)) { + deleteObjectSettings(objectId, objectType, settings.keySet()); + try ( + PreparedStatement dbStat = dbCon.prepareStatement( + "INSERT INTO {table_prefix}CB_OBJECT_SETTINGS" + + "(OBJECT_ID,OBJECT_TYPE,SUBJECT_ID,SETTING_ID,SETTING_VALUE,UPDATED_BY,UPDATE_TIME) " + + "VALUES(?,?,?,?,?,?,CURRENT_TIMESTAMP)") + ) { + for (Map.Entry entry : settings.entrySet()) { + dbStat.setString(1, objectId); + dbStat.setString(2, objectType.name()); + dbStat.setString(3, subjectId); + dbStat.setString(4, entry.getKey()); + dbStat.setString(5, CommonUtils.toString(entry.getValue())); + dbStat.setString(6, subjectId); + dbStat.addBatch(); + } + dbStat.executeBatch(); + } + txn.commit(); + } + } catch (SQLException e) { + throw new DBCException("Error while adding object settings", e); + } + } + + @Override + public void deleteObjectSettings( + @NotNull String objectId, + @NotNull SMObjectType objectType, + @NotNull String subjectId, + @Nullable Set settingIds + ) throws DBException { + String sql = "DELETE FROM {table_prefix}CB_OBJECT_SETTINGS WHERE OBJECT_ID=? AND OBJECT_TYPE=? AND SUBJECT_ID=?"; + if (settingIds != null && !settingIds.isEmpty()) { + sql += " AND SETTING_ID IN (" + SQLUtils.generateParamList(settingIds.size()) + ")"; + } + try (Connection dbCon = database.openConnection()) { + try (PreparedStatement dbStat = dbCon.prepareStatement(sql)) { + int index = 1; + dbStat.setString(index++, objectId); + dbStat.setString(index++, objectType.name()); + dbStat.setString(index++, subjectId); + if (settingIds != null) { + for (String settingId : settingIds) { + dbStat.setString(index++, settingId); + } + } + dbStat.executeUpdate(); + } + } catch (SQLException e) { + throw new DBCException("Error while deleting object settings", e); + } + } + @NotNull private SMTeam fetchTeam(ResultSet dbResult) throws SQLException { return new SMTeam( diff --git a/webapp/packages/core-resource-manager/src/SharedProjectsResource.ts b/webapp/packages/core-resource-manager/src/SharedProjectsResource.ts index f71956b7cd6..6af44b6069c 100644 --- a/webapp/packages/core-resource-manager/src/SharedProjectsResource.ts +++ b/webapp/packages/core-resource-manager/src/SharedProjectsResource.ts @@ -147,6 +147,32 @@ export class SharedProjectsResource extends CachedMapResource, subjectId: string): Promise { + await this.graphQLService.sdk.adminAddUserProjectSettings({ + projectId, + subjectId, + settings, + }); + + this.markOutdated(projectId); + } + + async deleteProjectSettings(projectId: string, settingIds: string[], subjectId: string): Promise { + await this.graphQLService.sdk.adminDeleteUserProjectSettings({ + projectId, + subjectId, + settingIds, + }); + this.markOutdated(projectId); + } + protected async loader(key: ResourceKey): Promise> { const all = this.aliases.isAlias(key, CachedMapAllKey); diff --git a/webapp/packages/core-root/src/ConnectionNavigatorViewSettings.ts b/webapp/packages/core-root/src/ConnectionNavigatorViewSettings.ts index 1a76dedc885..72bdefd9a1e 100644 --- a/webapp/packages/core-root/src/ConnectionNavigatorViewSettings.ts +++ b/webapp/packages/core-root/src/ConnectionNavigatorViewSettings.ts @@ -1,6 +1,6 @@ /* * CloudBeaver - Cloud Database Manager - * Copyright (C) 2020-2024 DBeaver Corp and others + * Copyright (C) 2020-2025 DBeaver Corp and others * * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. @@ -8,7 +8,9 @@ import type { NavigatorSettingsInput } from '@cloudbeaver/core-sdk'; export type NavigatorView = 'simple' | 'advanced'; -export type NavigatorViewSettings = Partial; +export type NavigatorViewSettings = Omit & { + showSystemObjects?: boolean; +}; export const CONNECTION_NAVIGATOR_VIEW_SETTINGS: Record = { simple: { @@ -29,6 +31,6 @@ export const CONNECTION_NAVIGATOR_VIEW_SETTINGS: Record).some(key => settings[key] !== settingsToCompare[key]); +export function isNavigatorViewSettingsEqual(settings: NavigatorViewSettings, settingsToCompare: NavigatorViewSettings): boolean { + return !(Object.keys(settingsToCompare) as Array).some(key => settings[key] !== settingsToCompare[key]); } diff --git a/webapp/packages/core-sdk/src/queries/resource-manager/addUserProjectSettings.gql b/webapp/packages/core-sdk/src/queries/resource-manager/addUserProjectSettings.gql new file mode 100644 index 00000000000..feac19aa136 --- /dev/null +++ b/webapp/packages/core-sdk/src/queries/resource-manager/addUserProjectSettings.gql @@ -0,0 +1,3 @@ +mutation addUserProjectSettings($projectId: ID!, $settings: Object!) { + rmAddUserProjectSettings(projectId: $projectId, settings: $settings) +} diff --git a/webapp/packages/core-sdk/src/queries/resource-manager/adminAddUserProjectSettings.gql b/webapp/packages/core-sdk/src/queries/resource-manager/adminAddUserProjectSettings.gql new file mode 100644 index 00000000000..26a5d2bff70 --- /dev/null +++ b/webapp/packages/core-sdk/src/queries/resource-manager/adminAddUserProjectSettings.gql @@ -0,0 +1,3 @@ +mutation adminAddUserProjectSettings($projectId: ID!, $subjectId: String!, $settings: Object!) { + rmAdminAddUserProjectSettings(projectId: $projectId, subjectId: $subjectId, settings: $settings) +} diff --git a/webapp/packages/core-sdk/src/queries/resource-manager/adminDeleteUserProjectSettings.gql b/webapp/packages/core-sdk/src/queries/resource-manager/adminDeleteUserProjectSettings.gql new file mode 100644 index 00000000000..aaf44f36f76 --- /dev/null +++ b/webapp/packages/core-sdk/src/queries/resource-manager/adminDeleteUserProjectSettings.gql @@ -0,0 +1,3 @@ +mutation adminDeleteUserProjectSettings($projectId: ID!, $subjectId: String!, $settingIds: [String!]!) { + rmAdminDeleteUserProjectSettings(projectId: $projectId, subjectId: $subjectId, settingIds: $settingIds) +} diff --git a/webapp/packages/core-sdk/src/queries/resource-manager/deleteUserProjectSettings.gql b/webapp/packages/core-sdk/src/queries/resource-manager/deleteUserProjectSettings.gql new file mode 100644 index 00000000000..e694d419810 --- /dev/null +++ b/webapp/packages/core-sdk/src/queries/resource-manager/deleteUserProjectSettings.gql @@ -0,0 +1,3 @@ +mutation deleteUserProjectSettings($projectId: ID!, $settingIds: [String!]!) { + rmDeleteUserProjectSettings(projectId: $projectId, settingIds: $settingIds) +} diff --git a/webapp/packages/core-sdk/src/queries/resource-manager/getAdminUserProjectSettings.gql b/webapp/packages/core-sdk/src/queries/resource-manager/getAdminUserProjectSettings.gql new file mode 100644 index 00000000000..33615b60b9f --- /dev/null +++ b/webapp/packages/core-sdk/src/queries/resource-manager/getAdminUserProjectSettings.gql @@ -0,0 +1,3 @@ +query getAdminUserProjectSettings($projectId: ID!, $subjectId: String!) { + rmAdminUserProjectSettings(projectId: $projectId, subjectId: $subjectId) +} diff --git a/webapp/packages/core-sdk/src/queries/resource-manager/getUserProjectSettings.gql b/webapp/packages/core-sdk/src/queries/resource-manager/getUserProjectSettings.gql new file mode 100644 index 00000000000..cc982b65e19 --- /dev/null +++ b/webapp/packages/core-sdk/src/queries/resource-manager/getUserProjectSettings.gql @@ -0,0 +1,3 @@ +query getUserProjectSettings($projectId: ID!) { + rmUserProjectSettings(projectId: $projectId) +}