From 977ec0c562d9ab2436d0d433f3b14f668348b552 Mon Sep 17 00:00:00 2001 From: anjanasamindraperera Date: Wed, 13 Mar 2024 15:23:41 +0530 Subject: [PATCH] Rename scenarios and event name --- .../identity/scim2/common/impl/SCIMUserManager.java | 8 ++++---- .../carbon/identity/scim2/common/utils/Scenarios.java | 6 +++--- 2 files changed, 7 insertions(+), 7 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 6f5a23db..26ed07c4 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 @@ -1117,7 +1117,7 @@ public User updateUser(User user, Map requiredAttributes) throw // If password is updated, set it separately. if (user.getPassword() != null) { carbonUM.updateCredentialByAdminWithID(user.getId(), user.getPassword()); - publishEvent(user, IdentityEventConstants.Event.POST_UPDATE_CREDENTIAL_BY_SCIM, false); + publishEvent(user, IdentityEventConstants.Event.POST_UPDATE_CREDENTIAL, false); } updateUserClaims(user, oldClaimList, claimValuesInLocalDialect); @@ -1303,7 +1303,7 @@ public User updateUser(User user, Map requiredAttributes, // If password is updated, set it separately. if (user.getPassword() != null) { carbonUM.updateCredentialByAdminWithID(user.getId(), user.getPassword()); - publishEvent(user, IdentityEventConstants.Event.POST_UPDATE_CREDENTIAL_BY_SCIM, true); + publishEvent(user, IdentityEventConstants.Event.POST_UPDATE_CREDENTIAL, true); } updateUserClaims(user, oldClaimList, claimValuesInLocalDialect, allSimpleMultiValuedClaimsList); @@ -6301,10 +6301,10 @@ private void publishEvent(User user, String eventName, boolean isAdminUpdate) properties.put(IdentityEventConstants.EventProperty.CREDENTIAL, user.getPassword()); if (isAdminUpdate) { properties.put(IdentityEventConstants.EventProperty.SCENARIO, - Scenarios.CREDENTIAL_UPDATE_BY_ADMIN_VIA_CONSOLE.name()); + Scenarios.ADMIN_UPDATED.name()); } else { properties.put(IdentityEventConstants.EventProperty.SCENARIO, - Scenarios.CREDENTIAL_UPDATE_BY_USER_VIA_MY_ACCOUNT.name()); + Scenarios.SELF_UPDATED.name()); } Event identityMgtEvent = new Event(eventName, properties); diff --git a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/utils/Scenarios.java b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/utils/Scenarios.java index 8ba5d2d5..6376963d 100644 --- a/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/utils/Scenarios.java +++ b/components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/utils/Scenarios.java @@ -26,8 +26,8 @@ */ public enum Scenarios { - CREDENTIAL_UPDATE_BY_ADMIN_VIA_CONSOLE, - CREDENTIAL_UPDATE_BY_USER_VIA_MY_ACCOUNT; + ADMIN_UPDATED, + SELF_UPDATED; /** * Get scenario which matches the given scenario name. @@ -39,7 +39,7 @@ public enum Scenarios { public static Scenarios getScenario(String scenarioName) throws IdentitySCIMException { Scenarios[] scenarios = { - CREDENTIAL_UPDATE_BY_ADMIN_VIA_CONSOLE, CREDENTIAL_UPDATE_BY_USER_VIA_MY_ACCOUNT + ADMIN_UPDATED, SELF_UPDATED }; if (StringUtils.isNotEmpty(scenarioName)) { for (Scenarios scenario : scenarios) {