diff --git a/components/org.wso2.carbon.identity.scim2.common/pom.xml b/components/org.wso2.carbon.identity.scim2.common/pom.xml index 2750e9868..4be83fd9d 100644 --- a/components/org.wso2.carbon.identity.scim2.common/pom.xml +++ b/components/org.wso2.carbon.identity.scim2.common/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.inbound.provisioning.scim2 identity-inbound-provisioning-scim2 ../../pom.xml - 3.4.45-SNAPSHOT + 3.4.46-SNAPSHOT 4.0.0 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 b7966317f..1f34f36b3 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 @@ -420,7 +420,7 @@ public RoleV2 patchRole(String roleId, Map> patchOp updateGroups(roleId, groupOperations); } if (CollectionUtils.isNotEmpty(memberOperations)) { - updateUsers(roleId, currentRoleName, memberOperations); + updateUsers(roleId, memberOperations); } HashMap requiredAttributes = new HashMap<>(); @@ -988,7 +988,7 @@ private void updateGroups(String roleId, List groupOperations) } } - private void updateUsers(String roleId, String currentRoleName, List memberOperations) + private void updateUsers(String roleId, List memberOperations) throws BadRequestException, CharonException, ForbiddenException { Collections.sort(memberOperations); @@ -1000,13 +1000,13 @@ private void updateUsers(String roleId, String currentRoleName, List memberObject = (Map) memberOperation.getValues(); prepareAddedRemovedUserLists(addedUsers, deletedUsers, newlyAddedUsersIds, - memberOperation, memberObject, currentRoleName); + memberOperation, memberObject, roleId); } else if (memberOperation.getValues() instanceof List) { List> memberOperationValues = (List>) memberOperation.getValues(); for (Map memberObject : memberOperationValues) { prepareAddedRemovedUserLists(addedUsers, deletedUsers, newlyAddedUsersIds, - memberOperation, memberObject, currentRoleName); + memberOperation, memberObject, roleId); } } } @@ -1199,7 +1199,7 @@ private void seperateReplacedGroupLists(Set givenReplaceGroupsIds, Set addedMembers, Set removedMembers, Set newlyAddedMemberIds, PatchOperation memberOperation, - Map memberObject, String currentRoleName) + Map memberObject, String roleId) throws BadRequestException, CharonException { try { @@ -1225,11 +1225,16 @@ private void prepareAddedRemovedUserLists(Set addedMembers, Set throw new BadRequestException("User can't be resolved from the given user Id."); } - List roleList = Arrays.asList(userStoreManager. - getRoleListOfUser(memberObject.get(SCIMConstants.RoleSchemaConstants.DISPLAY))); + List roleList; + try { + roleList = roleManagementService.getRoleIdListOfUser( + memberObject.get(SCIMConstants.RoleSchemaConstants.VALUE), tenantDomain); + } catch (IdentityRoleManagementException e) { + throw new CharonException("Error occurred while retrieving the role list of user."); + } if (SCIMConstants.OperationalConstants.ADD.equals(memberOperation.getOperation()) && - !roleList.contains(currentRoleName)) { + !roleList.contains(roleId)) { removedMembers.remove(memberObject.get(SCIMConstants.RoleSchemaConstants.DISPLAY)); addedMembers.add(memberObject.get(SCIMConstants.RoleSchemaConstants.DISPLAY)); newlyAddedMemberIds.add(memberObject.get(SCIMConstants.CommonSchemaConstants.VALUE)); diff --git a/components/org.wso2.carbon.identity.scim2.provider/pom.xml b/components/org.wso2.carbon.identity.scim2.provider/pom.xml index a82c7905d..9d0210100 100644 --- a/components/org.wso2.carbon.identity.scim2.provider/pom.xml +++ b/components/org.wso2.carbon.identity.scim2.provider/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.inbound.provisioning.scim2 identity-inbound-provisioning-scim2 ../../pom.xml - 3.4.45-SNAPSHOT + 3.4.46-SNAPSHOT 4.0.0 diff --git a/features/org.wso2.carbon.identity.scim2.common.feature/pom.xml b/features/org.wso2.carbon.identity.scim2.common.feature/pom.xml index d9ba502c8..4a611d1ee 100644 --- a/features/org.wso2.carbon.identity.scim2.common.feature/pom.xml +++ b/features/org.wso2.carbon.identity.scim2.common.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.inbound.provisioning.scim2 identity-inbound-provisioning-scim2 ../../pom.xml - 3.4.45-SNAPSHOT + 3.4.46-SNAPSHOT 4.0.0 diff --git a/features/org.wso2.carbon.identity.scim2.provider.feature/pom.xml b/features/org.wso2.carbon.identity.scim2.provider.feature/pom.xml index 8a4ab7e4b..9f960cb74 100644 --- a/features/org.wso2.carbon.identity.scim2.provider.feature/pom.xml +++ b/features/org.wso2.carbon.identity.scim2.provider.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.inbound.provisioning.scim2 identity-inbound-provisioning-scim2 ../../pom.xml - 3.4.45-SNAPSHOT + 3.4.46-SNAPSHOT 4.0.0 diff --git a/features/org.wso2.carbon.identity.scim2.server.feature/pom.xml b/features/org.wso2.carbon.identity.scim2.server.feature/pom.xml index fce4e73b8..d248e7a19 100644 --- a/features/org.wso2.carbon.identity.scim2.server.feature/pom.xml +++ b/features/org.wso2.carbon.identity.scim2.server.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.inbound.provisioning.scim2 identity-inbound-provisioning-scim2 ../../pom.xml - 3.4.45-SNAPSHOT + 3.4.46-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index f5f9a2e0d..250505e96 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ identity-inbound-provisioning-scim2 pom 4.0.0 - 3.4.45-SNAPSHOT + 3.4.46-SNAPSHOT WSO2 Carbon - SCIM Provisioning Module SCIM 2.0 Implementation for C4