diff --git a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMRoleManagerV2.java b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMRoleManagerV2.java index 7ebb2ff39..5901a6834 100644 --- a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMRoleManagerV2.java +++ b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMRoleManagerV2.java @@ -38,6 +38,7 @@ import org.wso2.carbon.identity.role.v2.mgt.core.model.Permission; import org.wso2.carbon.identity.role.v2.mgt.core.model.Role; import org.wso2.carbon.identity.role.v2.mgt.core.model.RoleBasicInfo; +import org.wso2.carbon.identity.role.v2.mgt.core.model.RoleProperty; import org.wso2.carbon.identity.role.v2.mgt.core.model.UserBasicInfo; import org.wso2.carbon.identity.role.v2.mgt.core.util.RoleManagementUtils; import org.wso2.carbon.identity.role.v2.mgt.core.util.UserIDResolver; @@ -211,6 +212,9 @@ public RoleV2 getRole(String roleID, Map requiredAttributes) if (systemRoles.contains(role.getName())) { scimRole.setSystemRole(true); } + List roleProperties = + convertRolePropertiesToMultiValuedComplexType(role.getRoleProperties()); + scimRole.setRoleProperties(roleProperties); // Set permissions. List permissions = convertPermissionsToMultiValuedComplexType(role.getPermissions()); @@ -307,6 +311,20 @@ private List convertPermissionsToMultiValuedComplexType( return permissionValues; } + private List convertRolePropertiesToMultiValuedComplexType(List roleProperties) { + + List rolePropertyValues = new ArrayList<>(); + if (roleProperties != null) { + for (RoleProperty roleProperty : roleProperties) { + MultiValuedComplexType rolePropertyComplexObject = new MultiValuedComplexType(); + rolePropertyComplexObject.setValue(roleProperty.getValue()); + rolePropertyComplexObject.setDisplay(roleProperty.getName()); + rolePropertyValues.add(rolePropertyComplexObject); + } + } + return rolePropertyValues; + } + public void deleteRole(String roleID) throws CharonException, NotFoundException, BadRequestException { try { @@ -614,6 +632,9 @@ private List getScimRolesList(List roles, List requiredAtt if (systemRoles.contains(role.getName())) { scimRole.setSystemRole(true); } + List roleProperties = + convertRolePropertiesToMultiValuedComplexType(role.getRoleProperties()); + scimRole.setRoleProperties(roleProperties); if (requiredAttributes != null) { if (requiredAttributes.contains(USERS)) { // Set role's assigned users.