Skip to content

Commit

Permalink
fix: user attributes not updated #2753 (#3403)
Browse files Browse the repository at this point in the history
Co-authored-by: Yuriy Movchan <Yuriy.Movchan@gmail.com>
  • Loading branch information
yuremm and yurem authored Dec 26, 2022
1 parent bd2cdf8 commit f793f92
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public void persist(Client client) {
ldapEntryManager.persist(client);
}


private Client ignoreCustomObjectClassesForNonLDAP(Client client) {
String persistenceType = ldapEntryManager.getPersistenceType();
log.debug("persistenceType: {}", persistenceType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@

package io.jans.scim.service;

import java.io.Serializable;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.slf4j.Logger;

import io.jans.as.model.common.IdType;
import io.jans.model.GluuAttribute;
import io.jans.orm.PersistenceEntryManager;
Expand All @@ -23,20 +35,8 @@
import io.jans.util.ArrayHelper;
import io.jans.util.OxConstants;
import io.jans.util.StringHelper;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.time.Instant;
import java.util.UUID;

import org.slf4j.Logger;

/**
* Provides operations with persons
Expand Down Expand Up @@ -91,6 +91,8 @@ public void addPerson(GluuCustomPerson person) throws Exception {
if (persons == null || persons.size() == 0) {
person.setCreationDate(new Date());
attributeService.applyMetaData(person.getCustomAttributes());

ignoreCustomObjectClassesForNonLDAP(person);
persistenceEntryManager.persist(person);
} else {
throw new DuplicateEntryException("Duplicate UID value: " + person.getUid());
Expand All @@ -105,6 +107,19 @@ public void addPerson(GluuCustomPerson person) throws Exception {

}

private GluuCustomPerson ignoreCustomObjectClassesForNonLDAP(GluuCustomPerson person) {
String persistenceType = persistenceEntryManager.getPersistenceType();
log.debug("persistenceType: {}", persistenceType);
if (!PersistenceEntryManager.PERSITENCE_TYPES.ldap.name().equals(persistenceType)) {
log.debug(
"Setting CustomObjectClasses :{} to null as it's used only for LDAP and current persistenceType is {} ",
person.getCustomObjectClasses(), persistenceType);
person.setCustomObjectClasses(null);
}

return person;
}

public void updatePerson(GluuCustomPerson person) throws Exception {
try {
Date updateDate = new Date();
Expand Down

0 comments on commit f793f92

Please sign in to comment.