Skip to content

Commit

Permalink
fix(jans-config-api): user attributes not updated #2753 (#3110)
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 Nov 29, 2022
1 parent 4b213cb commit 803468b
Showing 1 changed file with 10 additions and 2 deletions.
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

0 comments on commit 803468b

Please sign in to comment.