You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When multiple Patch Add operations are issued for the same compound object in the scope of the same PatchRequest, AddOperation creates a separate record for each property.
Important node: We are building SCIM Server, so the PatchRequest is deserialised from external system (Entra ID in our case)
To Reproduce
Using the code from the documentation and standard User resource:
Additional context
Add any other context about the problem here. For example:
Java 11
SCIM 2 SDK version: 3.0.0
Proposed Solution
I have copied and patched PatchRequest/PatchOperation classes into our code base to provide immediate fix. Please advise if pull request is welcome.
privatevoidapplyAddWithValueFilter(
@NotNullfinalPathpath,
@NotNullfinalObjectNodeexistingResource,
@NotNullfinalJsonNodevalue)
throwsBadRequestException {
FiltervalueFilter = path.getElement(0).getValueFilter();
StringfilterAttributeName = valueFilter.getAttributePath().toString();
ValueNodefilterValue = valueFilter.getComparisonValue();
// For an attribute path of the form 'emails[...].value', fetch the// attribute (emails) and the sub-attribute (value).StringattributeName = path.getElement(0).getAttribute();
StringsubAttributeName = path.getElement(1).getAttribute();
JsonNodejsonAttribute = existingResource.get(attributeName);
if (jsonAttribute == null) {
// There are no existing values for the attribute, so we should add this// value ourselves.jsonAttribute = JsonUtils.getJsonNodeFactory().arrayNode(1);
}
if (!jsonAttribute.isArray()) {
throwBadRequestException.invalidSyntax(
"The patch operation could not be processed because a complex"
+ " value selection filter was provided, but '" + attributeName
+ "' is single-valued"
);
}
ArrayNodeattribute = (ArrayNode) jsonAttribute;
//*** Changes begin hereObjectNodevalueToSet = null;
for (JsonNodeexistingObject : attribute) {
if (filterValue.equals(existingObject.get(filterAttributeName))) {
// Actually locate the existing attribute using the filter value.valueToSet = (ObjectNode) existingObject;
break;
}
}
if (valueToSet == null) {
// Construct the new attribute value if it does not already exist.valueToSet = JsonUtils.getJsonNodeFactory().objectNode();
attribute.add(valueToSet);
existingResource.replace(attributeName, attribute);
}
valueToSet.set(subAttributeName, value);
valueToSet.set(filterAttributeName, filterValue);
}
The text was updated successfully, but these errors were encountered:
Describe the bug
When multiple Patch Add operations are issued for the same compound object in the scope of the same PatchRequest, AddOperation creates a separate record for each property.
Important node: We are building SCIM Server, so the PatchRequest is deserialised from external system (Entra ID in our case)
To Reproduce
Using the code from the documentation and standard User resource:
... with this PatchOp request:
The following result is achieved (skipped the irrelevant parts of User resource):
Expected behavior
The code is expected to create only two Address records, one [type="work"] and one [type="home"]:
Additional context
Add any other context about the problem here. For example:
Proposed Solution
I have copied and patched PatchRequest/PatchOperation classes into our code base to provide immediate fix. Please advise if pull request is welcome.
The text was updated successfully, but these errors were encountered: