Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: user attributes not updated #2753 #3403

Merged
merged 1 commit into from
Dec 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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