Skip to content

Commit

Permalink
Resolve user ID from username.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasasr1 committed May 7, 2024
1 parent 7fd6aa9 commit d59b7d4
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1297,10 +1297,19 @@ private void prepareAddedRemovedUserLists(Set<String> addedMembers, Set<String>
ResponseCodeConstants.INVALID_VALUE);
}

String userID = memberObject.get(SCIMConstants.RoleSchemaConstants.VALUE);
if (StringUtils.isEmpty(userID)) {
userID = userStoreManager.getUserIDFromUserName(
memberObject.get(SCIMConstants.RoleSchemaConstants.DISPLAY));
if (StringUtils.isEmpty(userID)) {
throw new BadRequestException("User can't be resolved from the given username.",
ResponseCodeConstants.NO_TARGET);
}
}

List<String> roleList;
try {
roleList = roleManagementService.getRoleIdListOfUser(
memberObject.get(SCIMConstants.RoleSchemaConstants.VALUE), tenantDomain);
roleList = roleManagementService.getRoleIdListOfUser(userID, tenantDomain);
} catch (IdentityRoleManagementException e) {
throw new CharonException("Error occurred while retrieving the role list of user.");
}
Expand Down

0 comments on commit d59b7d4

Please sign in to comment.