Skip to content

Commit

Permalink
Fix patch groups with path as members
Browse files Browse the repository at this point in the history
  • Loading branch information
amanda-ariyaratne committed Jan 4, 2024
1 parent 0a21c41 commit bd65ad6
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package org.wso2.charon3.core.protocol.endpoints;

import org.apache.commons.lang.StringUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
Expand Down Expand Up @@ -676,7 +677,8 @@ private boolean isDeleteAllUsersOperationFound(List<PatchOperation> patchOperati
for (PatchOperation patchOperation : patchOperations) {
String operation = patchOperation.getOperation();
String path = patchOperation.getPath();
if (!(patchOperation.getValues() instanceof String)) {
if (!(SCIMConstants.OperationalConstants.ADD).equals(operation)
&& !(patchOperation.getValues() instanceof String)) {
JSONObject valuesJson = (JSONObject) patchOperation.getValues();
if (operation.equals(SCIMConstants.OperationalConstants.REPLACE) &&
((path != null && path.equals(SCIMConstants.GroupSchemaConstants.MEMBERS)) ||
Expand Down Expand Up @@ -854,7 +856,7 @@ private void processGroupPatchOperations(Map<String, List<PatchOperation>> patch
patchOperation.setValues(attributePrefixedJson);
} else if (patchOperation.getPath().equals(SCIMConstants.GroupSchemaConstants.MEMBERS) &&
patchOperation.getValues() != null) {
JSONObject valuesPropertyJson = (JSONObject) patchOperation.getValues();
JSONArray valuesPropertyJson = (JSONArray) patchOperation.getValues();
JSONObject attributePrefixedJson = new JSONObject();

attributePrefixedJson.put(SCIMConstants.GroupSchemaConstants.MEMBERS, valuesPropertyJson);
Expand Down

0 comments on commit bd65ad6

Please sign in to comment.