You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2020/11/18 16:30:52 UTC
[syncope] branch 2_1_X updated: [SYNCOPE-1602] Including
ConnObjectKey attributes when specified
This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/2_1_X by this push:
new 8ae2b01 [SYNCOPE-1602] Including ConnObjectKey attributes when specified
8ae2b01 is described below
commit 8ae2b010323335432c0bb0492d8ec21b7f5e4d35
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Wed Nov 18 17:22:55 2020 +0100
[SYNCOPE-1602] Including ConnObjectKey attributes when specified
---
.../jpa/dao/DefaultPushCorrelationRule.java | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/DefaultPushCorrelationRule.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/DefaultPushCorrelationRule.java
index 129258e..03d1e3d 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/DefaultPushCorrelationRule.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/DefaultPushCorrelationRule.java
@@ -32,6 +32,7 @@ import org.apache.syncope.core.persistence.api.entity.Any;
import org.apache.syncope.core.provisioning.api.AccountGetter;
import org.apache.syncope.core.provisioning.api.MappingManager;
import org.apache.syncope.core.provisioning.api.PlainAttrGetter;
+import org.identityconnectors.framework.common.objects.AttributeBuilder;
import org.identityconnectors.framework.common.objects.filter.Filter;
import org.identityconnectors.framework.common.objects.filter.FilterBuilder;
import org.springframework.beans.factory.annotation.Autowired;
@@ -59,7 +60,8 @@ public class DefaultPushCorrelationRule implements PushCorrelationRule {
List<Filter> filters = new ArrayList<>();
provision.getMapping().getItems().stream().filter(
- item -> item.getPurpose() == MappingPurpose.PROPAGATION || item.getPurpose() == MappingPurpose.BOTH).
+ item -> conf.getSchemas().contains(item.getIntAttrName())
+ && (item.getPurpose() == MappingPurpose.PROPAGATION || item.getPurpose() == MappingPurpose.BOTH)).
forEach(item -> {
Pair<String, Attribute> attr = mappingManager.prepareAttr(
provision,
@@ -69,10 +71,18 @@ public class DefaultPushCorrelationRule implements PushCorrelationRule {
AccountGetter.DEFAULT,
AccountGetter.DEFAULT,
PlainAttrGetter.DEFAULT);
- if (attr != null && attr.getRight() != null && conf.getSchemas().contains(item.getIntAttrName())) {
- filters.add(provision.isIgnoreCaseMatch()
- ? FilterBuilder.equalsIgnoreCase(attr.getRight())
- : FilterBuilder.equalTo(attr.getRight()));
+ if (attr != null) {
+ Attribute toFilter = null;
+ if (attr.getLeft() != null) {
+ toFilter = AttributeBuilder.build(item.getExtAttrName(), attr.getLeft());
+ } else if (attr.getRight() != null) {
+ toFilter = attr.getRight();
+ }
+ if (toFilter != null) {
+ filters.add(provision.isIgnoreCaseMatch()
+ ? FilterBuilder.equalsIgnoreCase(toFilter)
+ : FilterBuilder.equalTo(toFilter));
+ }
}
});