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(jans-config-api): user attributes not updated #2753 #3110

Merged
merged 1 commit into from
Nov 29, 2022
Merged
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 @@ -209,7 +209,7 @@ protected void persist(String dn, String[] objectClasses, List<AttributeData> at
resultAttributes.add(new AttributeData(SqlOperationService.DN, dn));
resultAttributes.add(new AttributeData(SqlOperationService.DOC_ID, parsedKey.getKey()));

boolean result = getOperationService().addEntry(parsedKey.getKey(), getBaseObjectClass(objectClasses), resultAttributes);
boolean result = getOperationService().addEntry(parsedKey.getKey(), getBaseObjectClassForDataOperation(objectClasses), resultAttributes);
if (!result) {
throw new EntryPersistenceException(String.format("Failed to persist entry: '%s'", dn));
}
Expand Down Expand Up @@ -266,7 +266,7 @@ public void merge(String dn, String[] objectClasses, List<AttributeDataModificat
}

if (modifications.size() > 0) {
boolean result = getOperationService().updateEntry(toSQLKey(dn).getKey(), getBaseObjectClass(objectClasses), modifications);
boolean result = getOperationService().updateEntry(toSQLKey(dn).getKey(), getBaseObjectClassForDataOperation(objectClasses), modifications);
if (!result) {
throw new EntryPersistenceException(String.format("Failed to update entry: '%s'", dn));
}
Expand Down Expand Up @@ -988,6 +988,14 @@ protected boolean isSupportForceUpdate() {
return true;
}

private String getBaseObjectClassForDataOperation(String[] objectClasses) {
if (ArrayHelper.isNotEmpty(objectClasses) && objectClasses.length > 0) {
throw new MappingException("SQL ORM supports only one OC!");
}

return getBaseObjectClass(objectClasses);
}

private String getBaseObjectClass(String[] objectClasses) {
if (ArrayHelper.isEmpty(objectClasses)) {
throw new MappingException("Object class isn't defined!");
Expand Down