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

Support scim group patch call when only value attribute is present for members. #391

Closed
Closed
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 @@ -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
Loading