From 4b8a8878bf07402f2587aa400dc0a2bf0d895d56 Mon Sep 17 00:00:00 2001 From: sadilchamishka Date: Sat, 31 Aug 2024 12:08:37 +0530 Subject: [PATCH] Add the user updated claim list for thread local to be used by downstream tasks --- .../scim2/common/impl/SCIMUserManager.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMUserManager.java b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMUserManager.java index 466d85bc..ff883281 100644 --- a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMUserManager.java +++ b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMUserManager.java @@ -5414,15 +5414,22 @@ private void updateUserClaims(User user, Map oldClaimList, } // Update user claims. - userClaimsToBeModified.putAll(userClaimsToBeAdded); - if (MapUtils.isEmpty(simpleMultiValuedClaimsToBeAdded) && - MapUtils.isEmpty(simpleMultiValuedClaimsToBeRemoved)) { - // If no multi-valued attribute is modified. - carbonUM.setUserClaimValuesWithID(user.getId(), userClaimsToBeModified, null); - } else { - carbonUM.setUserClaimValuesWithID(user.getId(), convertClaimValuesToList(oldClaimList), - simpleMultiValuedClaimsToBeAdded, simpleMultiValuedClaimsToBeRemoved, - convertClaimValuesToList(userClaimsToBeModified), null); + try { + // The new claim list can be help full for downstream tasks like outbound provisioning. + IdentityUtil.threadLocalProperties.get().put("newClaimList", newClaimList); + userClaimsToBeModified.putAll(userClaimsToBeAdded); + if (MapUtils.isEmpty(simpleMultiValuedClaimsToBeAdded) && + MapUtils.isEmpty(simpleMultiValuedClaimsToBeRemoved)) { + // If no multi-valued attribute is modified. + carbonUM.setUserClaimValuesWithID(user.getId(), userClaimsToBeModified, null); + } else { + carbonUM.setUserClaimValuesWithID(user.getId(), convertClaimValuesToList(oldClaimList), + simpleMultiValuedClaimsToBeAdded, simpleMultiValuedClaimsToBeRemoved, + convertClaimValuesToList(userClaimsToBeModified), null); + } + } + finally { + IdentityUtil.threadLocalProperties.get().remove("newClaimList"); } }