From 1ae558cf1928f49ab7259d34bf0198099c3e248c Mon Sep 17 00:00:00 2001 From: ZiyamSanthosh Date: Wed, 6 Sep 2023 20:33:43 +0530 Subject: [PATCH] Support scim group patch call when only value attribute is present for members --- .../protocol/endpoints/GroupResourceManager.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/charon-core/src/main/java/org/wso2/charon3/core/protocol/endpoints/GroupResourceManager.java b/modules/charon-core/src/main/java/org/wso2/charon3/core/protocol/endpoints/GroupResourceManager.java index 1e95b61b2..cd1dd3f4d 100644 --- a/modules/charon-core/src/main/java/org/wso2/charon3/core/protocol/endpoints/GroupResourceManager.java +++ b/modules/charon-core/src/main/java/org/wso2/charon3/core/protocol/endpoints/GroupResourceManager.java @@ -941,19 +941,24 @@ private List> transformMembersAttributeToMap(MultiValuedAttr ComplexAttribute complexAttribute = (ComplexAttribute) subValue; Map subAttributesList = complexAttribute.getSubAttributesList(); - if (!subAttributesList.containsKey(SCIMConstants.CommonSchemaConstants.VALUE) || + if (!subAttributesList.containsKey(SCIMConstants.CommonSchemaConstants.VALUE) && !subAttributesList.containsKey(SCIMConstants.CommonSchemaConstants.DISPLAY)) { throw new BadRequestException(ResponseCodeConstants.INVALID_SYNTAX); + } else if (!subAttributesList.containsKey(SCIMConstants.CommonSchemaConstants.VALUE)) { + throw new BadRequestException("Value attribute is required for the members attribute.", + ResponseCodeConstants.INVALID_SYNTAX); } else if (StringUtils.isEmpty(((SimpleAttribute) - subAttributesList.get(SCIMConstants.CommonSchemaConstants.VALUE)).getStringValue())) { + subAttributesList.get(SCIMConstants.CommonSchemaConstants.VALUE)).getStringValue())) { throw new BadRequestException(ResponseCodeConstants.INVALID_VALUE); } Map member = new HashMap<>(); + if (subAttributesList.containsKey(SCIMConstants.CommonSchemaConstants.DISPLAY)) { + member.put(SCIMConstants.CommonSchemaConstants.DISPLAY, ((SimpleAttribute) + (subAttributesList.get(SCIMConstants.CommonSchemaConstants.DISPLAY))).getStringValue()); + } member.put(SCIMConstants.CommonSchemaConstants.VALUE, ((SimpleAttribute) (subAttributesList.get(SCIMConstants.CommonSchemaConstants.VALUE))).getStringValue()); - member.put(SCIMConstants.CommonSchemaConstants.DISPLAY, ((SimpleAttribute) - (subAttributesList.get(SCIMConstants.CommonSchemaConstants.DISPLAY))).getStringValue()); memberList.add(member); } return memberList;