Skip to content

Commit

Permalink
Merge branch 'wso2-extensions:master' into fidp-group2
Browse files Browse the repository at this point in the history
  • Loading branch information
SujanSanjula96 authored Nov 16, 2023
2 parents 95f331c + 4ea3370 commit 3f91522
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion components/org.wso2.carbon.identity.scim2.common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<groupId>org.wso2.carbon.identity.inbound.provisioning.scim2</groupId>
<artifactId>identity-inbound-provisioning-scim2</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>3.4.45-SNAPSHOT</version>
<version>3.4.46-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ public RoleV2 patchRole(String roleId, Map<String, List<PatchOperation>> patchOp
updateGroups(roleId, groupOperations);
}
if (CollectionUtils.isNotEmpty(memberOperations)) {
updateUsers(roleId, currentRoleName, memberOperations);
updateUsers(roleId, memberOperations);
}

HashMap<String, Boolean> requiredAttributes = new HashMap<>();
Expand Down Expand Up @@ -988,7 +988,7 @@ private void updateGroups(String roleId, List<PatchOperation> groupOperations)
}
}

private void updateUsers(String roleId, String currentRoleName, List<PatchOperation> memberOperations)
private void updateUsers(String roleId, List<PatchOperation> memberOperations)
throws BadRequestException, CharonException, ForbiddenException {

Collections.sort(memberOperations);
Expand All @@ -1000,13 +1000,13 @@ private void updateUsers(String roleId, String currentRoleName, List<PatchOperat
if (memberOperation.getValues() instanceof Map) {
Map<String, String> memberObject = (Map<String, String>) memberOperation.getValues();
prepareAddedRemovedUserLists(addedUsers, deletedUsers, newlyAddedUsersIds,
memberOperation, memberObject, currentRoleName);
memberOperation, memberObject, roleId);
} else if (memberOperation.getValues() instanceof List) {
List<Map<String, String>> memberOperationValues =
(List<Map<String, String>>) memberOperation.getValues();
for (Map<String, String> memberObject : memberOperationValues) {
prepareAddedRemovedUserLists(addedUsers, deletedUsers, newlyAddedUsersIds,
memberOperation, memberObject, currentRoleName);
memberOperation, memberObject, roleId);
}
}
}
Expand Down Expand Up @@ -1199,7 +1199,7 @@ private void seperateReplacedGroupLists(Set<String> givenReplaceGroupsIds, Set<S

private void prepareAddedRemovedUserLists(Set<String> addedMembers, Set<String> removedMembers,
Set<Object> newlyAddedMemberIds, PatchOperation memberOperation,
Map<String, String> memberObject, String currentRoleName)
Map<String, String> memberObject, String roleId)
throws BadRequestException, CharonException {

try {
Expand All @@ -1225,11 +1225,16 @@ private void prepareAddedRemovedUserLists(Set<String> addedMembers, Set<String>
throw new BadRequestException("User can't be resolved from the given user Id.");
}

List<String> roleList = Arrays.asList(userStoreManager.
getRoleListOfUser(memberObject.get(SCIMConstants.RoleSchemaConstants.DISPLAY)));
List<String> 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));
Expand Down
2 changes: 1 addition & 1 deletion components/org.wso2.carbon.identity.scim2.provider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<groupId>org.wso2.carbon.identity.inbound.provisioning.scim2</groupId>
<artifactId>identity-inbound-provisioning-scim2</artifactId>
<relativePath> ../../pom.xml</relativePath>
<version>3.4.45-SNAPSHOT</version>
<version>3.4.46-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<groupId>org.wso2.carbon.identity.inbound.provisioning.scim2</groupId>
<artifactId>identity-inbound-provisioning-scim2</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>3.4.45-SNAPSHOT</version>
<version>3.4.46-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<groupId>org.wso2.carbon.identity.inbound.provisioning.scim2</groupId>
<artifactId>identity-inbound-provisioning-scim2</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>3.4.45-SNAPSHOT</version>
<version>3.4.46-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<groupId>org.wso2.carbon.identity.inbound.provisioning.scim2</groupId>
<artifactId>identity-inbound-provisioning-scim2</artifactId>
<relativePath>../../pom.xml</relativePath>
<version>3.4.45-SNAPSHOT</version>
<version>3.4.46-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<artifactId>identity-inbound-provisioning-scim2</artifactId>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<version>3.4.45-SNAPSHOT</version>
<version>3.4.46-SNAPSHOT</version>
<name>WSO2 Carbon - SCIM Provisioning Module</name>
<description>
SCIM 2.0 Implementation for C4
Expand Down

0 comments on commit 3f91522

Please sign in to comment.