Skip to content

Commit

Permalink
Support scim group patch call when only value attribute is present fo…
Browse files Browse the repository at this point in the history
…r members
  • Loading branch information
ZiyamSanthosh committed Sep 6, 2023
1 parent d5f33f8 commit 1ae558c
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -941,19 +941,24 @@ private List<Map<String, String>> transformMembersAttributeToMap(MultiValuedAttr
ComplexAttribute complexAttribute = (ComplexAttribute) subValue;
Map<String, Attribute> 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<String, String> 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;
Expand Down

0 comments on commit 1ae558c

Please sign in to comment.