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 patch /Groups when path parameter is present in the body #398

Merged
merged 1 commit into from
Jan 4, 2024
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 @@ -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
Loading