Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sadilchamishka committed Oct 25, 2023
1 parent f24aa1f commit 894cb2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ private String getUserId(User user, String orgId) throws OrganizationManagementA
try {
AbstractUserStoreManager userStoreManager = (AbstractUserStoreManager) getUserStoreManager(user);
String userId = userStoreManager.getUser(null, user.getUserName()).getUserID();
Optional<String> optionalUserId = OrganizationSharedUserUtil
.fetchUserIdOfAssociatedUser(userId, orgId);
Optional<String> optionalUserId =
OrganizationSharedUserUtil.getUserIdOfAssociatedUserByOrgId(userId, orgId);
return optionalUserId.orElse(userId);
} catch (UserStoreException | OrganizationManagementException e) {
throw new OrganizationManagementAuthzServiceServerException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ public static String getUserManagedOrganizationClaim(AbstractUserStoreManager us
}


public static Optional<String> fetchUserIdOfAssociatedUser(String userId, String accessingOrgId)
/**
* Get the user ID of the associated user by the organization ID.
*/
public static Optional<String> getUserIdOfAssociatedUserByOrgId(String associatedUserId, String orgId)
throws OrganizationManagementException {

return Optional.ofNullable(OrganizationUserSharingDataHolder.getInstance().getOrganizationUserSharingService()
.getUserAssociationOfAssociatedUserByOrgId(userId, accessingOrgId).getUserId());
.getUserAssociationOfAssociatedUserByOrgId(associatedUserId, orgId).getUserId());
}
}

0 comments on commit 894cb2c

Please sign in to comment.