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 2019/11/22 13:55:02 UTC
[syncope] branch 2_0_X updated: [SYNCOPE-1493] Fix plain attr
unique value management
This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch 2_0_X
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/2_0_X by this push:
new c0e7d46 [SYNCOPE-1493] Fix plain attr unique value management
c0e7d46 is described below
commit c0e7d463c635d5d9984b1eff52bc515462f728c0
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Fri Nov 22 14:54:37 2019 +0100
[SYNCOPE-1493] Fix plain attr unique value management
---
.../java/org/apache/syncope/core/logic/oidc/OIDCUserManager.java | 5 ++++-
.../java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java | 4 +++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ext/oidcclient/logic/src/main/java/org/apache/syncope/core/logic/oidc/OIDCUserManager.java b/ext/oidcclient/logic/src/main/java/org/apache/syncope/core/logic/oidc/OIDCUserManager.java
index a56487f..96ac99f 100644
--- a/ext/oidcclient/logic/src/main/java/org/apache/syncope/core/logic/oidc/OIDCUserManager.java
+++ b/ext/oidcclient/logic/src/main/java/org/apache/syncope/core/logic/oidc/OIDCUserManager.java
@@ -44,6 +44,7 @@ import org.apache.syncope.core.persistence.api.entity.OIDCProviderItem;
import org.apache.syncope.core.persistence.api.entity.PlainAttrUniqueValue;
import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.PlainSchema;
+import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrUniqueValue;
import org.apache.syncope.core.persistence.api.entity.user.UPlainAttrValue;
import org.apache.syncope.core.persistence.api.entity.user.User;
import org.apache.syncope.core.provisioning.api.IntAttrName;
@@ -130,7 +131,9 @@ public class OIDCUserManager {
} else if (intAttrName.getSchemaType() != null) {
switch (intAttrName.getSchemaType()) {
case PLAIN:
- PlainAttrValue value = entityFactory.newEntity(UPlainAttrValue.class);
+ PlainAttrValue value = intAttrName.getSchema().isUniqueConstraint()
+ ? entityFactory.newEntity(UPlainAttrUniqueValue.class)
+ : entityFactory.newEntity(UPlainAttrValue.class);
if (intAttrName.getSchemaType() == SchemaType.PLAIN) {
value.setStringValue(transformed);
diff --git a/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java b/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
index eeeb293..bdd881a 100644
--- a/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
+++ b/ext/saml2sp/logic/src/main/java/org/apache/syncope/core/logic/saml2/SAML2UserManager.java
@@ -129,7 +129,9 @@ public class SAML2UserManager {
} else if (intAttrName.getSchemaType() != null) {
switch (intAttrName.getSchemaType()) {
case PLAIN:
- PlainAttrValue value = entityFactory.newEntity(UPlainAttrValue.class);
+ PlainAttrValue value = intAttrName.getSchema().isUniqueConstraint()
+ ? entityFactory.newEntity(UPlainAttrUniqueValue.class)
+ : entityFactory.newEntity(UPlainAttrValue.class);
if (intAttrName.getSchemaType() == SchemaType.PLAIN) {
value.setStringValue(transformed);