This is an automated email from the ASF dual-hosted git repository. ilgrosso pushed a commit to branch 4_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git
commit 23531c0ce7e2f868d3c04a419bd235b445c2d46b Author: Matteo Tatoni <[email protected]> AuthorDate: Mon Sep 14 08:22:15 2026 +0200 [SYNCOPE-1997] - Fix connectivity check and improve topology UI to prevent scrolling (#1530) --- .../resources/META-INF/resources/css/topology.scss | 2 +- .../syncope/client/console/topology/Topology.html | 2 +- .../apache/syncope/core/logic/ResourceLogic.java | 9 ++++ .../provisioning/api/data/ResourceDataBinder.java | 49 ++++++++++++++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) diff --git a/client/idm/console/src/main/resources/META-INF/resources/css/topology.scss b/client/idm/console/src/main/resources/META-INF/resources/css/topology.scss index 52674d114b..de890ca91c 100644 --- a/client/idm/console/src/main/resources/META-INF/resources/css/topology.scss +++ b/client/idm/console/src/main/resources/META-INF/resources/css/topology.scss @@ -32,7 +32,7 @@ #topology { position: relative; border: 0; - height: 780px; + height: calc(100vh - 175px); overflow: hidden; cursor: grab; } diff --git a/client/idm/console/src/main/resources/org/apache/syncope/client/console/topology/Topology.html b/client/idm/console/src/main/resources/org/apache/syncope/client/console/topology/Topology.html index 17ccca0022..d2ec3c78a5 100644 --- a/client/idm/console/src/main/resources/org/apache/syncope/client/console/topology/Topology.html +++ b/client/idm/console/src/main/resources/org/apache/syncope/client/console/topology/Topology.html @@ -40,7 +40,7 @@ under the License. <wicket:extend> <span wicket:id="toggle"/> - <div id="zoom" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"> + <div id="zoom" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only pt-2 pe-2 pb-1"> <span wicket:id="zoom">[Actions]</span> </div> <div id="topology"> diff --git a/core/idm/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java b/core/idm/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java index 7e26fd99cc..1ea04a7c13 100644 --- a/core/idm/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java +++ b/core/idm/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java @@ -33,6 +33,7 @@ import org.apache.syncope.common.lib.to.Item; import org.apache.syncope.common.lib.to.Provision; import org.apache.syncope.common.lib.to.ResourceTO; import org.apache.syncope.common.lib.types.ClientExceptionType; +import org.apache.syncope.common.lib.types.ConnConfProperty; import org.apache.syncope.common.lib.types.IdMEntitlement; import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO; import org.apache.syncope.core.persistence.api.dao.ConnInstanceDAO; @@ -429,6 +430,14 @@ public class ResourceLogic extends AbstractTransactionalLogic<ResourceTO> { ConnInstance connInstance = connInstanceDAO.findById(resourceTO.getConnector()). orElseThrow(() -> new NotFoundException("Connector " + resourceTO.getConnector())); + Optional.ofNullable(resourceTO.getKey()).flatMap(resourceDAO::findById). + ifPresent(externalResource -> { + Optional<List<ConnConfProperty>> newConfOverride = + ResourceDataBinder.newConf(externalResource.getConfOverride(), + resourceTO.getConfOverride()); + resourceTO.setConfOverride(newConfOverride); + }); + connectorManager.createConnector( connectorManager.buildConnInstanceOverride( connInstance, diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java index eb72ae70a6..e45cbaf2cd 100644 --- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java +++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/data/ResourceDataBinder.java @@ -18,8 +18,13 @@ */ package org.apache.syncope.core.provisioning.api.data; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; import org.apache.syncope.common.lib.to.ResourceTO; +import org.apache.syncope.common.lib.types.ConnConfProperty; import org.apache.syncope.core.persistence.api.entity.ExternalResource; +import org.identityconnectors.common.security.GuardedString; public interface ResourceDataBinder { @@ -28,4 +33,48 @@ public interface ResourceDataBinder { ExternalResource create(ResourceTO resourceTO); ExternalResource update(ExternalResource resource, ResourceTO resourceTO); + + static Optional<List<ConnConfProperty>> newConf( + final Optional<List<ConnConfProperty>> previousConfOverride, + final Optional<List<ConnConfProperty>> toConfOverride) { + + if (toConfOverride.isEmpty()) { + return Optional.empty(); + } + + if (previousConfOverride.isEmpty()) { + return toConfOverride; + } + + List<ConnConfProperty> newConf = new ArrayList<>(); + + toConfOverride.get().forEach(property -> { + if (property.getSchema().isConfidential() + || GuardedString.class.getName().equals(property.getSchema().getType())) { + + if (property.getValues().isEmpty()) { + // no values provided, keep existing + previousConfOverride.get().stream(). + filter(p -> p.getSchema().getName().equals(property.getSchema().getName())). + findFirst().ifPresent(newConf::add); + } else { + // translate confidential properties' cleartext values into GuardedStrings + ConnConfProperty newProperty = new ConnConfProperty(); + newProperty.setSchema(property.getSchema()); + newProperty.setOverridable(property.isOverridable()); + property.getValues().forEach(value -> { + if (value instanceof String string) { + newProperty.getValues().add(new GuardedString(string.toCharArray())); + } else { + newProperty.getValues().add(value); + } + }); + } + } + + newConf.add(property); + }); + + return Optional.of(newConf); + } }
